Skip to content

Commit

Permalink
Cleanup deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Jan 20, 2017
1 parent 49a35b4 commit 291d339
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions IPython/core/completer.py
Expand Up @@ -59,6 +59,9 @@
PROTECTABLES = ' ()[]{}?=\\|;:\'#*"^&'


_deprecation_readline_sentinel = onject()


def has_open_quotes(s):
"""Return whether a string has open quotes.
Expand Down Expand Up @@ -260,7 +263,7 @@ def split_line(self, line, cursor_pos=None):
return self._delim_re.split(l)[-1]

class ProvisionalCompleterWarning(FutureWarning):pass
# warnings.filterwarnings('error', category=ProvisionalCompleterWarning)
warnings.filterwarnings('error', category=ProvisionalCompleterWarning)


from contextlib import contextmanager
Expand All @@ -284,9 +287,8 @@ class Completer(Configurable):
).tag(config=True)

use_jedi = Bool(default_value=JEDI_INSTALLED, config=True,
help="""Experimental: Use Jedi to generate autocompletions. "
"Default to True if jedi is installed
""")
help="Experimental: Use Jedi to generate autocompletions. "
"Default to True if jedi is installed")


def __init__(self, namespace=None, global_namespace=None, **kwargs):
Expand All @@ -301,11 +303,6 @@ def __init__(self, namespace=None, global_namespace=None, **kwargs):
An optional second namespace can be given. This allows the completer
to handle cases where both the local and global scopes need to be
distinguished.
Completer instances should be used as the completion mechanism of
readline via the set_completer() call:
readline.set_completer(Completer(my_namespace).complete)
"""

# Don't bind to namespace quite yet, but flag whether the user wants a
Expand Down Expand Up @@ -597,12 +594,10 @@ def _greedy_changed(self, change):
).tag(config=True)

def __init__(self, shell=None, namespace=None, global_namespace=None,
use_readline=False, config=None, **kwargs):
use_readline=_deprecation_readline_sentinel, config=None, **kwargs):
"""IPCompleter() -> completer
Return a completer object suitable for use by the readline library
via readline.set_completer().
Return a completer object.
Inputs:
- shell: a pointer to the ipython shell itself. This is needed
Expand All @@ -616,14 +611,14 @@ def __init__(self, shell=None, namespace=None, global_namespace=None,
both Python scopes are visible.
use_readline : bool, optional
DEPRECATED, ignored.
DEPRECATED, ignored since IPython 6.0
"""

self.magic_escape = ESC_MAGIC
self.splitter = CompletionSplitter()

if use_readline:
warnings.warn('The use_readline parameter is deprecated and ignored since IPython 6.0.',
if use_readline is not _deprecation_readline_sentinel:
warnings.warn('The `use_readline` parameter is deprecated and ignored since IPython 6.0.',
DeprecationWarning, stacklevel=2)

# _greedy_changed() depends on splitter and readline being defined:
Expand Down Expand Up @@ -1322,7 +1317,7 @@ def complete(self, text=None, line_buffer=None, cursor_pos=None):
return self._complete(line_buffer=line_buffer, cursor_pos=cursor_pos, text=text)[:2]

def _complete(self, *, line_buffer, cursor_pos, text=None,
cursor_line=None, full_text=None, return_jedi_results=True ) -> (str, List(str), List[object]):
cursor_line=None, full_text=None, return_jedi_results=True ) -> (str, List[str], List[object]):
"""
Like complete but can also returns raw jedi completions.
Expand Down

0 comments on commit 291d339

Please sign in to comment.