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 rlcompleter |
8 This version is a re-implementation of rlcompleter |
9 as found in the Python3 library. It is modified to work with the eric5 |
9 as found in the Python3 library. It is modified to work with the eric5 |
72 readline via the set_completer() call: |
72 readline via the set_completer() call: |
73 |
73 |
74 readline.set_completer(Completer(my_namespace).complete) |
74 readline.set_completer(Completer(my_namespace).complete) |
75 |
75 |
76 @param namespace The namespace for the completer. |
76 @param namespace The namespace for the completer. |
77 """ |
77 @exception TypeError raised to indicate a wrong data structure of |
78 |
78 the namespace object |
|
79 """ |
79 if namespace and type(namespace) != type({}): |
80 if namespace and type(namespace) != type({}): |
80 raise TypeError('namespace must be a dictionary') |
81 raise TypeError('namespace must be a dictionary') |
81 |
82 |
82 # Don't bind to namespace quite yet, but flag whether the user wants a |
83 # Don't bind to namespace quite yet, but flag whether the user wants a |
83 # specific namespace or to use __main__.__dict__. This will allow us |
84 # specific namespace or to use __main__.__dict__. This will allow us |