Commits

Mike Bayer  committed b814ef9 Draft

don't need this is_really_none() thing anymore

  • Participants
  • Parent commits 2b689c0

Comments (0)

Files changed (4)

File lib/sqlalchemy/orm/identity.py

         state = dict.__getitem__(self, key)
         o = state.obj()
         if o is None:
-            o = state._is_really_none()
-        if o is None:
             raise KeyError, key
         return o
 
             if dict.__contains__(self, key):
                 state = dict.__getitem__(self, key)
                 o = state.obj()
-                if o is None:
-                    o = state._is_really_none()
             else:
                 return False
         except KeyError:
                 existing_state = dict.__getitem__(self, key)
                 if existing_state is not state:
                     o = existing_state.obj()
-                    if o is None:
-                        o = existing_state._is_really_none()
                     if o is not None:
                         raise AssertionError("A conflicting state is already "
                                         "present in the identity map for key %r"
             return default
         o = state.obj()
         if o is None:
-            o = state._is_really_none()
-            if o is None:
-                return default
+            return default
         return o
 
     def _items(self):

File lib/sqlalchemy/orm/persistence.py

 def _cached_connection_dict(base_mapper):
     # dictionary of connection->connection_with_cache_options.
     return util.PopulateDict(
-        lambda conn:conn.execution_options(
+        lambda conn: conn.execution_options(
         compiled_cache=base_mapper._compiled_cache
     ))
 
     persistent = set(s for s in pending if s.key is not None)
     pending.difference_update(persistent)
     return sorted(pending, key=operator.attrgetter("insert_order")) + \
-                sorted(persistent, key=lambda q:q.key[1])
+                sorted(persistent, key=lambda q: q.key[1])
 
 class BulkUD(object):
     """Handle bulk update and deletes via a :class:`.Query`."""
 
         #TODO: detect when the where clause is a trivial primary key match
         self.matched_objects = [
-                            obj for (cls, pk),obj in
+                            obj for (cls, pk), obj in
                             query.session.identity_map.iteritems()
                             if issubclass(cls, target_cls) and
                             eval_condition(obj)]
     @classmethod
     def factory(cls, query, synchronize_session, values):
         return BulkUD._factory({
-            "evaluate":BulkUpdateEvaluate,
-            "fetch":BulkUpdateFetch,
-            False:BulkUpdate
+            "evaluate": BulkUpdateEvaluate,
+            "fetch": BulkUpdateFetch,
+            False: BulkUpdate
         }, synchronize_session, query, values)
 
     def _do_exec(self):
     @classmethod
     def factory(cls, query, synchronize_session):
         return BulkUD._factory({
-            "evaluate":BulkDeleteEvaluate,
-            "fetch":BulkDeleteFetch,
-            False:BulkDelete
+            "evaluate": BulkDeleteEvaluate,
+            "fetch": BulkDeleteFetch,
+            False: BulkDelete
         }, synchronize_session, query)
 
     def _do_exec(self):
     """BulkUD which handles UPDATEs using the "evaluate"
     method of session resolution."""
 
-    def _additional_evaluators(self,evaluator_compiler):
+    def _additional_evaluators(self, evaluator_compiler):
         self.value_evaluators = {}
-        for key,value in self.values.iteritems():
+        for key, value in self.values.iteritems():
             key = _attr_as_key(key)
             self.value_evaluators[key] = evaluator_compiler.process(
                                 expression._literal_as_binds(value))

File lib/sqlalchemy/orm/state.py

     def _instance_dict(self):
         return None
 
-    def _is_really_none(self):
-        return self.obj()
-
     def _modified_event(self, dict_, attr, previous, collection=False):
         if attr.key not in self.committed_state:
             if collection:

File test/perf/orm2010.py

 
 #stats.sort_stats('time', 'calls')
 #stats.print_stats()
-#os.system("runsnake %s" % filename)
+os.system("runsnake %s" % filename)
 
 # SQLA Version: 0.7b1
 # Total calls 4956750