Show More
@@ -431,8 +431,7 b' class IPCompleter(Completer):' | |||||
431 | ) |
|
431 | ) | |
432 |
|
432 | |||
433 | def __init__(self, shell=None, namespace=None, global_namespace=None, |
|
433 | def __init__(self, shell=None, namespace=None, global_namespace=None, | |
434 |
|
|
434 | use_readline=True, config=None, **kwargs): | |
435 | config=None, **kwargs): |
|
|||
436 | """IPCompleter() -> completer |
|
435 | """IPCompleter() -> completer | |
437 |
|
436 | |||
438 | Return a completer object suitable for use by the readline library |
|
437 | Return a completer object suitable for use by the readline library | |
@@ -450,9 +449,6 b' class IPCompleter(Completer):' | |||||
450 | handle cases (such as IPython embedded inside functions) where |
|
449 | handle cases (such as IPython embedded inside functions) where | |
451 | both Python scopes are visible. |
|
450 | both Python scopes are visible. | |
452 |
|
451 | |||
453 | - If alias_table is supplied, it should be a dictionary of aliases |
|
|||
454 | to complete. |
|
|||
455 |
|
||||
456 | use_readline : bool, optional |
|
452 | use_readline : bool, optional | |
457 | If true, use the readline library. This completer can still function |
|
453 | If true, use the readline library. This completer can still function | |
458 | without readline, though in that case callers must provide some extra |
|
454 | without readline, though in that case callers must provide some extra | |
@@ -476,9 +472,6 b' class IPCompleter(Completer):' | |||||
476 | # List where completion matches will be stored |
|
472 | # List where completion matches will be stored | |
477 | self.matches = [] |
|
473 | self.matches = [] | |
478 | self.shell = shell |
|
474 | self.shell = shell | |
479 | if alias_table is None: |
|
|||
480 | alias_table = {} |
|
|||
481 | self.alias_table = alias_table |
|
|||
482 | # Regexp to split filenames with spaces in them |
|
475 | # Regexp to split filenames with spaces in them | |
483 | self.space_name_re = re.compile(r'([^\\] )') |
|
476 | self.space_name_re = re.compile(r'([^\\] )') | |
484 | # Hold a local ref. to glob.glob for speed |
|
477 | # Hold a local ref. to glob.glob for speed | |
@@ -505,7 +498,6 b' class IPCompleter(Completer):' | |||||
505 | self.matchers = [self.python_matches, |
|
498 | self.matchers = [self.python_matches, | |
506 | self.file_matches, |
|
499 | self.file_matches, | |
507 | self.magic_matches, |
|
500 | self.magic_matches, | |
508 | self.alias_matches, |
|
|||
509 | self.python_func_kw_matches, |
|
501 | self.python_func_kw_matches, | |
510 | ] |
|
502 | ] | |
511 |
|
503 | |||
@@ -628,22 +620,6 b' class IPCompleter(Completer):' | |||||
628 | comp += [ pre+m for m in line_magics if m.startswith(bare_text)] |
|
620 | comp += [ pre+m for m in line_magics if m.startswith(bare_text)] | |
629 | return comp |
|
621 | return comp | |
630 |
|
622 | |||
631 | def alias_matches(self, text): |
|
|||
632 | """Match internal system aliases""" |
|
|||
633 | #print 'Completer->alias_matches:',text,'lb',self.text_until_cursor # dbg |
|
|||
634 |
|
||||
635 | # if we are not in the first 'item', alias matching |
|
|||
636 | # doesn't make sense - unless we are starting with 'sudo' command. |
|
|||
637 | main_text = self.text_until_cursor.lstrip() |
|
|||
638 | if ' ' in main_text and not main_text.startswith('sudo'): |
|
|||
639 | return [] |
|
|||
640 | text = os.path.expanduser(text) |
|
|||
641 | aliases = self.alias_table.keys() |
|
|||
642 | if text == '': |
|
|||
643 | return aliases |
|
|||
644 | else: |
|
|||
645 | return [a for a in aliases if a.startswith(text)] |
|
|||
646 |
|
||||
647 | def python_matches(self,text): |
|
623 | def python_matches(self,text): | |
648 | """Match attributes or global python names""" |
|
624 | """Match attributes or global python names""" | |
649 |
|
625 |
@@ -1936,7 +1936,6 b' class InteractiveShell(SingletonConfigurable):' | |||||
1936 | self.Completer = IPCompleter(shell=self, |
|
1936 | self.Completer = IPCompleter(shell=self, | |
1937 | namespace=self.user_ns, |
|
1937 | namespace=self.user_ns, | |
1938 | global_namespace=self.user_global_ns, |
|
1938 | global_namespace=self.user_global_ns, | |
1939 | #alias_table=self.alias_manager.alias_table, |
|
|||
1940 | use_readline=self.has_readline, |
|
1939 | use_readline=self.has_readline, | |
1941 | parent=self, |
|
1940 | parent=self, | |
1942 | ) |
|
1941 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now