Show More
@@ -843,18 +843,11 class IPCompleter(Completer): | |||
|
843 | 843 | ret += self._default_arguments_from_docstring( |
|
844 | 844 | getattr(call_obj, '__doc__', '')) |
|
845 | 845 | |
|
846 | if PY3: | |
|
847 |
|
|
|
848 | inspect.Parameter.POSITIONAL_OR_KEYWORD) | |
|
849 | signature = inspect.signature | |
|
850 | else: | |
|
851 | import IPython.utils.signatures | |
|
852 | _keeps = (IPython.utils.signatures.Parameter.KEYWORD_ONLY, | |
|
853 | IPython.utils.signatures.Parameter.POSITIONAL_OR_KEYWORD) | |
|
854 | signature = IPython.utils.signatures.signature | |
|
846 | _keeps = (inspect.Parameter.KEYWORD_ONLY, | |
|
847 | inspect.Parameter.POSITIONAL_OR_KEYWORD) | |
|
855 | 848 | |
|
856 | 849 | try: |
|
857 | sig = signature(call_obj) | |
|
850 | sig = inspect.signature(call_obj) | |
|
858 | 851 | ret.extend(k for k, v in sig.parameters.items() if |
|
859 | 852 | v.kind in _keeps) |
|
860 | 853 | except ValueError: |
@@ -14,6 +14,7 __all__ = ['Inspector','InspectColors'] | |||
|
14 | 14 | |
|
15 | 15 | # stdlib modules |
|
16 | 16 | import inspect |
|
17 | from inspect import signature | |
|
17 | 18 | import linecache |
|
18 | 19 | import warnings |
|
19 | 20 | import os |
@@ -39,7 +40,6 from IPython.utils.text import indent | |||
|
39 | 40 | from IPython.utils.wildcard import list_namespace |
|
40 | 41 | from IPython.utils.coloransi import TermColors, ColorScheme, ColorSchemeTable |
|
41 | 42 | from IPython.utils.py3compat import cast_unicode, string_types, PY3 |
|
42 | from IPython.utils.signatures import signature | |
|
43 | 43 | from IPython.utils.colorable import Colorable |
|
44 | 44 | |
|
45 | 45 | from pygments import highlight |
@@ -5,6 +5,7 | |||
|
5 | 5 | # Distributed under the terms of the Modified BSD License. |
|
6 | 6 | |
|
7 | 7 | |
|
8 | from inspect import Signature, Parameter | |
|
8 | 9 | import os |
|
9 | 10 | import re |
|
10 | 11 | import sys |
@@ -17,11 +18,11 from IPython.core.magic import (Magics, magics_class, line_magic, | |||
|
17 | 18 | register_line_magic, register_cell_magic, |
|
18 | 19 | register_line_cell_magic) |
|
19 | 20 | from decorator import decorator |
|
21 | from IPython import get_ipython | |
|
20 | 22 | from IPython.testing.decorators import skipif |
|
21 | 23 | from IPython.testing.tools import AssertPrints |
|
22 | 24 | from IPython.utils.path import compress_user |
|
23 | 25 | from IPython.utils import py3compat |
|
24 | from IPython.utils.signatures import Signature, Parameter | |
|
25 | 26 | |
|
26 | 27 | |
|
27 | 28 | #----------------------------------------------------------------------------- |
@@ -39,7 +40,7 ip = get_ipython() | |||
|
39 | 40 | # defined, if any code is inserted above, the following line will need to be |
|
40 | 41 | # updated. Do NOT insert any whitespace between the next line and the function |
|
41 | 42 | # definition below. |
|
42 |
THIS_LINE_NUMBER = 4 |
|
|
43 | THIS_LINE_NUMBER = 43 # Put here the actual number of this line | |
|
43 | 44 | |
|
44 | 45 | from unittest import TestCase |
|
45 | 46 | |
@@ -68,7 +69,7 def test_find_file_decorated1(): | |||
|
68 | 69 | |
|
69 | 70 | @decorator |
|
70 | 71 | def noop1(f): |
|
71 | def wrapper(): | |
|
72 | def wrapper(*a, **kw): | |
|
72 | 73 | return f(*a, **kw) |
|
73 | 74 | return wrapper |
|
74 | 75 |
@@ -1,11 +1,11 | |||
|
1 | """Function signature objects for callables. | |
|
1 | """DEPRECATED: Function signature objects for callables. | |
|
2 | 2 | |
|
3 | 3 | Use the standard library version if available, as it is more up to date. |
|
4 | 4 | Fallback on backport otherwise. |
|
5 | 5 | """ |
|
6 | 6 | |
|
7 | import warnings | |
|
8 | warnings.warn("{} backport for Python 2 is deprecated in IPython 6, which only supports Python 3".format(__name__), | |
|
9 | DeprecationWarning, stacklevel=2) | |
|
7 | 10 | |
|
8 | try: | |
|
9 | from inspect import BoundArguments, Parameter, Signature, signature | |
|
10 | except ImportError: | |
|
11 | from ._signatures import BoundArguments, Parameter, Signature, signature | |
|
11 | from inspect import BoundArguments, Parameter, Signature, signature |
General Comments 0
You need to be logged in to leave comments.
Login now