Methods
|
|
__init__
attr_matches
complete
global_matches
|
|
__init__
|
__init__ ( self, namespace=None )
Create a new completer for the command line.
Completer([namespace]) -> completer instance.
If unspecified, the default namespace where completions are performed
is __main__ (technically, __main__.__dict__). Namespaces should be
given as dictionaries.
Completer instances should be used as the completion mechanism of
readline via the set_completer() call:
readline.set_completer(Completer(my_namespace).complete)
Exceptions
|
|
TypeError, 'namespace must be a dictionary'
|
|
|
attr_matches
|
attr_matches ( self, text )
Compute matches when text contains a dot.
Assuming the text is of the form NAME.NAME....[NAME], and is
evaluatable in self.namespace, it will be evaluated and its attributes
(as revealed by dir()) are used as possible completions. (For class
instances, class members are are also considered.)
WARNING: this can still invoke arbitrary C code, if an object
with a __getattr__ hook is evaluated.
|
|
complete
|
complete (
self,
text,
state,
)
Return the next possible completion for text .
This is called successively with state == 0, 1, 2, ... until it
returns None. The completion should begin with text .
|
|
global_matches
|
global_matches ( self, text )
Compute matches when text is a simple name.
Return a list of all keywords, built-in functions and names currently
defined in self.namespace that match.
|
|