diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-06-28 11:49:02 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-06-28 11:49:02 -0400 |
commit | 536d5187a038a44aec624dd2a99792f49dec82ed (patch) | |
tree | 2c50af290975a82252f6ba88e28e05b211f1088e /lib/sqlalchemy/util/langhelpers.py | |
parent | 83750628d180b9b9e5a6ae9a2ecb3a001553cb81 (diff) | |
download | sqlalchemy-536d5187a038a44aec624dd2a99792f49dec82ed.tar.gz |
Vendor python3 formatargspec
Replaced the usage of inspect.formatargspec() with a vendored version
copied from the Python standard library, as inspect.formatargspec()
is deprecated and as of Python 3.7.0 is emitting a warning.
Change-Id: I751652fac7f605a3a10b547ba8c5f34fef1de945
Fixes: #4291
Diffstat (limited to 'lib/sqlalchemy/util/langhelpers.py')
-rw-r--r-- | lib/sqlalchemy/util/langhelpers.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index 213f3a0ad..81bfee30a 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -9,8 +9,8 @@ modules, classes, hierarchies, attributes, functions, and methods. """ -import itertools import inspect +import itertools import operator import re import sys @@ -280,7 +280,7 @@ try: except ImportError: def inspect_func_args(fn): - names, _, has_kw, _ = inspect.getargspec(fn) + names, _, has_kw, _ = compat.inspect_getargspec(fn) return names, bool(has_kw) @@ -371,7 +371,7 @@ def format_argspec_plus(fn, grouped=True): else: # we accept an existing argspec... spec = fn - args = inspect.formatargspec(*spec) + args = compat.inspect_formatargspec(*spec) if spec[0]: self_arg = spec[0][0] elif spec[1]: @@ -380,8 +380,8 @@ def format_argspec_plus(fn, grouped=True): self_arg = None if compat.py3k: - apply_pos = inspect.formatargspec(spec[0], spec[1], - spec[2], None, spec[4]) + apply_pos = compat.inspect_formatargspec( + spec[0], spec[1], spec[2], None, spec[4]) num_defaults = 0 if spec[3]: num_defaults += len(spec[3]) @@ -389,7 +389,7 @@ def format_argspec_plus(fn, grouped=True): num_defaults += len(spec[4]) name_args = spec[0] + spec[4] else: - apply_pos = inspect.formatargspec(spec[0], spec[1], spec[2]) + apply_pos = compat.inspect_formatargspec(spec[0], spec[1], spec[2]) num_defaults = 0 if spec[3]: num_defaults += len(spec[3]) @@ -400,9 +400,9 @@ def format_argspec_plus(fn, grouped=True): else: defaulted_vals = () - apply_kw = inspect.formatargspec(name_args, spec[1], spec[2], - defaulted_vals, - formatvalue=lambda x: '=' + x) + apply_kw = compat.inspect_formatargspec( + name_args, spec[1], spec[2], defaulted_vals, + formatvalue=lambda x: '=' + x) if grouped: return dict(args=args, self_arg=self_arg, apply_pos=apply_pos, apply_kw=apply_kw) @@ -646,8 +646,8 @@ def monkeypatch_proxied_specials(into_cls, from_cls, skip=None, only=None, continue try: spec = compat.inspect_getargspec(fn) - fn_args = inspect.formatargspec(spec[0]) - d_args = inspect.formatargspec(spec[0][1:]) + fn_args = compat.inspect_formatargspec(spec[0]) + d_args = compat.inspect_formatargspec(spec[0][1:]) except TypeError: fn_args = '(self, *args, **kw)' d_args = '(*args, **kw)' |