[Checkins]
SVN: Sandbox/ocql-foliage/trunk/src/ocql/engine/runnablequery.py
debug support (by Graham)
Adam Groszer
agroszer at gmail.com
Tue Sep 25 17:32:49 EDT 2007
Log message for revision 80058:
debug support (by Graham)
Changed:
U Sandbox/ocql-foliage/trunk/src/ocql/engine/runnablequery.py
-=-
Modified: Sandbox/ocql-foliage/trunk/src/ocql/engine/runnablequery.py
===================================================================
--- Sandbox/ocql-foliage/trunk/src/ocql/engine/runnablequery.py 2007-09-25 21:32:01 UTC (rev 80057)
+++ Sandbox/ocql-foliage/trunk/src/ocql/engine/runnablequery.py 2007-09-25 21:32:48 UTC (rev 80058)
@@ -3,8 +3,6 @@
# This will return the resultset
#
-#import __builtin__
-
_marker = object()
def d_reduce(function, sequence, initializer=_marker):
@@ -13,8 +11,32 @@
else:
rv = reduce(function, sequence, initializer)
return rv
-
+def d_map(function, *sequences):
+ #print "Mapping from", [i for i in sequences[0]]
+ rv = map(function, *sequences)
+ return rv
+
+def d_range(start, stop):
+ rv = range(start, stop)
+ return rv
+
+class d_set(set):
+ def union(self, other):
+ rv = set.union(self, other)
+ return rv
+
+ def __call__(self):
+ rv = set.__call__(self)
+ return rv
+
+ def __init__(self, list=[]):
+ #print "creating set with values", list
+ rv = set.__init__(self, list)
+ return rv
+
+
+
class RunnableQuery:
"""
metadata: ocql.metadata instance
@@ -40,6 +62,9 @@
'operator': operator}
if debug:
mapping['reduce'] = d_reduce
+ mapping['map'] = d_map
+ mapping['range'] = d_range
+ mapping['set'] = d_set
return eval(self.code, mapping, mapping)
More information about the Checkins
mailing list