Commits

Joe Amenta committed 9f7b4c5

Fixing getfullargspec -> getargspec
getfullargspec will probably refer to the name in the inspect module.

Comments (0)

Files changed (2)

lib3to2/fixes/fix_fullargspec.py

+"""
+Fixer for getfullargspec -> getargspec
+"""
+
+from lib2to3 import fixer_base
+from ..fixer_util import Name
+
+warn_msg = "some of the values returned by getfullargspec are not valid in Python 2 and have no equivalent."
+
+class FixFullargspec(fixer_base.BaseFix):
+    
+    PATTERN = "'getfullargspec'"
+
+    def transform(self, node, results):
+        self.warning(node, warn_msg)
+        return Name("getargspec", prefix=node.prefix)

lib3to2/tests/test_fullargspec.py

+from test_all_fixers import lib3to2FixerTestCase
+
+class Test_fullargspec(lib3to2FixerTestCase):
+
+    fixer = "fullargspec"
+
+    def test_import(self):
+        b = "from inspect import blah, blah, getfullargspec, blah, blah"
+        a = "from inspect import blah, blah, getargspec, blah, blah"
+        self.warns(b, a, "some of the values returned by getfullargspec are not valid in Python 2 and have no equivalent.")
+
+    def test_usage(self):
+        b = "argspec = inspect.getfullargspec(func)"
+        a = "argspec = inspect.getargspec(func)"
+        self.warns(b, a, "some of the values returned by getfullargspec are not valid in Python 2 and have no equivalent.")