diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-01-06 01:14:26 -0500 |
---|---|---|
committer | mike bayer <mike_mp@zzzcomputing.com> | 2019-01-06 17:34:50 +0000 |
commit | 1e1a38e7801f410f244e4bbb44ec795ae152e04e (patch) | |
tree | 28e725c5c8188bd0cfd133d1e268dbca9b524978 /lib/sqlalchemy/orm/identity.py | |
parent | 404e69426b05a82d905cbb3ad33adafccddb00dd (diff) | |
download | sqlalchemy-1e1a38e7801f410f244e4bbb44ec795ae152e04e.tar.gz |
Run black -l 79 against all source files
This is a straight reformat run using black as is, with no edits
applied at all.
The black run will format code consistently, however in
some cases that are prevalent in SQLAlchemy code it produces
too-long lines. The too-long lines will be resolved in the
following commit that will resolve all remaining flake8 issues
including shadowed builtins, long lines, import order, unused
imports, duplicate imports, and docstring issues.
Change-Id: I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9
Diffstat (limited to 'lib/sqlalchemy/orm/identity.py')
-rw-r--r-- | lib/sqlalchemy/orm/identity.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/sqlalchemy/orm/identity.py b/lib/sqlalchemy/orm/identity.py index b03bb0a0d..2487cdb23 100644 --- a/lib/sqlalchemy/orm/identity.py +++ b/lib/sqlalchemy/orm/identity.py @@ -11,6 +11,7 @@ from .. import util from .. import exc as sa_exc from . import util as orm_util + class IdentityMap(object): def __init__(self): self._dict = {} @@ -84,7 +85,6 @@ class IdentityMap(object): class WeakInstanceDict(IdentityMap): - def __getitem__(self, key): state = self._dict[key] o = state.obj() @@ -145,8 +145,9 @@ class WeakInstanceDict(IdentityMap): raise sa_exc.InvalidRequestError( "Can't attach instance " "%s; another instance with key %s is already " - "present in this session." % ( - orm_util.state_str(state), state.key)) + "present in this session." + % (orm_util.state_str(state), state.key) + ) else: return False self._dict[key] = state @@ -253,6 +254,7 @@ class StrongInstanceDict(IdentityMap): """ if util.py2k: + def itervalues(self): return self._dict.itervalues() @@ -282,8 +284,9 @@ class StrongInstanceDict(IdentityMap): def contains_state(self, state): return ( - state.key in self and - attributes.instance_state(self[state.key]) is state) + state.key in self + and attributes.instance_state(self[state.key]) is state + ) def replace(self, state): if state.key in self._dict: @@ -303,8 +306,9 @@ class StrongInstanceDict(IdentityMap): raise sa_exc.InvalidRequestError( "Can't attach instance " "%s; another instance with key %s is already " - "present in this session." % ( - orm_util.state_str(state), state.key)) + "present in this session." + % (orm_util.state_str(state), state.key) + ) return False else: self._dict[state.key] = state.obj() |