Show More
@@ -40,6 +40,7 b' from IPython.utils.text import indent' | |||||
40 | from IPython.utils.wildcard import list_namespace |
|
40 | from IPython.utils.wildcard import list_namespace | |
41 | from IPython.utils.coloransi import TermColors, ColorScheme, ColorSchemeTable |
|
41 | from IPython.utils.coloransi import TermColors, ColorScheme, ColorSchemeTable | |
42 | from IPython.utils.py3compat import cast_unicode, string_types, PY3 |
|
42 | from IPython.utils.py3compat import cast_unicode, string_types, PY3 | |
|
43 | from IPython.utils.signatures import signature | |||
43 |
|
44 | |||
44 | # builtin docstrings to ignore |
|
45 | # builtin docstrings to ignore | |
45 | _func_call_docstring = types.FunctionType.__call__.__doc__ |
|
46 | _func_call_docstring = types.FunctionType.__call__.__doc__ | |
@@ -390,7 +391,7 b' class Inspector:' | |||||
390 | If any exception is generated, None is returned instead and the |
|
391 | If any exception is generated, None is returned instead and the | |
391 | exception is suppressed.""" |
|
392 | exception is suppressed.""" | |
392 | try: |
|
393 | try: | |
393 |
hdef = oname + |
|
394 | hdef = oname + str(signature(obj)) | |
394 | return cast_unicode(hdef) |
|
395 | return cast_unicode(hdef) | |
395 | except: |
|
396 | except: | |
396 | return None |
|
397 | return None |
@@ -72,10 +72,13 b' def signature(obj):' | |||||
72 | raise TypeError('{0!r} is not a callable object'.format(obj)) |
|
72 | raise TypeError('{0!r} is not a callable object'.format(obj)) | |
73 |
|
73 | |||
74 | if isinstance(obj, types.MethodType): |
|
74 | if isinstance(obj, types.MethodType): | |
75 | # In this case we skip the first parameter of the underlying |
|
75 | if obj.__self__ is None: | |
76 | # function (usually `self` or `cls`). |
|
76 | # Unbound method - treat it as a function (no distinction in Py 3) | |
77 |
|
|
77 | obj = obj.__func__ | |
78 | return sig.replace(parameters=tuple(sig.parameters.values())[1:]) |
|
78 | else: | |
|
79 | # Bound method: trim off the first parameter (typically self or cls) | |||
|
80 | sig = signature(obj.__func__) | |||
|
81 | return sig.replace(parameters=tuple(sig.parameters.values())[1:]) | |||
79 |
|
82 | |||
80 | try: |
|
83 | try: | |
81 | sig = obj.__signature__ |
|
84 | sig = obj.__signature__ |
General Comments 0
You need to be logged in to leave comments.
Login now