Show More
@@ -178,14 +178,6 b' else:' | |||||
178 | MATCHES_LIMIT = 500 |
|
178 | MATCHES_LIMIT = 500 | |
179 |
|
179 | |||
180 |
|
180 | |||
181 | class Sentinel: |
|
|||
182 | def __repr__(self): |
|
|||
183 | return "<deprecated sentinel>" |
|
|||
184 |
|
||||
185 |
|
||||
186 | _deprecation_readline_sentinel = Sentinel() |
|
|||
187 |
|
||||
188 |
|
||||
189 | class ProvisionalCompleterWarning(FutureWarning): |
|
181 | class ProvisionalCompleterWarning(FutureWarning): | |
190 | """ |
|
182 | """ | |
191 | Exception raise by an experimental feature in this module. |
|
183 | Exception raise by an experimental feature in this module. | |
@@ -618,8 +610,6 b' class Completer(Configurable):' | |||||
618 | "Includes completion of latex commands, unicode names, and expanding " |
|
610 | "Includes completion of latex commands, unicode names, and expanding " | |
619 | "unicode characters back to latex commands.").tag(config=True) |
|
611 | "unicode characters back to latex commands.").tag(config=True) | |
620 |
|
612 | |||
621 |
|
||||
622 |
|
||||
623 | def __init__(self, namespace=None, global_namespace=None, **kwargs): |
|
613 | def __init__(self, namespace=None, global_namespace=None, **kwargs): | |
624 | """Create a new completer for the command line. |
|
614 | """Create a new completer for the command line. | |
625 |
|
615 | |||
@@ -1119,8 +1109,9 b' class IPCompleter(Completer):' | |||||
1119 | 'no effects and then removed in future version of IPython.', |
|
1109 | 'no effects and then removed in future version of IPython.', | |
1120 | UserWarning) |
|
1110 | UserWarning) | |
1121 |
|
1111 | |||
1122 | def __init__(self, shell=None, namespace=None, global_namespace=None, |
|
1112 | def __init__( | |
1123 | use_readline=_deprecation_readline_sentinel, config=None, **kwargs): |
|
1113 | self, shell=None, namespace=None, global_namespace=None, config=None, **kwargs | |
|
1114 | ): | |||
1124 | """IPCompleter() -> completer |
|
1115 | """IPCompleter() -> completer | |
1125 |
|
1116 | |||
1126 | Return a completer object. |
|
1117 | Return a completer object. | |
@@ -1144,10 +1135,6 b' class IPCompleter(Completer):' | |||||
1144 | self.magic_escape = ESC_MAGIC |
|
1135 | self.magic_escape = ESC_MAGIC | |
1145 | self.splitter = CompletionSplitter() |
|
1136 | self.splitter = CompletionSplitter() | |
1146 |
|
1137 | |||
1147 | if use_readline is not _deprecation_readline_sentinel: |
|
|||
1148 | warnings.warn('The `use_readline` parameter is deprecated and ignored since IPython 6.0.', |
|
|||
1149 | DeprecationWarning, stacklevel=2) |
|
|||
1150 |
|
||||
1151 | # _greedy_changed() depends on splitter and readline being defined: |
|
1138 | # _greedy_changed() depends on splitter and readline being defined: | |
1152 | Completer.__init__(self, namespace=namespace, global_namespace=global_namespace, |
|
1139 | Completer.__init__(self, namespace=namespace, global_namespace=global_namespace, | |
1153 | config=config, **kwargs) |
|
1140 | config=config, **kwargs) |
@@ -133,7 +133,7 b' def doctest_tb_sysexit():' | |||||
133 | In [20]: %tb |
|
133 | In [20]: %tb | |
134 | Traceback (most recent call last): |
|
134 | Traceback (most recent call last): | |
135 | File ..., in execfile |
|
135 | File ..., in execfile | |
136 |
exec(compiler(f.read(), fname, |
|
136 | exec(compiler(f.read(), fname, "exec"), glob, loc) | |
137 | File ..., in <module> |
|
137 | File ..., in <module> | |
138 | bar(mode) |
|
138 | bar(mode) | |
139 | File ..., in bar |
|
139 | File ..., in bar | |
@@ -149,9 +149,9 b' def doctest_tb_sysexit():' | |||||
149 | --------------------------------------------------------------------------- |
|
149 | --------------------------------------------------------------------------- | |
150 | SystemExit Traceback (most recent call last) |
|
150 | SystemExit Traceback (most recent call last) | |
151 | File ..., in execfile(fname, glob, loc, compiler) |
|
151 | File ..., in execfile(fname, glob, loc, compiler) | |
152 |
|
|
152 | ... with open(fname, "rb") as f: | |
153 |
|
|
153 | ... compiler = compiler or compile | |
154 |
---> |
|
154 | ---> ... exec(compiler(f.read(), fname, "exec"), glob, loc) | |
155 | ...<module> |
|
155 | ...<module> | |
156 | 30 except IndexError: |
|
156 | 30 except IndexError: | |
157 | 31 mode = 'div' |
|
157 | 31 mode = 'div' |
@@ -19,7 +19,6 b' import System' | |||||
19 | import os |
|
19 | import os | |
20 |
|
20 | |||
21 | # Import IPython libraries: |
|
21 | # Import IPython libraries: | |
22 | from IPython.utils import py3compat |
|
|||
23 | from ._process_common import arg_split |
|
22 | from ._process_common import arg_split | |
24 |
|
23 | |||
25 |
|
24 |
@@ -24,7 +24,6 b' import pexpect' | |||||
24 |
|
24 | |||
25 | # Our own |
|
25 | # Our own | |
26 | from ._process_common import getoutput, arg_split |
|
26 | from ._process_common import getoutput, arg_split | |
27 | from IPython.utils import py3compat |
|
|||
28 | from IPython.utils.encoding import DEFAULT_ENCODING |
|
27 | from IPython.utils.encoding import DEFAULT_ENCODING | |
29 |
|
28 | |||
30 | #----------------------------------------------------------------------------- |
|
29 | #----------------------------------------------------------------------------- |
@@ -3,13 +3,8 b'' | |||||
3 |
|
3 | |||
4 | This file is deprecated and will be removed in a future version. |
|
4 | This file is deprecated and will be removed in a future version. | |
5 | """ |
|
5 | """ | |
6 | import functools |
|
|||
7 | import os |
|
|||
8 | import sys |
|
|||
9 | import re |
|
|||
10 | import shutil |
|
|||
11 | import types |
|
|||
12 | import platform |
|
6 | import platform | |
|
7 | import builtins as builtin_mod | |||
13 |
|
8 | |||
14 | from .encoding import DEFAULT_ENCODING |
|
9 | from .encoding import DEFAULT_ENCODING | |
15 |
|
10 | |||
@@ -18,6 +13,7 b' def decode(s, encoding=None):' | |||||
18 | encoding = encoding or DEFAULT_ENCODING |
|
13 | encoding = encoding or DEFAULT_ENCODING | |
19 | return s.decode(encoding, "replace") |
|
14 | return s.decode(encoding, "replace") | |
20 |
|
15 | |||
|
16 | ||||
21 | def encode(u, encoding=None): |
|
17 | def encode(u, encoding=None): | |
22 | encoding = encoding or DEFAULT_ENCODING |
|
18 | encoding = encoding or DEFAULT_ENCODING | |
23 | return u.encode(encoding, "replace") |
|
19 | return u.encode(encoding, "replace") | |
@@ -28,16 +24,6 b' def cast_unicode(s, encoding=None):' | |||||
28 | return decode(s, encoding) |
|
24 | return decode(s, encoding) | |
29 | return s |
|
25 | return s | |
30 |
|
26 | |||
31 | def cast_bytes(s, encoding=None): |
|
|||
32 | if not isinstance(s, bytes): |
|
|||
33 | return encode(s, encoding) |
|
|||
34 | return s |
|
|||
35 |
|
||||
36 | def buffer_to_bytes(buf): |
|
|||
37 | """Cast a buffer object to bytes""" |
|
|||
38 | if not isinstance(buf, bytes): |
|
|||
39 | buf = bytes(buf) |
|
|||
40 | return buf |
|
|||
41 |
|
27 | |||
42 | def safe_unicode(e): |
|
28 | def safe_unicode(e): | |
43 | """unicode(e) with various fallbacks. Used for exceptions, which may not be |
|
29 | """unicode(e) with various fallbacks. Used for exceptions, which may not be | |
@@ -53,23 +39,21 b' def safe_unicode(e):' | |||||
53 | except UnicodeError: |
|
39 | except UnicodeError: | |
54 | pass |
|
40 | pass | |
55 |
|
41 | |||
56 |
return |
|
42 | return "Unrecoverably corrupt evalue" | |
|
43 | ||||
57 |
|
44 | |||
58 | # keep reference to builtin_mod because the kernel overrides that value |
|
45 | # keep reference to builtin_mod because the kernel overrides that value | |
59 | # to forward requests to a frontend. |
|
46 | # to forward requests to a frontend. | |
60 |
def input(prompt= |
|
47 | def input(prompt=""): | |
61 | return builtin_mod.input(prompt) |
|
48 | return builtin_mod.input(prompt) | |
62 |
|
49 | |||
63 | builtin_mod_name = "builtins" |
|
|||
64 | import builtins as builtin_mod |
|
|||
65 |
|
||||
66 | MethodType = types.MethodType |
|
|||
67 |
|
50 | |||
68 | def execfile(fname, glob, loc=None, compiler=None): |
|
51 | def execfile(fname, glob, loc=None, compiler=None): | |
69 | loc = loc if (loc is not None) else glob |
|
52 | loc = loc if (loc is not None) else glob | |
70 |
with open(fname, |
|
53 | with open(fname, "rb") as f: | |
71 | compiler = compiler or compile |
|
54 | compiler = compiler or compile | |
72 |
exec(compiler(f.read(), fname, |
|
55 | exec(compiler(f.read(), fname, "exec"), glob, loc) | |
|
56 | ||||
73 |
|
57 | |||
74 | PYPY = platform.python_implementation() == "PyPy" |
|
58 | PYPY = platform.python_implementation() == "PyPy" | |
75 |
|
59 | |||
@@ -77,6 +61,7 b' PYPY = platform.python_implementation() == "PyPy"' | |||||
77 | # See https://github.com/cython/cython/pull/3291 and |
|
61 | # See https://github.com/cython/cython/pull/3291 and | |
78 | # https://github.com/ipython/ipython/issues/12068 |
|
62 | # https://github.com/ipython/ipython/issues/12068 | |
79 | def no_code(x, encoding=None): |
|
63 | def no_code(x, encoding=None): | |
80 |
|
|
64 | return x | |
81 | unicode_to_str = cast_bytes_py2 = no_code |
|
|||
82 |
|
65 | |||
|
66 | ||||
|
67 | unicode_to_str = cast_bytes_py2 = no_code |
General Comments 0
You need to be logged in to leave comments.
Login now