summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util/langhelpers.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 01:19:47 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2019-01-06 18:23:11 -0500
commit1e278de4cc9a4181e0747640a960e80efcea1ca9 (patch)
tree13d0c035807613bfa07e734acad79b9c843cb8b0 /lib/sqlalchemy/util/langhelpers.py
parent1e1a38e7801f410f244e4bbb44ec795ae152e04e (diff)
downloadsqlalchemy-1e278de4cc9a4181e0747640a960e80efcea1ca9.tar.gz
Post black reformatting
Applied on top of a pure run of black -l 79 in I7eda77fed3d8e73df84b3651fd6cfcfe858d4dc9, this set of changes resolves all remaining flake8 conditions for those codes we have enabled in setup.cfg. Included are resolutions for all remaining flake8 issues including shadowed builtins, long lines, import order, unused imports, duplicate imports, and docstring issues. Change-Id: I4f72d3ba1380dd601610ff80b8fb06a2aff8b0fe
Diffstat (limited to 'lib/sqlalchemy/util/langhelpers.py')
-rw-r--r--lib/sqlalchemy/util/langhelpers.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py
index 6a286998b..49b5eb87f 100644
--- a/lib/sqlalchemy/util/langhelpers.py
+++ b/lib/sqlalchemy/util/langhelpers.py
@@ -9,6 +9,8 @@
modules, classes, hierarchies, attributes, functions, and methods.
"""
+from functools import update_wrapper
+import hashlib
import inspect
import itertools
import operator
@@ -16,11 +18,10 @@ import re
import sys
import types
import warnings
-from functools import update_wrapper
-from .. import exc
-import hashlib
-from . import compat
+
from . import _collections
+from . import compat
+from .. import exc
def md5_hex(x):
@@ -857,7 +858,10 @@ def memoized_instancemethod(fn):
def oneshot(self, *args, **kw):
result = fn(self, *args, **kw)
- memo = lambda *a, **kw: result
+
+ def memo(*a, **kw):
+ return result
+
memo.__name__ = fn.__name__
memo.__doc__ = fn.__doc__
self.__dict__[fn.__name__] = memo
@@ -914,7 +918,10 @@ class MemoizedSlots(object):
def oneshot(*args, **kw):
result = fn(*args, **kw)
- memo = lambda *a, **kw: result
+
+ def memo(*a, **kw):
+ return result
+
memo.__name__ = fn.__name__
memo.__doc__ = fn.__doc__
setattr(self, key, memo)
@@ -928,8 +935,6 @@ class MemoizedSlots(object):
def dependency_for(modulename, add_to_all=False):
def decorate(obj):
- # TODO: would be nice to improve on this import silliness,
- # unfortunately importlib doesn't work that great either
tokens = modulename.split(".")
mod = compat.import_(
".".join(tokens[0:-1]), globals(), locals(), [tokens[-1]]
@@ -1461,7 +1466,7 @@ def attrsetter(attrname):
class EnsureKWArgType(type):
- """Apply translation of functions to accept **kw arguments if they
+ r"""Apply translation of functions to accept \**kw arguments if they
don't already.
"""