Show More
@@ -6,7 +6,7 b' Requires Python 2.1 or newer.' | |||
|
6 | 6 | |
|
7 | 7 | This file contains all the classes and helper functions specific to IPython. |
|
8 | 8 | |
|
9 |
$Id: iplib.py 7 |
|
|
9 | $Id: iplib.py 774 2005-09-01 00:27:53Z fperez $ | |
|
10 | 10 | """ |
|
11 | 11 | |
|
12 | 12 | #***************************************************************************** |
@@ -888,6 +888,40 b' class InteractiveShell(code.InteractiveConsole, Logger, Magic):' | |||
|
888 | 888 | self.Completer.__class__) |
|
889 | 889 | self.Completer.matchers.insert(pos,newcomp) |
|
890 | 890 | |
|
891 | def complete(self,text): | |
|
892 | """Return a sorted list of all possible completions on text. | |
|
893 | ||
|
894 | Inputs: | |
|
895 | ||
|
896 | - text: a string of text to be completed on. | |
|
897 | ||
|
898 | This is a wrapper around the completion mechanism, similar to what | |
|
899 | readline does at the command line when the TAB key is hit. By | |
|
900 | exposing it as a method, it can be used by other non-readline | |
|
901 | environments (such as GUIs) for text completion. | |
|
902 | ||
|
903 | Simple usage example: | |
|
904 | ||
|
905 | In [1]: x = 'hello' | |
|
906 | ||
|
907 | In [2]: __IP.complete('x.l') | |
|
908 | Out[2]: ['x.ljust', 'x.lower', 'x.lstrip']""" | |
|
909 | ||
|
910 | complete = self.Completer.complete | |
|
911 | state = 0 | |
|
912 | # use a dict so we get unique keys, since ipyhton's multiple | |
|
913 | # completers can return duplicates. | |
|
914 | comps = {} | |
|
915 | while True: | |
|
916 | newcomp = complete(text,state) | |
|
917 | if newcomp is None: | |
|
918 | break | |
|
919 | comps[newcomp] = 1 | |
|
920 | state += 1 | |
|
921 | outcomps = comps.keys() | |
|
922 | outcomps.sort() | |
|
923 | return outcomps | |
|
924 | ||
|
891 | 925 | def post_config_initialization(self): |
|
892 | 926 | """Post configuration init method |
|
893 | 927 |
@@ -1,3 +1,9 b'' | |||
|
1 | 2005-08-31 Fernando Perez <Fernando.Perez@colorado.edu> | |
|
2 | ||
|
3 | * IPython/iplib.py (InteractiveShell.complete): Added new | |
|
4 | top-level completion method to expose the completion mechanism | |
|
5 | beyond readline-based environments. | |
|
6 | ||
|
1 | 7 | 2005-08-19 Fernando Perez <Fernando.Perez@colorado.edu> |
|
2 | 8 | |
|
3 | 9 | * tools/ipsvnc (svnversion): fix svnversion capture. |
General Comments 0
You need to be logged in to leave comments.
Login now