1 # -*- coding: utf-8 -*- |
1 # -*- coding: utf-8 -*- |
2 |
2 |
3 """ |
3 """ |
4 Word completion for the eric5 shell |
4 Word completion for the eric5 shell. |
5 |
5 |
6 <h4>NOTE for eric5 variant</h4> |
6 <h4>NOTE for eric5 variant</h4> |
7 |
7 |
8 This version is a re-implementation of FlexCompleter |
8 This version is a re-implementation of FlexCompleter |
9 as found in the PyQwt package. It is modified to work with the eric5 debug |
9 as found in the PyQwt package. It is modified to work with the eric5 debug |
121 Completer instances should be used as the completion mechanism of |
121 Completer instances should be used as the completion mechanism of |
122 readline via the set_completer() call: |
122 readline via the set_completer() call: |
123 |
123 |
124 readline.set_completer(Completer(my_namespace).complete) |
124 readline.set_completer(Completer(my_namespace).complete) |
125 |
125 |
126 @param namespace The namespace for the completer. |
126 @param namespace namespace for the completer |
127 """ |
127 @exception TypeError raised to indicate a wrong namespace structure |
128 |
128 """ |
129 if namespace and type(namespace) != type({}): |
129 if namespace and type(namespace) != type({}): |
130 raise TypeError('namespace must be a dictionary') |
130 raise TypeError('namespace must be a dictionary') |
131 |
131 |
132 # Don't bind to namespace quite yet, but flag whether the user wants a |
132 # Don't bind to namespace quite yet, but flag whether the user wants a |
133 # specific namespace or to use __main__.__dict__. This will allow us |
133 # specific namespace or to use __main__.__dict__. This will allow us |