Documentation/Source/eric6.Utilities.ModuleParser.html

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

eric ide

mercurial