summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/collections.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-05-26 19:06:13 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-05-26 19:06:13 -0400
commit6cde27fe9161a21b075c7b8faa09d1e77169f1f2 (patch)
treed7d986fa78683a7e570dd1e6da84e7bb4ca1b762 /lib/sqlalchemy/orm/collections.py
parent29689fa566ba1bd3dc08727754632c9e8074137c (diff)
downloadsqlalchemy-6cde27fe9161a21b075c7b8faa09d1e77169f1f2.tar.gz
a pass where we try to squash down as many list()/keys() combinations
as possible
Diffstat (limited to 'lib/sqlalchemy/orm/collections.py')
-rw-r--r--lib/sqlalchemy/orm/collections.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py
index bb7882ee9..03917d112 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -883,7 +883,7 @@ def _instrument_class(cls):
# search for _sa_instrument_role-decorated methods in
# method resolution order, assign to roles
for supercls in cls.__mro__:
- for name, method in list(vars(supercls).items()):
+ for name, method in vars(supercls).items():
if not util.callable(method):
continue
@@ -917,11 +917,11 @@ def _instrument_class(cls):
collection_type = util.duck_type_collection(cls)
if collection_type in __interfaces:
canned_roles, decorators = __interfaces[collection_type]
- for role, name in list(canned_roles.items()):
+ for role, name in canned_roles.items():
roles.setdefault(role, name)
# apply ABC auto-decoration to methods that need it
- for method, decorator in list(decorators.items()):
+ for method, decorator in decorators.items():
fn = getattr(cls, method, None)
if (fn and method not in methods and
not hasattr(fn, '_sa_instrumented')):
@@ -952,12 +952,12 @@ def _instrument_class(cls):
# apply ad-hoc instrumentation from decorators, class-level defaults
# and implicit role declarations
- for method_name, (before, argument, after) in list(methods.items()):
+ for method_name, (before, argument, after) in methods.items():
setattr(cls, method_name,
_instrument_membership_mutator(getattr(cls, method_name),
before, argument, after))
# intern the role map
- for role, method_name in list(roles.items()):
+ for role, method_name in roles.items():
setattr(cls, '_sa_%s' % role, getattr(cls, method_name))
setattr(cls, '_sa_instrumented', id(cls))
@@ -1250,7 +1250,7 @@ def _dict_decorators():
def update(self, __other=Unspecified, **kw):
if __other is not Unspecified:
if hasattr(__other, 'keys'):
- for key in list(__other.keys()):
+ for key in list(__other):
if (key not in self or
self[key] is not __other[key]):
self[key] = __other[key]