summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/testing/entities.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 01:14:26 -0500
committermike bayer <mike_mp@zzzcomputing.com>2019-01-06 17:34:50 +0000
commit1e1a38e7801f410f244e4bbb44ec795ae152e04e (patch)
tree28e725c5c8188bd0cfd133d1e268dbca9b524978 /lib/sqlalchemy/testing/entities.py
parent404e69426b05a82d905cbb3ad33adafccddb00dd (diff)
downloadsqlalchemy-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/testing/entities.py')
-rw-r--r--lib/sqlalchemy/testing/entities.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/sqlalchemy/testing/entities.py b/lib/sqlalchemy/testing/entities.py
index b634735fc..42c42149c 100644
--- a/lib/sqlalchemy/testing/entities.py
+++ b/lib/sqlalchemy/testing/entities.py
@@ -12,7 +12,6 @@ _repr_stack = set()
class BasicEntity(object):
-
def __init__(self, **kw):
for key, value in kw.items():
setattr(self, key, value)
@@ -24,17 +23,22 @@ class BasicEntity(object):
try:
return "%s(%s)" % (
(self.__class__.__name__),
- ', '.join(["%s=%r" % (key, getattr(self, key))
- for key in sorted(self.__dict__.keys())
- if not key.startswith('_')]))
+ ", ".join(
+ [
+ "%s=%r" % (key, getattr(self, key))
+ for key in sorted(self.__dict__.keys())
+ if not key.startswith("_")
+ ]
+ ),
+ )
finally:
_repr_stack.remove(id(self))
+
_recursion_stack = set()
class ComparableEntity(BasicEntity):
-
def __hash__(self):
return hash(self.__class__)
@@ -75,7 +79,7 @@ class ComparableEntity(BasicEntity):
b = other
for attr in list(a.__dict__):
- if attr.startswith('_'):
+ if attr.startswith("_"):
continue
value = getattr(a, attr)
@@ -85,9 +89,10 @@ class ComparableEntity(BasicEntity):
except (AttributeError, sa_exc.UnboundExecutionError):
return False
- if hasattr(value, '__iter__'):
- if hasattr(value, '__getitem__') and not hasattr(
- value, 'keys'):
+ if hasattr(value, "__iter__"):
+ if hasattr(value, "__getitem__") and not hasattr(
+ value, "keys"
+ ):
if list(value) != list(battr):
return False
else: