From 6a548b8d3effcb2754414444159f1757b2715d6d Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Fri, 24 Jul 2015 20:27:15 -0600 Subject: MAINT: Use numpy versions of getargspec, formatargspec. Both of these functions will be removed in Python 3.6 and were deprecated in 3.5. The numpy versions are not full versions, but hopefully suffice. --- numpy/lib/utils.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'numpy/lib') diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 1c95099c9..3f29699e9 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -9,6 +9,9 @@ import warnings from numpy.core.numerictypes import issubclass_, issubsctype, issubdtype from numpy.core import ndarray, ufunc, asarray +# getargspec and formatargspec were removed in Python 3.6 +from numpy.compat import getargspec, formatargspec + __all__ = [ 'issubclass_', 'issubsctype', 'issubdtype', 'deprecate', 'deprecate_with_doc', 'get_include', 'info', 'source', 'who', @@ -531,7 +534,7 @@ def info(object=None, maxwidth=76, output=sys.stdout, toplevel='numpy'): elif inspect.isfunction(object): name = object.__name__ - arguments = inspect.formatargspec(*inspect.getargspec(object)) + arguments = formatargspec(*getargspec(object)) if len(name+arguments) > maxwidth: argstr = _split_line(name, arguments, maxwidth) @@ -546,8 +549,8 @@ def info(object=None, maxwidth=76, output=sys.stdout, toplevel='numpy'): arguments = "()" try: if hasattr(object, '__init__'): - arguments = inspect.formatargspec( - *inspect.getargspec(object.__init__.__func__) + arguments = formatargspec( + *getargspec(object.__init__.__func__) ) arglist = arguments.split(', ') if len(arglist) > 1: @@ -589,8 +592,8 @@ def info(object=None, maxwidth=76, output=sys.stdout, toplevel='numpy'): print("Instance of class: ", object.__class__.__name__, file=output) print(file=output) if hasattr(object, '__call__'): - arguments = inspect.formatargspec( - *inspect.getargspec(object.__call__.__func__) + arguments = formatargspec( + *getargspec(object.__call__.__func__) ) arglist = arguments.split(', ') if len(arglist) > 1: @@ -619,8 +622,8 @@ def info(object=None, maxwidth=76, output=sys.stdout, toplevel='numpy'): elif inspect.ismethod(object): name = object.__name__ - arguments = inspect.formatargspec( - *inspect.getargspec(object.__func__) + arguments = formatargspec( + *getargspec(object.__func__) ) arglist = arguments.split(', ') if len(arglist) > 1: -- cgit v1.2.1