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