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/exc.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/exc.py')
-rw-r--r-- | lib/sqlalchemy/orm/exc.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/sqlalchemy/orm/exc.py b/lib/sqlalchemy/orm/exc.py index eb4baa08d..f0aa02e99 100644 --- a/lib/sqlalchemy/orm/exc.py +++ b/lib/sqlalchemy/orm/exc.py @@ -38,6 +38,7 @@ class StaleDataError(sa_exc.SQLAlchemyError): """ + ConcurrentModificationError = StaleDataError @@ -72,16 +73,19 @@ class UnmappedInstanceError(UnmappedError): try: base.class_mapper(type(obj)) name = _safe_cls_name(type(obj)) - msg = ("Class %r is mapped, but this instance lacks " - "instrumentation. This occurs when the instance " - "is created before sqlalchemy.orm.mapper(%s) " - "was called." % (name, name)) + msg = ( + "Class %r is mapped, but this instance lacks " + "instrumentation. This occurs when the instance " + "is created before sqlalchemy.orm.mapper(%s) " + "was called." % (name, name) + ) except UnmappedClassError: msg = _default_unmapped(type(obj)) if isinstance(obj, type): msg += ( - '; was a class (%s) supplied where an instance was ' - 'required?' % _safe_cls_name(obj)) + "; was a class (%s) supplied where an instance was " + "required?" % _safe_cls_name(obj) + ) UnmappedError.__init__(self, msg) def __reduce__(self): @@ -119,11 +123,14 @@ class ObjectDeletedError(sa_exc.InvalidRequestError): object. """ + @util.dependencies("sqlalchemy.orm.base") def __init__(self, base, state, msg=None): if not msg: - msg = "Instance '%s' has been deleted, or its "\ + msg = ( + "Instance '%s' has been deleted, or its " "row is otherwise not present." % base.state_str(state) + ) sa_exc.InvalidRequestError.__init__(self, msg) @@ -145,9 +152,9 @@ class MultipleResultsFound(sa_exc.InvalidRequestError): def _safe_cls_name(cls): try: - cls_name = '.'.join((cls.__module__, cls.__name__)) + cls_name = ".".join((cls.__module__, cls.__name__)) except AttributeError: - cls_name = getattr(cls, '__name__', None) + cls_name = getattr(cls, "__name__", None) if cls_name is None: cls_name = repr(cls) return cls_name |