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