From 9d99176e235883f70e0a29c3f76cce746e193c22 2013-09-19 17:57:05 From: Thomas Kluyver Date: 2013-09-19 17:57:05 Subject: [PATCH] Remove alias machinery from IPCompleter --- diff --git a/IPython/core/completer.py b/IPython/core/completer.py index 642bdae..ee07b26 100644 --- a/IPython/core/completer.py +++ b/IPython/core/completer.py @@ -431,8 +431,7 @@ class IPCompleter(Completer): ) def __init__(self, shell=None, namespace=None, global_namespace=None, - alias_table=None, use_readline=True, - config=None, **kwargs): + use_readline=True, config=None, **kwargs): """IPCompleter() -> completer Return a completer object suitable for use by the readline library @@ -450,9 +449,6 @@ class IPCompleter(Completer): handle cases (such as IPython embedded inside functions) where both Python scopes are visible. - - If alias_table is supplied, it should be a dictionary of aliases - to complete. - use_readline : bool, optional If true, use the readline library. This completer can still function without readline, though in that case callers must provide some extra @@ -476,9 +472,6 @@ class IPCompleter(Completer): # List where completion matches will be stored self.matches = [] self.shell = shell - if alias_table is None: - alias_table = {} - self.alias_table = alias_table # Regexp to split filenames with spaces in them self.space_name_re = re.compile(r'([^\\] )') # Hold a local ref. to glob.glob for speed @@ -505,7 +498,6 @@ class IPCompleter(Completer): self.matchers = [self.python_matches, self.file_matches, self.magic_matches, - self.alias_matches, self.python_func_kw_matches, ] @@ -628,22 +620,6 @@ class IPCompleter(Completer): comp += [ pre+m for m in line_magics if m.startswith(bare_text)] return comp - def alias_matches(self, text): - """Match internal system aliases""" - #print 'Completer->alias_matches:',text,'lb',self.text_until_cursor # dbg - - # if we are not in the first 'item', alias matching - # doesn't make sense - unless we are starting with 'sudo' command. - main_text = self.text_until_cursor.lstrip() - if ' ' in main_text and not main_text.startswith('sudo'): - return [] - text = os.path.expanduser(text) - aliases = self.alias_table.keys() - if text == '': - return aliases - else: - return [a for a in aliases if a.startswith(text)] - def python_matches(self,text): """Match attributes or global python names""" diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index ffbbd7e..75f064d 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -1936,7 +1936,6 @@ class InteractiveShell(SingletonConfigurable): self.Completer = IPCompleter(shell=self, namespace=self.user_ns, global_namespace=self.user_global_ns, - #alias_table=self.alias_manager.alias_table, use_readline=self.has_readline, parent=self, )