From 72dbec578dcdec67f644648116839be0bc8d9d4a Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Tue, 13 Mar 2018 19:01:13 +0000 Subject: [PATCH] Add moves for getargspec and getfullargspec --- documentation/index.rst | 2 ++ six.py | 1 + test_six.py | 10 ++++++++++ 3 files changed, 13 insertions(+) diff --git a/documentation/index.rst b/documentation/index.rst index d2d9d79a2..5efdabe73 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -599,6 +599,8 @@ Supported renames: +------------------------------+-------------------------------------+---------------------------------------+ | ``filterfalse`` | :func:`py2:itertools.ifilterfalse` | :func:`py3:itertools.filterfalse` | +------------------------------+-------------------------------------+---------------------------------------+ +| ``getargspec`` | :func:`py2:inspect.getargspec` | :func:`py3:inspect.getfullargspec` | ++------------------------------+-------------------------------------+---------------------------------------+ | ``getcwd`` | :func:`py2:os.getcwdu` | :func:`py3:os.getcwd` | +------------------------------+-------------------------------------+---------------------------------------+ | ``getcwdb`` | :func:`py2:os.getcwd` | :func:`py3:os.getcwdb` | diff --git a/six.py b/six.py index 8d9ac41a8..654a99aec 100644 --- a/six.py +++ b/six.py @@ -239,6 +239,7 @@ class _MovedItems(_LazyModule): MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"), MovedAttribute("intern", "__builtin__", "sys"), MovedAttribute("map", "itertools", "builtins", "imap", "map"), + MovedAttribute("getargspec", "inspect", "inspect", "getargspec", "getfullargspec"), MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"), MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"), MovedAttribute("getoutput", "commands", "subprocess"), diff --git a/test_six.py b/test_six.py index 980cdf3aa..c204a6ec9 100644 --- a/test_six.py +++ b/test_six.py @@ -232,6 +232,16 @@ def test_map(): assert six.advance_iterator(map(lambda x: x + 1, range(2))) == 1 +def test_getargspec(): + from six.moves import getargspec + + def test(a, b='c', *args, **kwargs): + pass + + argspec = getargspec(test) + assert argspec == (['a', 'b'], 'args', 'kwargs', ('c',)) + + def test_getoutput(): from six.moves import getoutput output = getoutput('echo "foo"')