Changeset 26
- Timestamp:
- 11/10/04 08:18:45
- Files:
-
- trunk/__init__.py (modified) (1 diff)
- trunk/analysis.py (modified) (1 diff)
- trunk/codewalk.py (modified) (1 diff)
- trunk/containers.py (modified) (1 diff)
- trunk/engines.py (modified) (3 diffs)
- trunk/logic.py (modified) (2 diffs)
- trunk/readme.py (modified) (5 diffs)
- trunk/storage/storeado.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/__init__.py
r25 r26 1 1 import ConfigParser 2 2 import datetime 3 3 4 4 5 from dejavu.containers import * trunk/analysis.py
r25 r26 110 110 111 111 def results(self): 112 # Force all groups to functions. The reason we do it here instead113 # of __init__ isso consumers can still read self.groups as strings112 # Force all groups to functions. We do it here instead of __init__ 113 # so consumers can still read self.groups as strings 114 114 # if that's what they supplied. 115 115 groups = [_force_function(group) for group in self.groups] trunk/codewalk.py
r25 r26 938 938 class KeywordInspector(Rewriter): 939 939 """Produce a list of all keyword arguments expected.""" 940 940 941 def __init__(self, obj): 942 """KeywordInspector(obj). List keyword arguments expected.""" 941 943 Rewriter.__init__(self, obj) 942 assert self.co_flags & 0x0008 943 assert len(self.co_varnames) > 1 944 if not (self.co_flags & 0x0008): 945 raise ValueError("'%s' does not possess **kwargs." % obj) 946 if len(self.co_varnames) <= 1: 947 raise ValueError("'%s' does not possess more than 1 varname." % obj) 944 948 self._kwargs = [] 945 949 self.flag = None 946 950 947 951 def kwargs(self): 952 """kwargs() -> List of keyword arguments expected.""" 948 953 self.walk() 949 954 return self._kwargs trunk/containers.py
r25 r26 374 374 def row_number(self, **facet): 375 375 k, v = facet.popitem() 376 return self.facets[k].index(v) 376 f = self.facets[k] 377 try: 378 return f.index(v) 379 except ValueError: 380 raise ValueError("'%s' is not a known %s" % (v, k)) 377 381 378 382 def row(self, **facet): trunk/engines.py
r25 r26 86 86 self.acquire() 87 87 try: 88 return self.Members .copy()88 return self.Members[:] 89 89 finally: 90 90 self.release() … … 119 119 def __copy__(self): 120 120 newUnit = dejavu.Unit.__copy__(self) 121 newUnit.Members = self.Members .copy()121 newUnit.Members = self.Members[:] 122 122 return newUnit 123 123 … … 417 417 B.acquire() 418 418 try: 419 B.Members = A.Members .copy()419 B.Members = A.Members[:] 420 420 finally: 421 421 A.release() trunk/logic.py
r25 r26 246 246 def __and__(self, other): 247 247 """Logical-and this Expression with another.""" 248 assert isinstance(other, Expression) 248 if not isinstance(other, Expression): 249 raise TypeError("'%s' is not an Expression" % other) 249 250 ag = Aggregator(self.func) 250 251 ag.and_combine(other.func) … … 255 256 def __or__(self, other): 256 257 """Logical-or this Expression with another.""" 257 assert isinstance(other, Expression) 258 if not isinstance(other, Expression): 259 raise TypeError("'%s' is not an Expression" % other) 258 260 ag = Aggregator(self.func) 259 261 ag.or_combine(other.func) trunk/readme.py
r25 r26 1 """ 1 """Dejavu is an Object-Relational Mapper. 2 3 Persisted objects are called "Units", and are served into 4 Sandboxes within an Arena. Each Unit instance has a class, 5 which maintains its schema via Unit Properties. 6 7 "Dejavu", to quote Flying Circus episode 16, means "that strange feeling 8 we sometimes get that we've lived through something before." What better 9 name for an object server? Our terminology reflects this cognitive bent: 10 sandboxes "memorize", "recall" and "forget" Units. 11 12 Most Unit lifecycles follow the same pattern: 13 aUnit = sandbox.unit(cls, ID=ID) 14 val = aUnit.propertyName 15 aUnit.propertyName = newValue 16 del aUnit # or otherwise release the reference, e.g. close the scope. 17 18 When creating new Units, a similar pattern would be: 19 newUnit = unit_class() 20 newUnit.propertyName = newValue 21 sandbox.memorize(newUnit) 22 del newUnit # or otherwise release the reference. 23 24 Using recall(), you get an iterator: 25 for unit in sandbox.recall(cls, expr): 26 do_something_with(unit) 27 28 You destroy a Unit via Unit.forget(). 29 30 Applications only need to call Unit.repress() when they wish to stop 31 caching the object, returning it to storage. This is very rare, and 32 should really only be performed within dejavu code. 33 34 35 LICENSE 36 ------- 2 37 This work, including the source code, documentation 3 38 and related data, is placed into the public domain. … … 11 46 RESULTING FROM THE USE, MODIFICATION, OR 12 47 REDISTRIBUTION OF THIS SOFTWARE. 13 14 15 Dejavu is an Object-Relational Mapper. Objects are called "Units",16 and are served into Sandboxes within an Arena. Each Unit instance17 has a class, which maintains its schema via Unit Properties.18 19 "Dejavu", to quote Flying Circus episode 16, means "that strange feeling20 we sometimes get that we've lived through something before." What better21 name for an object server? Our terminology reflects this cognitive bent:22 sandboxes "memorize", "recall" and "forget" Units.23 24 Most Unit lifecycles follow the same pattern:25 aUnit = sandbox.unit(cls, ID=ID)26 val = aUnit.propertyName27 aUnit.propertyName = newValue28 del aUnit # or otherwise release the reference, e.g. close the scope.29 30 When creating new Units, a similar pattern would be:31 newUnit = unit_class()32 newUnit.propertyName = newValue33 sandbox.memorize(newUnit)34 del newUnit # or otherwise release the reference.35 36 Using recall(), you get an iterator:37 for unit in sandbox.recall(cls, expr):38 do_something_with(unit)39 40 You destroy a Unit via Unit.forget().41 42 Applications only need to call Unit.repress() when they wish to stop43 caching the object, returning it to storage. This is very rare, and44 should really only be performed within dejavu code.45 48 """ 46 49 … … 71 74 and ([djvMissionTrip].[Field] = 'BC')) 72 75 and ([u'C'] Like '%djvMissionTrip].[Plan%')" 73 5. Investigate making UnitCollection._IDs a full property (a list). This 74 would make pickling/unpickling easier. 75 6. More SM's. 76 5. More SM's. 76 77 SQLite 77 78 PostgreSQL … … 106 107 them directly. 107 108 8. Added __getstate__ and __setstate__ to Unit and subclasses. 109 9. Made UnitCollection._IDs a full property ("Members"). This 110 makes persistence (especially pickling/unpickling) easier. 108 111 109 112 1.2.4 (10/4/04): … … 226 229 1.0.1 (7/16/04): 227 230 1. Added the COPY rule to engines.py. 231 232 Prior to July 2004, Dejavu was integrated with a Python application 233 framework, which is now called "Cation". Development on the 234 previously-integrated project began in September 2003. 228 235 """ trunk/storage/storeado.py
r25 r26 753 753 754 754 # TODO: concat multiple pairs. 755 assert len(pairs) == 1 755 if len(pairs) != 1: 756 raise ValueError("Multiselect does not yet work on multiple pairs.") 756 757 for cls, expr in pairs: 757 758 if expr is None:
