16 |
16 |
17 a { color: #BA6D36; } |
17 a { color: #BA6D36; } |
18 |
18 |
19 </style> |
19 </style> |
20 </head> |
20 </head> |
21 <body><a NAME="top" ID="top"></a> |
21 <body> |
|
22 <a NAME="top" ID="top"></a> |
22 <h1>eric6.DebugClients.Python.FlexCompleter</h1> |
23 <h1>eric6.DebugClients.Python.FlexCompleter</h1> |
|
24 |
23 <p> |
25 <p> |
24 Word completion for the eric6 shell. |
26 Word completion for the eric6 shell. |
25 </p><p> |
27 </p> |
|
28 <p> |
26 <h4>NOTE for eric6 variant</h4> |
29 <h4>NOTE for eric6 variant</h4> |
27 </p><p> |
30 </p> |
|
31 <p> |
28 This version is a re-implementation of rlcompleter |
32 This version is a re-implementation of rlcompleter |
29 as found in the Python3 library. It is modified to work with the eric6 |
33 as found in the Python3 library. It is modified to work with the eric6 |
30 debug clients. |
34 debug clients. |
31 </p><p> |
35 </p> |
|
36 <p> |
32 <h4>Original rlcompleter documentation</h4> |
37 <h4>Original rlcompleter documentation</h4> |
33 </p><p> |
38 </p> |
|
39 <p> |
34 This requires the latest extension to the readline module. The completer |
40 This requires the latest extension to the readline module. The completer |
35 completes keywords, built-ins and globals in a selectable namespace (which |
41 completes keywords, built-ins and globals in a selectable namespace (which |
36 defaults to __main__); when completing NAME.NAME..., it evaluates (!) the |
42 defaults to __main__); when completing NAME.NAME..., it evaluates (!) the |
37 expression up to the last dot and completes its attributes. |
43 expression up to the last dot and completes its attributes. |
38 </p><p> |
44 </p> |
|
45 <p> |
39 It's very cool to do "import sys" type "sys.", hit the |
46 It's very cool to do "import sys" type "sys.", hit the |
40 completion key (twice), and see the list of names defined by the |
47 completion key (twice), and see the list of names defined by the |
41 sys module! |
48 sys module! |
42 </p><p> |
49 </p> |
|
50 <p> |
43 Tip: to use the tab key as the completion key, call |
51 Tip: to use the tab key as the completion key, call |
44 </p><p> |
52 </p> |
|
53 <p> |
45 readline.parse_and_bind("tab: complete") |
54 readline.parse_and_bind("tab: complete") |
46 </p><p> |
55 </p> |
|
56 <p> |
47 <b>Notes</b>: |
57 <b>Notes</b>: |
48 <ul> |
58 <ul> |
49 <li> |
59 <li> |
50 Exceptions raised by the completer function are *ignored* (and |
60 Exceptions raised by the completer function are *ignored* (and |
51 generally cause the completion to fail). This is a feature -- since |
61 generally cause the completion to fail). This is a feature -- since |
66 used, and this module (and the readline module) are silently inactive. |
76 used, and this module (and the readline module) are silently inactive. |
67 </li> |
77 </li> |
68 </ul> |
78 </ul> |
69 </p> |
79 </p> |
70 <h3>Global Attributes</h3> |
80 <h3>Global Attributes</h3> |
|
81 |
71 <table> |
82 <table> |
72 <tr><td>__all__</td></tr> |
83 <tr><td>__all__</td></tr> |
73 </table> |
84 </table> |
74 <h3>Classes</h3> |
85 <h3>Classes</h3> |
75 <table> |
86 |
|
87 <table> |
|
88 |
76 <tr> |
89 <tr> |
77 <td><a href="#Completer">Completer</a></td> |
90 <td><a href="#Completer">Completer</a></td> |
78 <td>Class implementing the command line completer object.</td> |
91 <td>Class implementing the command line completer object.</td> |
79 </tr> |
92 </tr> |
80 </table> |
93 </table> |
81 <h3>Functions</h3> |
94 <h3>Functions</h3> |
82 <table> |
95 |
|
96 <table> |
|
97 |
83 <tr> |
98 <tr> |
84 <td><a href="#get_class_members">get_class_members</a></td> |
99 <td><a href="#get_class_members">get_class_members</a></td> |
85 <td>Module function to retrieve the class members.</td> |
100 <td>Module function to retrieve the class members.</td> |
86 </tr> |
101 </tr> |
87 </table> |
102 </table> |
88 <hr /><hr /> |
103 <hr /> |
|
104 <hr /> |
89 <a NAME="Completer" ID="Completer"></a> |
105 <a NAME="Completer" ID="Completer"></a> |
90 <h2>Completer</h2> |
106 <h2>Completer</h2> |
|
107 |
91 <p> |
108 <p> |
92 Class implementing the command line completer object. |
109 Class implementing the command line completer object. |
93 </p> |
110 </p> |
94 <h3>Derived from</h3> |
111 <h3>Derived from</h3> |
95 object |
112 object |
96 <h3>Class Attributes</h3> |
113 <h3>Class Attributes</h3> |
|
114 |
97 <table> |
115 <table> |
98 <tr><td>None</td></tr> |
116 <tr><td>None</td></tr> |
99 </table> |
117 </table> |
100 <h3>Class Methods</h3> |
118 <h3>Class Methods</h3> |
|
119 |
101 <table> |
120 <table> |
102 <tr><td>None</td></tr> |
121 <tr><td>None</td></tr> |
103 </table> |
122 </table> |
104 <h3>Methods</h3> |
123 <h3>Methods</h3> |
105 <table> |
124 |
|
125 <table> |
|
126 |
106 <tr> |
127 <tr> |
107 <td><a href="#Completer.__init__">Completer</a></td> |
128 <td><a href="#Completer.__init__">Completer</a></td> |
108 <td>Constructor</td> |
129 <td>Constructor</td> |
109 </tr><tr> |
130 </tr> |
|
131 <tr> |
110 <td><a href="#Completer._callable_postfix">_callable_postfix</a></td> |
132 <td><a href="#Completer._callable_postfix">_callable_postfix</a></td> |
111 <td>Protected method to check for a callable.</td> |
133 <td>Protected method to check for a callable.</td> |
112 </tr><tr> |
134 </tr> |
|
135 <tr> |
113 <td><a href="#Completer.attr_matches">attr_matches</a></td> |
136 <td><a href="#Completer.attr_matches">attr_matches</a></td> |
114 <td>Public method to compute matches when text contains a dot.</td> |
137 <td>Public method to compute matches when text contains a dot.</td> |
115 </tr><tr> |
138 </tr> |
|
139 <tr> |
116 <td><a href="#Completer.complete">complete</a></td> |
140 <td><a href="#Completer.complete">complete</a></td> |
117 <td>Public method to return the next possible completion for 'text'.</td> |
141 <td>Public method to return the next possible completion for 'text'.</td> |
118 </tr><tr> |
142 </tr> |
|
143 <tr> |
119 <td><a href="#Completer.global_matches">global_matches</a></td> |
144 <td><a href="#Completer.global_matches">global_matches</a></td> |
120 <td>Public method to compute matches when text is a simple name.</td> |
145 <td>Public method to compute matches when text is a simple name.</td> |
121 </tr> |
146 </tr> |
122 </table> |
147 </table> |
123 <h3>Static Methods</h3> |
148 <h3>Static Methods</h3> |
|
149 |
124 <table> |
150 <table> |
125 <tr><td>None</td></tr> |
151 <tr><td>None</td></tr> |
126 </table> |
152 </table> |
|
153 |
127 <a NAME="Completer.__init__" ID="Completer.__init__"></a> |
154 <a NAME="Completer.__init__" ID="Completer.__init__"></a> |
128 <h4>Completer (Constructor)</h4> |
155 <h4>Completer (Constructor)</h4> |
129 <b>Completer</b>(<i>namespace=None</i>) |
156 <b>Completer</b>(<i>namespace=None</i>) |
|
157 |
130 <p> |
158 <p> |
131 Constructor |
159 Constructor |
132 </p><p> |
160 </p> |
|
161 <p> |
133 Completer([namespace]) -> completer instance. |
162 Completer([namespace]) -> completer instance. |
134 </p><p> |
163 </p> |
|
164 <p> |
135 If unspecified, the default namespace where completions are performed |
165 If unspecified, the default namespace where completions are performed |
136 is __main__ (technically, __main__.__dict__). Namespaces should be |
166 is __main__ (technically, __main__.__dict__). Namespaces should be |
137 given as dictionaries. |
167 given as dictionaries. |
138 </p><p> |
168 </p> |
|
169 <p> |
139 Completer instances should be used as the completion mechanism of |
170 Completer instances should be used as the completion mechanism of |
140 readline via the set_completer() call: |
171 readline via the set_completer() call: |
141 </p><p> |
172 </p> |
|
173 <p> |
142 readline.set_completer(Completer(my_namespace).complete) |
174 readline.set_completer(Completer(my_namespace).complete) |
143 </p><dl> |
175 </p> |
|
176 <dl> |
|
177 |
144 <dt><i>namespace</i></dt> |
178 <dt><i>namespace</i></dt> |
145 <dd> |
179 <dd> |
146 The namespace for the completer. |
180 The namespace for the completer. |
147 </dd> |
181 </dd> |
148 </dl><dl> |
182 </dl> |
|
183 <dl> |
|
184 |
149 <dt>Raises <b>TypeError</b>:</dt> |
185 <dt>Raises <b>TypeError</b>:</dt> |
150 <dd> |
186 <dd> |
151 raised to indicate a wrong data structure of |
187 raised to indicate a wrong data structure of |
152 the namespace object |
188 the namespace object |
153 </dd> |
189 </dd> |
154 </dl><a NAME="Completer._callable_postfix" ID="Completer._callable_postfix"></a> |
190 </dl> |
|
191 <a NAME="Completer._callable_postfix" ID="Completer._callable_postfix"></a> |
155 <h4>Completer._callable_postfix</h4> |
192 <h4>Completer._callable_postfix</h4> |
156 <b>_callable_postfix</b>(<i>val, word</i>) |
193 <b>_callable_postfix</b>(<i>val, word</i>) |
|
194 |
157 <p> |
195 <p> |
158 Protected method to check for a callable. |
196 Protected method to check for a callable. |
159 </p><dl> |
197 </p> |
|
198 <dl> |
|
199 |
160 <dt><i>val</i></dt> |
200 <dt><i>val</i></dt> |
161 <dd> |
201 <dd> |
162 value to check (object) |
202 value to check (object) |
163 </dd><dt><i>word</i></dt> |
203 </dd> |
|
204 <dt><i>word</i></dt> |
164 <dd> |
205 <dd> |
165 word to ammend (string) |
206 word to ammend (string) |
166 </dd> |
207 </dd> |
167 </dl><dl> |
208 </dl> |
|
209 <dl> |
168 <dt>Returns:</dt> |
210 <dt>Returns:</dt> |
169 <dd> |
211 <dd> |
170 ammended word (string) |
212 ammended word (string) |
171 </dd> |
213 </dd> |
172 </dl><a NAME="Completer.attr_matches" ID="Completer.attr_matches"></a> |
214 </dl> |
|
215 <a NAME="Completer.attr_matches" ID="Completer.attr_matches"></a> |
173 <h4>Completer.attr_matches</h4> |
216 <h4>Completer.attr_matches</h4> |
174 <b>attr_matches</b>(<i>text</i>) |
217 <b>attr_matches</b>(<i>text</i>) |
|
218 |
175 <p> |
219 <p> |
176 Public method to compute matches when text contains a dot. |
220 Public method to compute matches when text contains a dot. |
177 </p><p> |
221 </p> |
|
222 <p> |
178 Assuming the text is of the form NAME.NAME....[NAME], and is |
223 Assuming the text is of the form NAME.NAME....[NAME], and is |
179 evaluatable in self.namespace, it will be evaluated and its attributes |
224 evaluatable in self.namespace, it will be evaluated and its attributes |
180 (as revealed by dir()) are used as possible completions. (For class |
225 (as revealed by dir()) are used as possible completions. (For class |
181 instances, class members are are also considered.) |
226 instances, class members are are also considered.) |
182 </p><p> |
227 </p> |
|
228 <p> |
183 <b>WARNING</b>: this can still invoke arbitrary C code, if an object |
229 <b>WARNING</b>: this can still invoke arbitrary C code, if an object |
184 with a __getattr__ hook is evaluated. |
230 with a __getattr__ hook is evaluated. |
185 </p><dl> |
231 </p> |
|
232 <dl> |
|
233 |
186 <dt><i>text</i></dt> |
234 <dt><i>text</i></dt> |
187 <dd> |
235 <dd> |
188 The text to be completed. (string) |
236 The text to be completed. (string) |
189 </dd> |
237 </dd> |
190 </dl><dl> |
238 </dl> |
|
239 <dl> |
191 <dt>Returns:</dt> |
240 <dt>Returns:</dt> |
192 <dd> |
241 <dd> |
193 A list of all matches. |
242 A list of all matches. |
194 </dd> |
243 </dd> |
195 </dl><a NAME="Completer.complete" ID="Completer.complete"></a> |
244 </dl> |
|
245 <a NAME="Completer.complete" ID="Completer.complete"></a> |
196 <h4>Completer.complete</h4> |
246 <h4>Completer.complete</h4> |
197 <b>complete</b>(<i>text, state</i>) |
247 <b>complete</b>(<i>text, state</i>) |
|
248 |
198 <p> |
249 <p> |
199 Public method to return the next possible completion for 'text'. |
250 Public method to return the next possible completion for 'text'. |
200 </p><p> |
251 </p> |
|
252 <p> |
201 This is called successively with state == 0, 1, 2, ... until it |
253 This is called successively with state == 0, 1, 2, ... until it |
202 returns None. The completion should begin with 'text'. |
254 returns None. The completion should begin with 'text'. |
203 </p><dl> |
255 </p> |
|
256 <dl> |
|
257 |
204 <dt><i>text</i></dt> |
258 <dt><i>text</i></dt> |
205 <dd> |
259 <dd> |
206 The text to be completed. (string) |
260 The text to be completed. (string) |
207 </dd><dt><i>state</i></dt> |
261 </dd> |
|
262 <dt><i>state</i></dt> |
208 <dd> |
263 <dd> |
209 The state of the completion. (integer) |
264 The state of the completion. (integer) |
210 </dd> |
265 </dd> |
211 </dl><dl> |
266 </dl> |
|
267 <dl> |
212 <dt>Returns:</dt> |
268 <dt>Returns:</dt> |
213 <dd> |
269 <dd> |
214 The possible completions as a list of strings. |
270 The possible completions as a list of strings. |
215 </dd> |
271 </dd> |
216 </dl><a NAME="Completer.global_matches" ID="Completer.global_matches"></a> |
272 </dl> |
|
273 <a NAME="Completer.global_matches" ID="Completer.global_matches"></a> |
217 <h4>Completer.global_matches</h4> |
274 <h4>Completer.global_matches</h4> |
218 <b>global_matches</b>(<i>text</i>) |
275 <b>global_matches</b>(<i>text</i>) |
|
276 |
219 <p> |
277 <p> |
220 Public method to compute matches when text is a simple name. |
278 Public method to compute matches when text is a simple name. |
221 </p><dl> |
279 </p> |
|
280 <dl> |
|
281 |
222 <dt><i>text</i></dt> |
282 <dt><i>text</i></dt> |
223 <dd> |
283 <dd> |
224 The text to be completed. (string) |
284 The text to be completed. (string) |
225 </dd> |
285 </dd> |
226 </dl><dl> |
286 </dl> |
|
287 <dl> |
227 <dt>Returns:</dt> |
288 <dt>Returns:</dt> |
228 <dd> |
289 <dd> |
229 A list of all keywords, built-in functions and names currently |
290 A list of all keywords, built-in functions and names currently |
230 defined in self.namespace that match. |
291 defined in self.namespace that match. |
231 </dd> |
292 </dd> |
232 </dl> |
293 </dl> |
233 <div align="right"><a href="#top">Up</a></div> |
294 <div align="right"><a href="#top">Up</a></div> |
234 <hr /><hr /> |
295 <hr /> |
|
296 <hr /> |
235 <a NAME="get_class_members" ID="get_class_members"></a> |
297 <a NAME="get_class_members" ID="get_class_members"></a> |
236 <h2>get_class_members</h2> |
298 <h2>get_class_members</h2> |
237 <b>get_class_members</b>(<i>klass</i>) |
299 <b>get_class_members</b>(<i>klass</i>) |
|
300 |
238 <p> |
301 <p> |
239 Module function to retrieve the class members. |
302 Module function to retrieve the class members. |
240 </p><dl> |
303 </p> |
|
304 <dl> |
|
305 |
241 <dt><i>klass</i></dt> |
306 <dt><i>klass</i></dt> |
242 <dd> |
307 <dd> |
243 The class object to be analysed. |
308 The class object to be analysed. |
244 </dd> |
309 </dd> |
245 </dl><dl> |
310 </dl> |
|
311 <dl> |
246 <dt>Returns:</dt> |
312 <dt>Returns:</dt> |
247 <dd> |
313 <dd> |
248 A list of all names defined in the class. |
314 A list of all names defined in the class. |
249 </dd> |
315 </dd> |
250 </dl> |
316 </dl> |