|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric5.Utilities.ModuleParser</title> |
|
6 <style> |
|
7 b'body {\n background:white;\n margin: 0em 1em 10em 1em;\n color: black;\n}\n\nh1 { color: white; background: #4FA4FF; }\nh2 { color: white; background: #4FA4FF; }\nh3 { color: white; background: #00557F; }\nh4 { color: white; background: #00557F; }\n \na { color: #AA5500; }\n' |
|
8 </style> |
|
9 </head> |
|
10 <body><a NAME="top" ID="top"></a> |
|
11 <h1>eric5.Utilities.ModuleParser</h1> |
|
12 <p> |
|
13 Parse a Python module file. |
|
14 </p><p> |
|
15 This module is based on pyclbr.py as of Python 2.2.2 |
|
16 </p><p> |
|
17 <b>BUGS</b> (from pyclbr.py) |
|
18 <ul> |
|
19 <li>Code that doesn't pass tabnanny or python -t will confuse it, unless |
|
20 you set the module TABWIDTH variable (default 8) to the correct tab width |
|
21 for the file.</li> |
|
22 </ul> |
|
23 </p> |
|
24 <h3>Global Attributes</h3> |
|
25 <table> |
|
26 <tr><td>PTL_SOURCE</td></tr><tr><td>RB_SOURCE</td></tr><tr><td>SUPPORTED_TYPES</td></tr><tr><td>TABWIDTH</td></tr><tr><td>__all__</td></tr><tr><td>_commentsub</td></tr><tr><td>_hashsub</td></tr><tr><td>_modules</td></tr><tr><td>_py_getnext</td></tr><tr><td>_rb_getnext</td></tr> |
|
27 </table> |
|
28 <h3>Classes</h3> |
|
29 <table> |
|
30 <tr> |
|
31 <td><a href="#Attribute">Attribute</a></td> |
|
32 <td>Class to represent a Python function or method.</td> |
|
33 </tr><tr> |
|
34 <td><a href="#Class">Class</a></td> |
|
35 <td>Class to represent a Python class.</td> |
|
36 </tr><tr> |
|
37 <td><a href="#Function">Function</a></td> |
|
38 <td>Class to represent a Python function or method.</td> |
|
39 </tr><tr> |
|
40 <td><a href="#Module">Module</a></td> |
|
41 <td>Class to represent a Python module.</td> |
|
42 </tr><tr> |
|
43 <td><a href="#RbModule">RbModule</a></td> |
|
44 <td>Class to represent a Ruby module.</td> |
|
45 </tr><tr> |
|
46 <td><a href="#VisibilityBase">VisibilityBase</a></td> |
|
47 <td>Class implementing the visibility aspect of all objects.</td> |
|
48 </tr> |
|
49 </table> |
|
50 <h3>Functions</h3> |
|
51 <table> |
|
52 <tr> |
|
53 <td><a href="#_indent">_indent</a></td> |
|
54 <td>Protected function to determine the indent width of a whitespace string.</td> |
|
55 </tr><tr> |
|
56 <td><a href="#find_module">find_module</a></td> |
|
57 <td>Module function to extend the Python module finding mechanism.</td> |
|
58 </tr><tr> |
|
59 <td><a href="#readModule">readModule</a></td> |
|
60 <td>Function to read a module file and parse it.</td> |
|
61 </tr><tr> |
|
62 <td><a href="#resetParsedModule">resetParsedModule</a></td> |
|
63 <td>Module function to clear one module from the list of parsed modules.</td> |
|
64 </tr><tr> |
|
65 <td><a href="#resetParsedModules">resetParsedModules</a></td> |
|
66 <td>Module function to reset the list of modules already parsed.</td> |
|
67 </tr> |
|
68 </table> |
|
69 <hr /><hr /> |
|
70 <a NAME="Attribute" ID="Attribute"></a> |
|
71 <h2>Attribute</h2> |
|
72 <p> |
|
73 Class to represent a Python function or method. |
|
74 </p> |
|
75 <h3>Derived from</h3> |
|
76 VisibilityBase |
|
77 <h3>Class Attributes</h3> |
|
78 <table> |
|
79 <tr><td>None</td></tr> |
|
80 </table> |
|
81 <h3>Methods</h3> |
|
82 <table> |
|
83 <tr> |
|
84 <td><a href="#Attribute.__init__">Attribute</a></td> |
|
85 <td>Constructor</td> |
|
86 </tr> |
|
87 </table> |
|
88 <a NAME="Attribute.__init__" ID="Attribute.__init__"></a> |
|
89 <h4>Attribute (Constructor)</h4> |
|
90 <b>Attribute</b>(<i>module, name, file, lineno</i>) |
|
91 <p> |
|
92 Constructor |
|
93 </p><dl> |
|
94 <dt><i>module</i></dt> |
|
95 <dd> |
|
96 name of module containing this function (string) |
|
97 </dd><dt><i>name</i></dt> |
|
98 <dd> |
|
99 name of the function (string) |
|
100 </dd><dt><i>file</i></dt> |
|
101 <dd> |
|
102 name of file containing this function (string) |
|
103 </dd><dt><i>lineno</i></dt> |
|
104 <dd> |
|
105 linenumber of the function definition (integer) |
|
106 </dd> |
|
107 </dl> |
|
108 <div align="right"><a href="#top">Up</a></div> |
|
109 <hr /><hr /> |
|
110 <a NAME="Class" ID="Class"></a> |
|
111 <h2>Class</h2> |
|
112 <p> |
|
113 Class to represent a Python class. |
|
114 </p> |
|
115 <h3>Derived from</h3> |
|
116 VisibilityBase |
|
117 <h3>Class Attributes</h3> |
|
118 <table> |
|
119 <tr><td>None</td></tr> |
|
120 </table> |
|
121 <h3>Methods</h3> |
|
122 <table> |
|
123 <tr> |
|
124 <td><a href="#Class.__init__">Class</a></td> |
|
125 <td>Constructor</td> |
|
126 </tr><tr> |
|
127 <td><a href="#Class.addAttribute">addAttribute</a></td> |
|
128 <td>Public method to add information about attributes.</td> |
|
129 </tr><tr> |
|
130 <td><a href="#Class.addDescription">addDescription</a></td> |
|
131 <td>Public method to store the class docstring.</td> |
|
132 </tr><tr> |
|
133 <td><a href="#Class.addGlobal">addGlobal</a></td> |
|
134 <td>Public method to add information about global (class) variables.</td> |
|
135 </tr><tr> |
|
136 <td><a href="#Class.addMethod">addMethod</a></td> |
|
137 <td>Public method to add information about a method.</td> |
|
138 </tr><tr> |
|
139 <td><a href="#Class.getAttribute">getAttribute</a></td> |
|
140 <td>Public method to retrieve an attribute by name.</td> |
|
141 </tr><tr> |
|
142 <td><a href="#Class.getMethod">getMethod</a></td> |
|
143 <td>Public method to retrieve a method by name.</td> |
|
144 </tr><tr> |
|
145 <td><a href="#Class.setEndLine">setEndLine</a></td> |
|
146 <td>Public method to record the number of the last line of a class.</td> |
|
147 </tr> |
|
148 </table> |
|
149 <a NAME="Class.__init__" ID="Class.__init__"></a> |
|
150 <h4>Class (Constructor)</h4> |
|
151 <b>Class</b>(<i>module, name, super, file, lineno</i>) |
|
152 <p> |
|
153 Constructor |
|
154 </p><dl> |
|
155 <dt><i>module</i></dt> |
|
156 <dd> |
|
157 name of module containing this class (string) |
|
158 </dd><dt><i>name</i></dt> |
|
159 <dd> |
|
160 name of the class (string) |
|
161 </dd><dt><i>super</i></dt> |
|
162 <dd> |
|
163 list of classnames this class is inherited from |
|
164 (list of strings) |
|
165 </dd><dt><i>file</i></dt> |
|
166 <dd> |
|
167 name of file containing this class (string) |
|
168 </dd><dt><i>lineno</i></dt> |
|
169 <dd> |
|
170 linenumber of the class definition (integer) |
|
171 </dd> |
|
172 </dl><a NAME="Class.addAttribute" ID="Class.addAttribute"></a> |
|
173 <h4>Class.addAttribute</h4> |
|
174 <b>addAttribute</b>(<i>name, attr</i>) |
|
175 <p> |
|
176 Public method to add information about attributes. |
|
177 </p><dl> |
|
178 <dt><i>name</i></dt> |
|
179 <dd> |
|
180 name of the attribute to add (string) |
|
181 </dd><dt><i>attr</i></dt> |
|
182 <dd> |
|
183 Attribute object to be added |
|
184 </dd> |
|
185 </dl><a NAME="Class.addDescription" ID="Class.addDescription"></a> |
|
186 <h4>Class.addDescription</h4> |
|
187 <b>addDescription</b>(<i>description</i>) |
|
188 <p> |
|
189 Public method to store the class docstring. |
|
190 </p><dl> |
|
191 <dt><i>description</i></dt> |
|
192 <dd> |
|
193 the docstring to be stored (string) |
|
194 </dd> |
|
195 </dl><a NAME="Class.addGlobal" ID="Class.addGlobal"></a> |
|
196 <h4>Class.addGlobal</h4> |
|
197 <b>addGlobal</b>(<i>name, attr</i>) |
|
198 <p> |
|
199 Public method to add information about global (class) variables. |
|
200 </p><dl> |
|
201 <dt><i>name</i></dt> |
|
202 <dd> |
|
203 name of the global to add (string) |
|
204 </dd><dt><i>attr</i></dt> |
|
205 <dd> |
|
206 Attribute object to be added |
|
207 </dd> |
|
208 </dl><a NAME="Class.addMethod" ID="Class.addMethod"></a> |
|
209 <h4>Class.addMethod</h4> |
|
210 <b>addMethod</b>(<i>name, function</i>) |
|
211 <p> |
|
212 Public method to add information about a method. |
|
213 </p><dl> |
|
214 <dt><i>name</i></dt> |
|
215 <dd> |
|
216 name of method to be added (string) |
|
217 </dd><dt><i>function</i></dt> |
|
218 <dd> |
|
219 Function object to be added |
|
220 </dd> |
|
221 </dl><a NAME="Class.getAttribute" ID="Class.getAttribute"></a> |
|
222 <h4>Class.getAttribute</h4> |
|
223 <b>getAttribute</b>(<i>name</i>) |
|
224 <p> |
|
225 Public method to retrieve an attribute by name. |
|
226 </p><dl> |
|
227 <dt><i>name</i></dt> |
|
228 <dd> |
|
229 name of the attribute (string) |
|
230 </dd> |
|
231 </dl><dl> |
|
232 <dt>Returns:</dt> |
|
233 <dd> |
|
234 the named attribute or None |
|
235 </dd> |
|
236 </dl><a NAME="Class.getMethod" ID="Class.getMethod"></a> |
|
237 <h4>Class.getMethod</h4> |
|
238 <b>getMethod</b>(<i>name</i>) |
|
239 <p> |
|
240 Public method to retrieve a method by name. |
|
241 </p><dl> |
|
242 <dt><i>name</i></dt> |
|
243 <dd> |
|
244 name of the method (string) |
|
245 </dd> |
|
246 </dl><dl> |
|
247 <dt>Returns:</dt> |
|
248 <dd> |
|
249 the named method or None |
|
250 </dd> |
|
251 </dl><a NAME="Class.setEndLine" ID="Class.setEndLine"></a> |
|
252 <h4>Class.setEndLine</h4> |
|
253 <b>setEndLine</b>(<i>endLineNo</i>) |
|
254 <p> |
|
255 Public method to record the number of the last line of a class. |
|
256 </p><dl> |
|
257 <dt><i>endLineNo</i></dt> |
|
258 <dd> |
|
259 number of the last line (integer) |
|
260 </dd> |
|
261 </dl> |
|
262 <div align="right"><a href="#top">Up</a></div> |
|
263 <hr /><hr /> |
|
264 <a NAME="Function" ID="Function"></a> |
|
265 <h2>Function</h2> |
|
266 <p> |
|
267 Class to represent a Python function or method. |
|
268 </p> |
|
269 <h3>Derived from</h3> |
|
270 VisibilityBase |
|
271 <h3>Class Attributes</h3> |
|
272 <table> |
|
273 <tr><td>None</td></tr> |
|
274 </table> |
|
275 <h3>Methods</h3> |
|
276 <table> |
|
277 <tr> |
|
278 <td><a href="#Function.__init__">Function</a></td> |
|
279 <td>Constructor</td> |
|
280 </tr><tr> |
|
281 <td><a href="#Function.addDescription">addDescription</a></td> |
|
282 <td>Public method to store the functions docstring.</td> |
|
283 </tr> |
|
284 </table> |
|
285 <a NAME="Function.__init__" ID="Function.__init__"></a> |
|
286 <h4>Function (Constructor)</h4> |
|
287 <b>Function</b>(<i>module, name, file, lineno, signature = '', pyqtSignature = None</i>) |
|
288 <p> |
|
289 Constructor |
|
290 </p><dl> |
|
291 <dt><i>module</i></dt> |
|
292 <dd> |
|
293 name of module containing this function (string) |
|
294 </dd><dt><i>name</i></dt> |
|
295 <dd> |
|
296 name of the function (string) |
|
297 </dd><dt><i>file</i></dt> |
|
298 <dd> |
|
299 name of file containing this function (string) |
|
300 </dd><dt><i>lineno</i></dt> |
|
301 <dd> |
|
302 linenumber of the function definition (integer) |
|
303 </dd><dt><i>signature</i></dt> |
|
304 <dd> |
|
305 the functions call signature (string) |
|
306 </dd><dt><i>pyqtSignature</i></dt> |
|
307 <dd> |
|
308 the functions PyQt signature (string) |
|
309 </dd> |
|
310 </dl><a NAME="Function.addDescription" ID="Function.addDescription"></a> |
|
311 <h4>Function.addDescription</h4> |
|
312 <b>addDescription</b>(<i>description</i>) |
|
313 <p> |
|
314 Public method to store the functions docstring. |
|
315 </p><dl> |
|
316 <dt><i>description</i></dt> |
|
317 <dd> |
|
318 the docstring to be stored (string) |
|
319 </dd> |
|
320 </dl> |
|
321 <div align="right"><a href="#top">Up</a></div> |
|
322 <hr /><hr /> |
|
323 <a NAME="Module" ID="Module"></a> |
|
324 <h2>Module</h2> |
|
325 <p> |
|
326 Class to represent a Python module. |
|
327 </p> |
|
328 <h3>Derived from</h3> |
|
329 object |
|
330 <h3>Class Attributes</h3> |
|
331 <table> |
|
332 <tr><td>None</td></tr> |
|
333 </table> |
|
334 <h3>Methods</h3> |
|
335 <table> |
|
336 <tr> |
|
337 <td><a href="#Module.__init__">Module</a></td> |
|
338 <td>Constructor</td> |
|
339 </tr><tr> |
|
340 <td><a href="#Module.__py_scan">__py_scan</a></td> |
|
341 <td>Private method to scan the source text of a Python module and retrieve the relevant information.</td> |
|
342 </tr><tr> |
|
343 <td><a href="#Module.__py_setVisibility">__py_setVisibility</a></td> |
|
344 <td>Private method to set the visibility of an object.</td> |
|
345 </tr><tr> |
|
346 <td><a href="#Module.__rb_scan">__rb_scan</a></td> |
|
347 <td>Private method to scan the source text of a Python module and retrieve the relevant information.</td> |
|
348 </tr><tr> |
|
349 <td><a href="#Module.addClass">addClass</a></td> |
|
350 <td>Public method to add information about a class.</td> |
|
351 </tr><tr> |
|
352 <td><a href="#Module.addDescription">addDescription</a></td> |
|
353 <td>Protected method to store the modules docstring.</td> |
|
354 </tr><tr> |
|
355 <td><a href="#Module.addFunction">addFunction</a></td> |
|
356 <td>Public method to add information about a function.</td> |
|
357 </tr><tr> |
|
358 <td><a href="#Module.addGlobal">addGlobal</a></td> |
|
359 <td>Public method to add information about global variables.</td> |
|
360 </tr><tr> |
|
361 <td><a href="#Module.addModule">addModule</a></td> |
|
362 <td>Public method to add information about a Ruby module.</td> |
|
363 </tr><tr> |
|
364 <td><a href="#Module.addPathToHierarchy">addPathToHierarchy</a></td> |
|
365 <td>Public method to put the exhausted path into the result dictionary.</td> |
|
366 </tr><tr> |
|
367 <td><a href="#Module.assembleHierarchy">assembleHierarchy</a></td> |
|
368 <td>Public method to assemble the inheritance hierarchy.</td> |
|
369 </tr><tr> |
|
370 <td><a href="#Module.createHierarchy">createHierarchy</a></td> |
|
371 <td>Public method to build the inheritance hierarchy for all classes of this module.</td> |
|
372 </tr><tr> |
|
373 <td><a href="#Module.getFileName">getFileName</a></td> |
|
374 <td>Public method to retrieve the modules filename.</td> |
|
375 </tr><tr> |
|
376 <td><a href="#Module.getName">getName</a></td> |
|
377 <td>Public method to retrieve the modules name.</td> |
|
378 </tr><tr> |
|
379 <td><a href="#Module.getType">getType</a></td> |
|
380 <td>Public method to get the type of the module's source.</td> |
|
381 </tr><tr> |
|
382 <td><a href="#Module.scan">scan</a></td> |
|
383 <td>Public method to scan the source text and retrieve the relevant information.</td> |
|
384 </tr> |
|
385 </table> |
|
386 <a NAME="Module.__init__" ID="Module.__init__"></a> |
|
387 <h4>Module (Constructor)</h4> |
|
388 <b>Module</b>(<i>name, file=None, type=None</i>) |
|
389 <p> |
|
390 Constructor |
|
391 </p><dl> |
|
392 <dt><i>name</i></dt> |
|
393 <dd> |
|
394 name of this module (string) |
|
395 </dd><dt><i>file</i></dt> |
|
396 <dd> |
|
397 filename of file containing this module (string) |
|
398 </dd><dt><i>type</i></dt> |
|
399 <dd> |
|
400 type of this module |
|
401 </dd> |
|
402 </dl><a NAME="Module.__py_scan" ID="Module.__py_scan"></a> |
|
403 <h4>Module.__py_scan</h4> |
|
404 <b>__py_scan</b>(<i>src</i>) |
|
405 <p> |
|
406 Private method to scan the source text of a Python module and retrieve the |
|
407 relevant information. |
|
408 </p><dl> |
|
409 <dt><i>src</i></dt> |
|
410 <dd> |
|
411 the source text to be scanned (string) |
|
412 </dd> |
|
413 </dl><a NAME="Module.__py_setVisibility" ID="Module.__py_setVisibility"></a> |
|
414 <h4>Module.__py_setVisibility</h4> |
|
415 <b>__py_setVisibility</b>(<i>object</i>) |
|
416 <p> |
|
417 Private method to set the visibility of an object. |
|
418 </p><dl> |
|
419 <dt><i>object</i></dt> |
|
420 <dd> |
|
421 reference to the object (Attribute, Class or Function) |
|
422 </dd> |
|
423 </dl><a NAME="Module.__rb_scan" ID="Module.__rb_scan"></a> |
|
424 <h4>Module.__rb_scan</h4> |
|
425 <b>__rb_scan</b>(<i>src</i>) |
|
426 <p> |
|
427 Private method to scan the source text of a Python module and retrieve the |
|
428 relevant information. |
|
429 </p><dl> |
|
430 <dt><i>src</i></dt> |
|
431 <dd> |
|
432 the source text to be scanned (string) |
|
433 </dd> |
|
434 </dl><a NAME="Module.addClass" ID="Module.addClass"></a> |
|
435 <h4>Module.addClass</h4> |
|
436 <b>addClass</b>(<i>name, _class</i>) |
|
437 <p> |
|
438 Public method to add information about a class. |
|
439 </p><dl> |
|
440 <dt><i>name</i></dt> |
|
441 <dd> |
|
442 name of class to be added (string) |
|
443 </dd><dt><i>_class</i></dt> |
|
444 <dd> |
|
445 Class object to be added |
|
446 </dd> |
|
447 </dl><a NAME="Module.addDescription" ID="Module.addDescription"></a> |
|
448 <h4>Module.addDescription</h4> |
|
449 <b>addDescription</b>(<i>description</i>) |
|
450 <p> |
|
451 Protected method to store the modules docstring. |
|
452 </p><dl> |
|
453 <dt><i>description</i></dt> |
|
454 <dd> |
|
455 the docstring to be stored (string) |
|
456 </dd> |
|
457 </dl><a NAME="Module.addFunction" ID="Module.addFunction"></a> |
|
458 <h4>Module.addFunction</h4> |
|
459 <b>addFunction</b>(<i>name, function</i>) |
|
460 <p> |
|
461 Public method to add information about a function. |
|
462 </p><dl> |
|
463 <dt><i>name</i></dt> |
|
464 <dd> |
|
465 name of function to be added (string) |
|
466 </dd><dt><i>function</i></dt> |
|
467 <dd> |
|
468 Function object to be added |
|
469 </dd> |
|
470 </dl><a NAME="Module.addGlobal" ID="Module.addGlobal"></a> |
|
471 <h4>Module.addGlobal</h4> |
|
472 <b>addGlobal</b>(<i>name, attr</i>) |
|
473 <p> |
|
474 Public method to add information about global variables. |
|
475 </p><dl> |
|
476 <dt><i>name</i></dt> |
|
477 <dd> |
|
478 name of the global to add (string) |
|
479 </dd><dt><i>attr</i></dt> |
|
480 <dd> |
|
481 Attribute object to be added |
|
482 </dd> |
|
483 </dl><a NAME="Module.addModule" ID="Module.addModule"></a> |
|
484 <h4>Module.addModule</h4> |
|
485 <b>addModule</b>(<i>name, module</i>) |
|
486 <p> |
|
487 Public method to add information about a Ruby module. |
|
488 </p><dl> |
|
489 <dt><i>name</i></dt> |
|
490 <dd> |
|
491 name of module to be added (string) |
|
492 </dd><dt><i>module</i></dt> |
|
493 <dd> |
|
494 Module object to be added |
|
495 </dd> |
|
496 </dl><a NAME="Module.addPathToHierarchy" ID="Module.addPathToHierarchy"></a> |
|
497 <h4>Module.addPathToHierarchy</h4> |
|
498 <b>addPathToHierarchy</b>(<i>path, result, fn</i>) |
|
499 <p> |
|
500 Public method to put the exhausted path into the result dictionary. |
|
501 </p><dl> |
|
502 <dt><i>path</i></dt> |
|
503 <dd> |
|
504 the exhausted path of classes |
|
505 </dd><dt><i>result</i></dt> |
|
506 <dd> |
|
507 the result dictionary |
|
508 </dd><dt><i>fn</i></dt> |
|
509 <dd> |
|
510 function to call for classe that are already part of the |
|
511 result dictionary |
|
512 </dd> |
|
513 </dl><a NAME="Module.assembleHierarchy" ID="Module.assembleHierarchy"></a> |
|
514 <h4>Module.assembleHierarchy</h4> |
|
515 <b>assembleHierarchy</b>(<i>name, classes, path, result</i>) |
|
516 <p> |
|
517 Public method to assemble the inheritance hierarchy. |
|
518 </p><p> |
|
519 This method will traverse the class hierarchy, from a given class |
|
520 and build up a nested dictionary of super-classes. The result is |
|
521 intended to be inverted, i.e. the highest level are the super classes. |
|
522 </p><p> |
|
523 This code is borrowed from Boa Constructor. |
|
524 </p><dl> |
|
525 <dt><i>name</i></dt> |
|
526 <dd> |
|
527 name of class to assemble hierarchy (string) |
|
528 </dd><dt><i>classes</i></dt> |
|
529 <dd> |
|
530 A dictionary of classes to look in. |
|
531 </dd><dt><i>path</i></dt> |
|
532 <dd> |
|
533 |
|
534 </dd><dt><i>result</i></dt> |
|
535 <dd> |
|
536 The resultant hierarchy |
|
537 </dd> |
|
538 </dl><a NAME="Module.createHierarchy" ID="Module.createHierarchy"></a> |
|
539 <h4>Module.createHierarchy</h4> |
|
540 <b>createHierarchy</b>(<i></i>) |
|
541 <p> |
|
542 Public method to build the inheritance hierarchy for all classes of this module. |
|
543 </p><dl> |
|
544 <dt>Returns:</dt> |
|
545 <dd> |
|
546 A dictionary with inheritance hierarchies. |
|
547 </dd> |
|
548 </dl><a NAME="Module.getFileName" ID="Module.getFileName"></a> |
|
549 <h4>Module.getFileName</h4> |
|
550 <b>getFileName</b>(<i></i>) |
|
551 <p> |
|
552 Public method to retrieve the modules filename. |
|
553 </p><dl> |
|
554 <dt>Returns:</dt> |
|
555 <dd> |
|
556 module filename (string) |
|
557 </dd> |
|
558 </dl><a NAME="Module.getName" ID="Module.getName"></a> |
|
559 <h4>Module.getName</h4> |
|
560 <b>getName</b>(<i></i>) |
|
561 <p> |
|
562 Public method to retrieve the modules name. |
|
563 </p><dl> |
|
564 <dt>Returns:</dt> |
|
565 <dd> |
|
566 module name (string) |
|
567 </dd> |
|
568 </dl><a NAME="Module.getType" ID="Module.getType"></a> |
|
569 <h4>Module.getType</h4> |
|
570 <b>getType</b>(<i></i>) |
|
571 <p> |
|
572 Public method to get the type of the module's source. |
|
573 </p><dl> |
|
574 <dt>Returns:</dt> |
|
575 <dd> |
|
576 type of the modules's source (string) |
|
577 </dd> |
|
578 </dl><a NAME="Module.scan" ID="Module.scan"></a> |
|
579 <h4>Module.scan</h4> |
|
580 <b>scan</b>(<i>src</i>) |
|
581 <p> |
|
582 Public method to scan the source text and retrieve the relevant information. |
|
583 </p><dl> |
|
584 <dt><i>src</i></dt> |
|
585 <dd> |
|
586 the source text to be scanned (string) |
|
587 </dd> |
|
588 </dl> |
|
589 <div align="right"><a href="#top">Up</a></div> |
|
590 <hr /><hr /> |
|
591 <a NAME="RbModule" ID="RbModule"></a> |
|
592 <h2>RbModule</h2> |
|
593 <p> |
|
594 Class to represent a Ruby module. |
|
595 </p> |
|
596 <h3>Derived from</h3> |
|
597 Class |
|
598 <h3>Class Attributes</h3> |
|
599 <table> |
|
600 <tr><td>None</td></tr> |
|
601 </table> |
|
602 <h3>Methods</h3> |
|
603 <table> |
|
604 <tr> |
|
605 <td><a href="#RbModule.__init__">RbModule</a></td> |
|
606 <td>Constructor</td> |
|
607 </tr><tr> |
|
608 <td><a href="#RbModule.addClass">addClass</a></td> |
|
609 <td>Public method to add information about a class.</td> |
|
610 </tr> |
|
611 </table> |
|
612 <a NAME="RbModule.__init__" ID="RbModule.__init__"></a> |
|
613 <h4>RbModule (Constructor)</h4> |
|
614 <b>RbModule</b>(<i>module, name, file, lineno</i>) |
|
615 <p> |
|
616 Constructor |
|
617 </p><dl> |
|
618 <dt><i>module</i></dt> |
|
619 <dd> |
|
620 name of module containing this class (string) |
|
621 </dd><dt><i>name</i></dt> |
|
622 <dd> |
|
623 name of the class (string) |
|
624 </dd><dt><i>file</i></dt> |
|
625 <dd> |
|
626 name of file containing this class (string) |
|
627 </dd><dt><i>lineno</i></dt> |
|
628 <dd> |
|
629 linenumber of the class definition (integer) |
|
630 </dd> |
|
631 </dl><a NAME="RbModule.addClass" ID="RbModule.addClass"></a> |
|
632 <h4>RbModule.addClass</h4> |
|
633 <b>addClass</b>(<i>name, _class</i>) |
|
634 <p> |
|
635 Public method to add information about a class. |
|
636 </p><dl> |
|
637 <dt><i>name</i></dt> |
|
638 <dd> |
|
639 name of class to be added (string) |
|
640 </dd><dt><i>_class</i></dt> |
|
641 <dd> |
|
642 Class object to be added |
|
643 </dd> |
|
644 </dl> |
|
645 <div align="right"><a href="#top">Up</a></div> |
|
646 <hr /><hr /> |
|
647 <a NAME="VisibilityBase" ID="VisibilityBase"></a> |
|
648 <h2>VisibilityBase</h2> |
|
649 <p> |
|
650 Class implementing the visibility aspect of all objects. |
|
651 </p> |
|
652 <h3>Derived from</h3> |
|
653 object |
|
654 <h3>Class Attributes</h3> |
|
655 <table> |
|
656 <tr><td>None</td></tr> |
|
657 </table> |
|
658 <h3>Methods</h3> |
|
659 <table> |
|
660 <tr> |
|
661 <td><a href="#VisibilityBase.isPrivate">isPrivate</a></td> |
|
662 <td>Public method to check, if the visibility is Private.</td> |
|
663 </tr><tr> |
|
664 <td><a href="#VisibilityBase.isProtected">isProtected</a></td> |
|
665 <td>Public method to check, if the visibility is Protected.</td> |
|
666 </tr><tr> |
|
667 <td><a href="#VisibilityBase.isPublic">isPublic</a></td> |
|
668 <td>Public method to check, if the visibility is Public.</td> |
|
669 </tr><tr> |
|
670 <td><a href="#VisibilityBase.setPrivate">setPrivate</a></td> |
|
671 <td>Public method to set the visibility to Private.</td> |
|
672 </tr><tr> |
|
673 <td><a href="#VisibilityBase.setProtected">setProtected</a></td> |
|
674 <td>Public method to set the visibility to Protected.</td> |
|
675 </tr><tr> |
|
676 <td><a href="#VisibilityBase.setPublic">setPublic</a></td> |
|
677 <td>Public method to set the visibility to Public.</td> |
|
678 </tr> |
|
679 </table> |
|
680 <a NAME="VisibilityBase.isPrivate" ID="VisibilityBase.isPrivate"></a> |
|
681 <h4>VisibilityBase.isPrivate</h4> |
|
682 <b>isPrivate</b>(<i></i>) |
|
683 <p> |
|
684 Public method to check, if the visibility is Private. |
|
685 </p><dl> |
|
686 <dt>Returns:</dt> |
|
687 <dd> |
|
688 flag indicating Private visibility (boolean) |
|
689 </dd> |
|
690 </dl><a NAME="VisibilityBase.isProtected" ID="VisibilityBase.isProtected"></a> |
|
691 <h4>VisibilityBase.isProtected</h4> |
|
692 <b>isProtected</b>(<i></i>) |
|
693 <p> |
|
694 Public method to check, if the visibility is Protected. |
|
695 </p><dl> |
|
696 <dt>Returns:</dt> |
|
697 <dd> |
|
698 flag indicating Protected visibility (boolean) |
|
699 </dd> |
|
700 </dl><a NAME="VisibilityBase.isPublic" ID="VisibilityBase.isPublic"></a> |
|
701 <h4>VisibilityBase.isPublic</h4> |
|
702 <b>isPublic</b>(<i></i>) |
|
703 <p> |
|
704 Public method to check, if the visibility is Public. |
|
705 </p><dl> |
|
706 <dt>Returns:</dt> |
|
707 <dd> |
|
708 flag indicating Public visibility (boolean) |
|
709 </dd> |
|
710 </dl><a NAME="VisibilityBase.setPrivate" ID="VisibilityBase.setPrivate"></a> |
|
711 <h4>VisibilityBase.setPrivate</h4> |
|
712 <b>setPrivate</b>(<i></i>) |
|
713 <p> |
|
714 Public method to set the visibility to Private. |
|
715 </p><a NAME="VisibilityBase.setProtected" ID="VisibilityBase.setProtected"></a> |
|
716 <h4>VisibilityBase.setProtected</h4> |
|
717 <b>setProtected</b>(<i></i>) |
|
718 <p> |
|
719 Public method to set the visibility to Protected. |
|
720 </p><a NAME="VisibilityBase.setPublic" ID="VisibilityBase.setPublic"></a> |
|
721 <h4>VisibilityBase.setPublic</h4> |
|
722 <b>setPublic</b>(<i></i>) |
|
723 <p> |
|
724 Public method to set the visibility to Public. |
|
725 </p> |
|
726 <div align="right"><a href="#top">Up</a></div> |
|
727 <hr /><hr /> |
|
728 <a NAME="_indent" ID="_indent"></a> |
|
729 <h2>_indent</h2> |
|
730 <b>_indent</b>(<i>ws</i>) |
|
731 <p> |
|
732 Protected function to determine the indent width of a whitespace string. |
|
733 </p><dl> |
|
734 <dt><i>ws</i></dt> |
|
735 <dd> |
|
736 The whitespace string to be cheked. (string) |
|
737 </dd> |
|
738 </dl><dl> |
|
739 <dt>Returns:</dt> |
|
740 <dd> |
|
741 Length of the whitespace string after tab expansion. |
|
742 </dd> |
|
743 </dl> |
|
744 <div align="right"><a href="#top">Up</a></div> |
|
745 <hr /><hr /> |
|
746 <a NAME="find_module" ID="find_module"></a> |
|
747 <h2>find_module</h2> |
|
748 <b>find_module</b>(<i>name, path, extensions</i>) |
|
749 <p> |
|
750 Module function to extend the Python module finding mechanism. |
|
751 </p><p> |
|
752 This function searches for files in the given path. If the filename |
|
753 doesn't have an extension or an extension of .py, the normal search |
|
754 implemented in the imp module is used. For all other supported files |
|
755 only path is searched. |
|
756 </p><dl> |
|
757 <dt><i>name</i></dt> |
|
758 <dd> |
|
759 filename or modulename to search for (string) |
|
760 </dd><dt><i>path</i></dt> |
|
761 <dd> |
|
762 search path (list of strings) |
|
763 </dd><dt><i>extensions</i></dt> |
|
764 <dd> |
|
765 list of extensions, which should be considered valid |
|
766 source file extensions (list of strings) |
|
767 </dd> |
|
768 </dl><dl> |
|
769 <dt>Returns:</dt> |
|
770 <dd> |
|
771 tuple of the open file, pathname and description. Description |
|
772 is a tuple of file suffix, file mode and file type) |
|
773 </dd> |
|
774 </dl><dl> |
|
775 <dt>Raises <b>ImportError</b>:</dt> |
|
776 <dd> |
|
777 The file or module wasn't found. |
|
778 </dd> |
|
779 </dl> |
|
780 <div align="right"><a href="#top">Up</a></div> |
|
781 <hr /><hr /> |
|
782 <a NAME="readModule" ID="readModule"></a> |
|
783 <h2>readModule</h2> |
|
784 <b>readModule</b>(<i>module, path = [], inpackage = False, basename = "", extensions = None, caching = True</i>) |
|
785 <p> |
|
786 Function to read a module file and parse it. |
|
787 </p><p> |
|
788 The module is searched in path and sys.path, read and parsed. |
|
789 If the module was parsed before, the information is taken |
|
790 from a cache in order to speed up processing. |
|
791 </p><dl> |
|
792 <dt><i>module</i></dt> |
|
793 <dd> |
|
794 Name of the module to be parsed (string) |
|
795 </dd><dt><i>path</i></dt> |
|
796 <dd> |
|
797 Searchpath for the module (list of strings) |
|
798 </dd><dt><i>inpackage</i></dt> |
|
799 <dd> |
|
800 Flag indicating that module is inside a |
|
801 package (boolean) |
|
802 </dd><dt><i>basename</i></dt> |
|
803 <dd> |
|
804 a path basename. This basename is deleted from |
|
805 the filename of the module file to be read. (string) |
|
806 </dd><dt><i>extensions</i></dt> |
|
807 <dd> |
|
808 list of extensions, which should be considered valid |
|
809 source file extensions (list of strings) |
|
810 </dd><dt><i>caching</i></dt> |
|
811 <dd> |
|
812 flag indicating that the parsed module should be |
|
813 cached (boolean) |
|
814 </dd> |
|
815 </dl><dl> |
|
816 <dt>Returns:</dt> |
|
817 <dd> |
|
818 reference to a Module object containing the parsed |
|
819 module information (Module) |
|
820 </dd> |
|
821 </dl> |
|
822 <div align="right"><a href="#top">Up</a></div> |
|
823 <hr /><hr /> |
|
824 <a NAME="resetParsedModule" ID="resetParsedModule"></a> |
|
825 <h2>resetParsedModule</h2> |
|
826 <b>resetParsedModule</b>(<i>module, basename = ""</i>) |
|
827 <p> |
|
828 Module function to clear one module from the list of parsed modules. |
|
829 </p><dl> |
|
830 <dt><i>module</i></dt> |
|
831 <dd> |
|
832 Name of the module to be parsed (string) |
|
833 </dd><dt><i>basename</i></dt> |
|
834 <dd> |
|
835 a path basename. This basename is deleted from |
|
836 the filename of the module file to be cleared. (string) |
|
837 </dd> |
|
838 </dl> |
|
839 <div align="right"><a href="#top">Up</a></div> |
|
840 <hr /><hr /> |
|
841 <a NAME="resetParsedModules" ID="resetParsedModules"></a> |
|
842 <h2>resetParsedModules</h2> |
|
843 <b>resetParsedModules</b>(<i></i>) |
|
844 <p> |
|
845 Module function to reset the list of modules already parsed. |
|
846 </p> |
|
847 <div align="right"><a href="#top">Up</a></div> |
|
848 <hr /> |
|
849 </body></html> |