##// END OF EJS Templates
Merge pull request #13518 from Carreau/maint-deprecate-append-to-sys...
Matthias Bussonnier -
r27513:e54372ee merge
parent child Browse files
Show More
@@ -0,0 +1,7 b''
1 from IPython.utils.syspathcontext import appended_to_syspath
2 import pytest
3
4
5 def test_append_deprecated():
6 with pytest.warns(DeprecationWarning):
7 appended_to_syspath(".")
@@ -2222,12 +2222,22 b' class IPCompleter(Completer):'
2222 # initialized, and it takes a user-noticeable amount of time to
2222 # initialized, and it takes a user-noticeable amount of time to
2223 # initialize it, so we don't want to initialize it unless we're
2223 # initialize it, so we don't want to initialize it unless we're
2224 # actually going to use it.
2224 # actually going to use it.
2225 s = text[slashpos+1:]
2225 s = text[slashpos + 1 :]
2226 candidates = [x for x in self.unicode_names if x.startswith(s)]
2226 sup = s.upper()
2227 candidates = [x for x in self.unicode_names if x.startswith(sup)]
2227 if candidates:
2228 if candidates:
2228 return s, candidates
2229 return s, candidates
2229 else:
2230 candidates = [x for x in self.unicode_names if sup in x]
2230 return '', ()
2231 if candidates:
2232 return s, candidates
2233 splitsup = sup.split(" ")
2234 candidates = [
2235 x for x in self.unicode_names if all(u in x for u in splitsup)
2236 ]
2237 if candidates:
2238 return s, candidates
2239
2240 return "", ()
2231
2241
2232 # if text does not start with slash
2242 # if text does not start with slash
2233 else:
2243 else:
@@ -15,12 +15,21 b' Authors:'
15 #-----------------------------------------------------------------------------
15 #-----------------------------------------------------------------------------
16
16
17 import sys
17 import sys
18 import warnings
18
19
19
20
20 class appended_to_syspath(object):
21 class appended_to_syspath(object):
21 """A context for appending a directory to sys.path for a second."""
22 """
23 Deprecated since IPython 8.1, no replacements.
24
25 A context for appending a directory to sys.path for a second."""
22
26
23 def __init__(self, dir):
27 def __init__(self, dir):
28 warnings.warn(
29 "`appended_to_syspath` is deprecated since IPython 8.1, and has no replacements",
30 DeprecationWarning,
31 stacklevel=2,
32 )
24 self.dir = dir
33 self.dir = dir
25
34
26 def __enter__(self):
35 def __enter__(self):
@@ -14,7 +14,10 b' It is a bit ridiculous that we need these.'
14
14
15 from warnings import warn
15 from warnings import warn
16
16
17 warn("The `IPython.utils.version` module has been deprecated since IPython 8.0.")
17 warn(
18 "The `IPython.utils.version` module has been deprecated since IPython 8.0.",
19 DeprecationWarning,
20 )
18
21
19
22
20 def check_version(v, check):
23 def check_version(v, check):
General Comments 0
You need to be logged in to leave comments. Login now