summaryrefslogtreecommitdiff
path: root/numpy/lib/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r--numpy/lib/utils.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py
index 519d0e9b9..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:
@@ -976,7 +979,7 @@ def _getmembers(item):
import inspect
try:
members = inspect.getmembers(item)
- except AttributeError:
+ except Exception:
members = [(x, getattr(item, x)) for x in dir(item)
if hasattr(item, x)]
return members
@@ -1011,6 +1014,7 @@ class SafeEval(object):
"""
def __init__(self):
+ # 2014-10-15, 1.10
warnings.warn("SafeEval is deprecated in 1.10 and will be removed.",
DeprecationWarning)