eric7/Documentation/Source/eric7.Utilities.ModuleParser.html

branch
eric7
changeset 8372
e0227a7c850e
child 8596
d64760b2da50
equal deleted inserted replaced
8371:d6062691d424 8372:e0227a7c850e
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.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>
22 <a NAME="top" ID="top"></a>
23 <h1>eric7.Utilities.ModuleParser</h1>
24
25 <p>
26 Parse a Python module file.
27 </p>
28 <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
38 <table>
39 <tr><td>PTL_SOURCE</td></tr><tr><td>PY_SOURCE</td></tr><tr><td>RB_SOURCE</td></tr><tr><td>SEARCH_ERROR</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>
40 </table>
41 <h3>Classes</h3>
42
43 <table>
44
45 <tr>
46 <td><a href="#Attribute">Attribute</a></td>
47 <td>Class to represent a Python function or method.</td>
48 </tr>
49 <tr>
50 <td><a href="#Class">Class</a></td>
51 <td>Class to represent a Python class.</td>
52 </tr>
53 <tr>
54 <td><a href="#Function">Function</a></td>
55 <td>Class to represent a Python function or method.</td>
56 </tr>
57 <tr>
58 <td><a href="#Module">Module</a></td>
59 <td>Class to represent a Python module.</td>
60 </tr>
61 <tr>
62 <td><a href="#RbModule">RbModule</a></td>
63 <td>Class to represent a Ruby module.</td>
64 </tr>
65 <tr>
66 <td><a href="#VisibilityBase">VisibilityBase</a></td>
67 <td>Class implementing the visibility aspect of all objects.</td>
68 </tr>
69 </table>
70 <h3>Functions</h3>
71
72 <table>
73
74 <tr>
75 <td><a href="#_indent">_indent</a></td>
76 <td>Protected function to determine the indent width of a whitespace string.</td>
77 </tr>
78 <tr>
79 <td><a href="#find_module">find_module</a></td>
80 <td>Module function to extend the Python module finding mechanism.</td>
81 </tr>
82 <tr>
83 <td><a href="#getTypeFromTypeName">getTypeFromTypeName</a></td>
84 <td>Module function to determine the module type given the module type name.</td>
85 </tr>
86 <tr>
87 <td><a href="#readModule">readModule</a></td>
88 <td>Function to read a module file and parse it.</td>
89 </tr>
90 <tr>
91 <td><a href="#resetParsedModule">resetParsedModule</a></td>
92 <td>Module function to clear one module from the list of parsed modules.</td>
93 </tr>
94 <tr>
95 <td><a href="#resetParsedModules">resetParsedModules</a></td>
96 <td>Module function to reset the list of modules already parsed.</td>
97 </tr>
98 </table>
99 <hr />
100 <hr />
101 <a NAME="Attribute" ID="Attribute"></a>
102 <h2>Attribute</h2>
103
104 <p>
105 Class to represent a Python function or method.
106 </p>
107 <h3>Derived from</h3>
108 VisibilityBase
109 <h3>Class Attributes</h3>
110
111 <table>
112 <tr><td>None</td></tr>
113 </table>
114 <h3>Class Methods</h3>
115
116 <table>
117 <tr><td>None</td></tr>
118 </table>
119 <h3>Methods</h3>
120
121 <table>
122
123 <tr>
124 <td><a href="#Attribute.__init__">Attribute</a></td>
125 <td>Constructor</td>
126 </tr>
127 <tr>
128 <td><a href="#Attribute.addAssignment">addAssignment</a></td>
129 <td>Public method to add another assignment line number.</td>
130 </tr>
131 </table>
132 <h3>Static Methods</h3>
133
134 <table>
135 <tr><td>None</td></tr>
136 </table>
137
138 <a NAME="Attribute.__init__" ID="Attribute.__init__"></a>
139 <h4>Attribute (Constructor)</h4>
140 <b>Attribute</b>(<i>module, name, file, lineno, isSignal=False</i>)
141
142 <p>
143 Constructor
144 </p>
145 <dl>
146
147 <dt><i>module</i></dt>
148 <dd>
149 name of module containing this function (string)
150 </dd>
151 <dt><i>name</i></dt>
152 <dd>
153 name of the function (string)
154 </dd>
155 <dt><i>file</i></dt>
156 <dd>
157 name of file containing this function (string)
158 </dd>
159 <dt><i>lineno</i></dt>
160 <dd>
161 linenumber of the first attribute assignment (integer)
162 </dd>
163 <dt><i>isSignal</i></dt>
164 <dd>
165 flag indicating a signal definition (boolean)
166 </dd>
167 </dl>
168 <a NAME="Attribute.addAssignment" ID="Attribute.addAssignment"></a>
169 <h4>Attribute.addAssignment</h4>
170 <b>addAssignment</b>(<i>lineno</i>)
171
172 <p>
173 Public method to add another assignment line number.
174 </p>
175 <dl>
176
177 <dt><i>lineno</i></dt>
178 <dd>
179 linenumber of the additional attribute assignment
180 (integer)
181 </dd>
182 </dl>
183 <div align="right"><a href="#top">Up</a></div>
184 <hr />
185 <hr />
186 <a NAME="Class" ID="Class"></a>
187 <h2>Class</h2>
188
189 <p>
190 Class to represent a Python class.
191 </p>
192 <h3>Derived from</h3>
193 VisibilityBase
194 <h3>Class Attributes</h3>
195
196 <table>
197 <tr><td>None</td></tr>
198 </table>
199 <h3>Class Methods</h3>
200
201 <table>
202 <tr><td>None</td></tr>
203 </table>
204 <h3>Methods</h3>
205
206 <table>
207
208 <tr>
209 <td><a href="#Class.__init__">Class</a></td>
210 <td>Constructor</td>
211 </tr>
212 <tr>
213 <td><a href="#Class.addAttribute">addAttribute</a></td>
214 <td>Public method to add information about attributes.</td>
215 </tr>
216 <tr>
217 <td><a href="#Class.addDescription">addDescription</a></td>
218 <td>Public method to store the class docstring.</td>
219 </tr>
220 <tr>
221 <td><a href="#Class.addGlobal">addGlobal</a></td>
222 <td>Public method to add information about global (class) variables.</td>
223 </tr>
224 <tr>
225 <td><a href="#Class.addMethod">addMethod</a></td>
226 <td>Public method to add information about a method.</td>
227 </tr>
228 <tr>
229 <td><a href="#Class.getAttribute">getAttribute</a></td>
230 <td>Public method to retrieve an attribute by name.</td>
231 </tr>
232 <tr>
233 <td><a href="#Class.getMethod">getMethod</a></td>
234 <td>Public method to retrieve a method by name.</td>
235 </tr>
236 <tr>
237 <td><a href="#Class.setEndLine">setEndLine</a></td>
238 <td>Public method to record the number of the last line of a class.</td>
239 </tr>
240 </table>
241 <h3>Static Methods</h3>
242
243 <table>
244 <tr><td>None</td></tr>
245 </table>
246
247 <a NAME="Class.__init__" ID="Class.__init__"></a>
248 <h4>Class (Constructor)</h4>
249 <b>Class</b>(<i>module, name, superClasses, file, lineno</i>)
250
251 <p>
252 Constructor
253 </p>
254 <dl>
255
256 <dt><i>module</i></dt>
257 <dd>
258 name of module containing this class (string)
259 </dd>
260 <dt><i>name</i></dt>
261 <dd>
262 name of the class (string)
263 </dd>
264 <dt><i>superClasses</i></dt>
265 <dd>
266 list of classnames this class is inherited from
267 (list of strings)
268 </dd>
269 <dt><i>file</i></dt>
270 <dd>
271 name of file containing this class (string)
272 </dd>
273 <dt><i>lineno</i></dt>
274 <dd>
275 linenumber of the class definition (integer)
276 </dd>
277 </dl>
278 <a NAME="Class.addAttribute" ID="Class.addAttribute"></a>
279 <h4>Class.addAttribute</h4>
280 <b>addAttribute</b>(<i>name, attr</i>)
281
282 <p>
283 Public method to add information about attributes.
284 </p>
285 <dl>
286
287 <dt><i>name</i></dt>
288 <dd>
289 name of the attribute to add (string)
290 </dd>
291 <dt><i>attr</i></dt>
292 <dd>
293 Attribute object to be added
294 </dd>
295 </dl>
296 <a NAME="Class.addDescription" ID="Class.addDescription"></a>
297 <h4>Class.addDescription</h4>
298 <b>addDescription</b>(<i>description</i>)
299
300 <p>
301 Public method to store the class docstring.
302 </p>
303 <dl>
304
305 <dt><i>description</i></dt>
306 <dd>
307 the docstring to be stored (string)
308 </dd>
309 </dl>
310 <a NAME="Class.addGlobal" ID="Class.addGlobal"></a>
311 <h4>Class.addGlobal</h4>
312 <b>addGlobal</b>(<i>name, attr</i>)
313
314 <p>
315 Public method to add information about global (class) variables.
316 </p>
317 <dl>
318
319 <dt><i>name</i></dt>
320 <dd>
321 name of the global to add (string)
322 </dd>
323 <dt><i>attr</i></dt>
324 <dd>
325 Attribute object to be added
326 </dd>
327 </dl>
328 <a NAME="Class.addMethod" ID="Class.addMethod"></a>
329 <h4>Class.addMethod</h4>
330 <b>addMethod</b>(<i>name, function</i>)
331
332 <p>
333 Public method to add information about a method.
334 </p>
335 <dl>
336
337 <dt><i>name</i></dt>
338 <dd>
339 name of method to be added (string)
340 </dd>
341 <dt><i>function</i></dt>
342 <dd>
343 Function object to be added
344 </dd>
345 </dl>
346 <a NAME="Class.getAttribute" ID="Class.getAttribute"></a>
347 <h4>Class.getAttribute</h4>
348 <b>getAttribute</b>(<i>name</i>)
349
350 <p>
351 Public method to retrieve an attribute by name.
352 </p>
353 <dl>
354
355 <dt><i>name</i></dt>
356 <dd>
357 name of the attribute (string)
358 </dd>
359 </dl>
360 <dl>
361 <dt>Return:</dt>
362 <dd>
363 the named attribute or None
364 </dd>
365 </dl>
366 <a NAME="Class.getMethod" ID="Class.getMethod"></a>
367 <h4>Class.getMethod</h4>
368 <b>getMethod</b>(<i>name</i>)
369
370 <p>
371 Public method to retrieve a method by name.
372 </p>
373 <dl>
374
375 <dt><i>name</i></dt>
376 <dd>
377 name of the method (string)
378 </dd>
379 </dl>
380 <dl>
381 <dt>Return:</dt>
382 <dd>
383 the named method or None
384 </dd>
385 </dl>
386 <a NAME="Class.setEndLine" ID="Class.setEndLine"></a>
387 <h4>Class.setEndLine</h4>
388 <b>setEndLine</b>(<i>endLineNo</i>)
389
390 <p>
391 Public method to record the number of the last line of a class.
392 </p>
393 <dl>
394
395 <dt><i>endLineNo</i></dt>
396 <dd>
397 number of the last line (integer)
398 </dd>
399 </dl>
400 <div align="right"><a href="#top">Up</a></div>
401 <hr />
402 <hr />
403 <a NAME="Function" ID="Function"></a>
404 <h2>Function</h2>
405
406 <p>
407 Class to represent a Python function or method.
408 </p>
409 <h3>Derived from</h3>
410 VisibilityBase
411 <h3>Class Attributes</h3>
412
413 <table>
414 <tr><td>Class</td></tr><tr><td>General</td></tr><tr><td>Static</td></tr>
415 </table>
416 <h3>Class Methods</h3>
417
418 <table>
419 <tr><td>None</td></tr>
420 </table>
421 <h3>Methods</h3>
422
423 <table>
424
425 <tr>
426 <td><a href="#Function.__init__">Function</a></td>
427 <td>Constructor</td>
428 </tr>
429 <tr>
430 <td><a href="#Function.addDescription">addDescription</a></td>
431 <td>Public method to store the functions docstring.</td>
432 </tr>
433 <tr>
434 <td><a href="#Function.setEndLine">setEndLine</a></td>
435 <td>Public method to record the number of the last line of a class.</td>
436 </tr>
437 </table>
438 <h3>Static Methods</h3>
439
440 <table>
441 <tr><td>None</td></tr>
442 </table>
443
444 <a NAME="Function.__init__" ID="Function.__init__"></a>
445 <h4>Function (Constructor)</h4>
446 <b>Function</b>(<i>module, name, file, lineno, signature='', pyqtSignature=None, modifierType=General, annotation=""</i>)
447
448 <p>
449 Constructor
450 </p>
451 <dl>
452
453 <dt><i>module</i></dt>
454 <dd>
455 name of module containing this function (string)
456 </dd>
457 <dt><i>name</i></dt>
458 <dd>
459 name of the function (string)
460 </dd>
461 <dt><i>file</i></dt>
462 <dd>
463 name of file containing this function (string)
464 </dd>
465 <dt><i>lineno</i></dt>
466 <dd>
467 linenumber of the function definition (integer)
468 </dd>
469 <dt><i>signature</i></dt>
470 <dd>
471 the functions call signature (string)
472 </dd>
473 <dt><i>pyqtSignature</i></dt>
474 <dd>
475 the functions PyQt signature (string)
476 </dd>
477 <dt><i>modifierType</i></dt>
478 <dd>
479 type of the function
480 </dd>
481 <dt><i>annotation</i></dt>
482 <dd>
483 return annotation
484 </dd>
485 </dl>
486 <a NAME="Function.addDescription" ID="Function.addDescription"></a>
487 <h4>Function.addDescription</h4>
488 <b>addDescription</b>(<i>description</i>)
489
490 <p>
491 Public method to store the functions docstring.
492 </p>
493 <dl>
494
495 <dt><i>description</i></dt>
496 <dd>
497 the docstring to be stored (string)
498 </dd>
499 </dl>
500 <a NAME="Function.setEndLine" ID="Function.setEndLine"></a>
501 <h4>Function.setEndLine</h4>
502 <b>setEndLine</b>(<i>endLineNo</i>)
503
504 <p>
505 Public method to record the number of the last line of a class.
506 </p>
507 <dl>
508
509 <dt><i>endLineNo</i></dt>
510 <dd>
511 number of the last line (integer)
512 </dd>
513 </dl>
514 <div align="right"><a href="#top">Up</a></div>
515 <hr />
516 <hr />
517 <a NAME="Module" ID="Module"></a>
518 <h2>Module</h2>
519
520 <p>
521 Class to represent a Python module.
522 </p>
523 <h3>Derived from</h3>
524 None
525 <h3>Class Attributes</h3>
526
527 <table>
528 <tr><td>None</td></tr>
529 </table>
530 <h3>Class Methods</h3>
531
532 <table>
533 <tr><td>None</td></tr>
534 </table>
535 <h3>Methods</h3>
536
537 <table>
538
539 <tr>
540 <td><a href="#Module.__init__">Module</a></td>
541 <td>Constructor</td>
542 </tr>
543 <tr>
544 <td><a href="#Module.__py_scan">__py_scan</a></td>
545 <td>Private method to scan the source text of a Python module and retrieve the relevant information.</td>
546 </tr>
547 <tr>
548 <td><a href="#Module.__py_setVisibility">__py_setVisibility</a></td>
549 <td>Private method to set the visibility of an object.</td>
550 </tr>
551 <tr>
552 <td><a href="#Module.__rb_scan">__rb_scan</a></td>
553 <td>Private method to scan the source text of a Python module and retrieve the relevant information.</td>
554 </tr>
555 <tr>
556 <td><a href="#Module.addClass">addClass</a></td>
557 <td>Public method to add information about a class.</td>
558 </tr>
559 <tr>
560 <td><a href="#Module.addDescription">addDescription</a></td>
561 <td>Public method to store the modules docstring.</td>
562 </tr>
563 <tr>
564 <td><a href="#Module.addFunction">addFunction</a></td>
565 <td>Public method to add information about a function.</td>
566 </tr>
567 <tr>
568 <td><a href="#Module.addGlobal">addGlobal</a></td>
569 <td>Public method to add information about global variables.</td>
570 </tr>
571 <tr>
572 <td><a href="#Module.addModule">addModule</a></td>
573 <td>Public method to add information about a Ruby module.</td>
574 </tr>
575 <tr>
576 <td><a href="#Module.addPathToHierarchy">addPathToHierarchy</a></td>
577 <td>Public method to put the exhausted path into the result dictionary.</td>
578 </tr>
579 <tr>
580 <td><a href="#Module.assembleHierarchy">assembleHierarchy</a></td>
581 <td>Public method to assemble the inheritance hierarchy.</td>
582 </tr>
583 <tr>
584 <td><a href="#Module.calculateEndline">calculateEndline</a></td>
585 <td>Function to calculate the end line of a class or method/function.</td>
586 </tr>
587 <tr>
588 <td><a href="#Module.createHierarchy">createHierarchy</a></td>
589 <td>Public method to build the inheritance hierarchy for all classes of this module.</td>
590 </tr>
591 <tr>
592 <td><a href="#Module.getFileName">getFileName</a></td>
593 <td>Public method to retrieve the modules filename.</td>
594 </tr>
595 <tr>
596 <td><a href="#Module.getName">getName</a></td>
597 <td>Public method to retrieve the modules name.</td>
598 </tr>
599 <tr>
600 <td><a href="#Module.getType">getType</a></td>
601 <td>Public method to get the type of the module's source.</td>
602 </tr>
603 <tr>
604 <td><a href="#Module.scan">scan</a></td>
605 <td>Public method to scan the source text and retrieve the relevant information.</td>
606 </tr>
607 </table>
608 <h3>Static Methods</h3>
609
610 <table>
611 <tr><td>None</td></tr>
612 </table>
613
614 <a NAME="Module.__init__" ID="Module.__init__"></a>
615 <h4>Module (Constructor)</h4>
616 <b>Module</b>(<i>name, file=None, moduleType=None</i>)
617
618 <p>
619 Constructor
620 </p>
621 <dl>
622
623 <dt><i>name</i></dt>
624 <dd>
625 name of this module (string)
626 </dd>
627 <dt><i>file</i></dt>
628 <dd>
629 filename of file containing this module (string)
630 </dd>
631 <dt><i>moduleType</i></dt>
632 <dd>
633 type of this module
634 </dd>
635 </dl>
636 <a NAME="Module.__py_scan" ID="Module.__py_scan"></a>
637 <h4>Module.__py_scan</h4>
638 <b>__py_scan</b>(<i>src</i>)
639
640 <p>
641 Private method to scan the source text of a Python module and retrieve
642 the relevant information.
643 </p>
644 <dl>
645
646 <dt><i>src</i></dt>
647 <dd>
648 the source text to be scanned (string)
649 </dd>
650 </dl>
651 <a NAME="Module.__py_setVisibility" ID="Module.__py_setVisibility"></a>
652 <h4>Module.__py_setVisibility</h4>
653 <b>__py_setVisibility</b>(<i>objectRef</i>)
654
655 <p>
656 Private method to set the visibility of an object.
657 </p>
658 <dl>
659
660 <dt><i>objectRef</i></dt>
661 <dd>
662 reference to the object (Attribute, Class or Function)
663 </dd>
664 </dl>
665 <a NAME="Module.__rb_scan" ID="Module.__rb_scan"></a>
666 <h4>Module.__rb_scan</h4>
667 <b>__rb_scan</b>(<i>src</i>)
668
669 <p>
670 Private method to scan the source text of a Python module and retrieve
671 the relevant information.
672 </p>
673 <dl>
674
675 <dt><i>src</i> (str)</dt>
676 <dd>
677 the source text to be scanned
678 </dd>
679 </dl>
680 <a NAME="Module.addClass" ID="Module.addClass"></a>
681 <h4>Module.addClass</h4>
682 <b>addClass</b>(<i>name, _class</i>)
683
684 <p>
685 Public method to add information about a class.
686 </p>
687 <dl>
688
689 <dt><i>name</i></dt>
690 <dd>
691 name of class to be added (string)
692 </dd>
693 <dt><i>_class</i></dt>
694 <dd>
695 Class object to be added
696 </dd>
697 </dl>
698 <a NAME="Module.addDescription" ID="Module.addDescription"></a>
699 <h4>Module.addDescription</h4>
700 <b>addDescription</b>(<i>description</i>)
701
702 <p>
703 Public method to store the modules docstring.
704 </p>
705 <dl>
706
707 <dt><i>description</i></dt>
708 <dd>
709 the docstring to be stored (string)
710 </dd>
711 </dl>
712 <a NAME="Module.addFunction" ID="Module.addFunction"></a>
713 <h4>Module.addFunction</h4>
714 <b>addFunction</b>(<i>name, function</i>)
715
716 <p>
717 Public method to add information about a function.
718 </p>
719 <dl>
720
721 <dt><i>name</i></dt>
722 <dd>
723 name of function to be added (string)
724 </dd>
725 <dt><i>function</i></dt>
726 <dd>
727 Function object to be added
728 </dd>
729 </dl>
730 <a NAME="Module.addGlobal" ID="Module.addGlobal"></a>
731 <h4>Module.addGlobal</h4>
732 <b>addGlobal</b>(<i>name, attr</i>)
733
734 <p>
735 Public method to add information about global variables.
736 </p>
737 <dl>
738
739 <dt><i>name</i></dt>
740 <dd>
741 name of the global to add (string)
742 </dd>
743 <dt><i>attr</i></dt>
744 <dd>
745 Attribute object to be added
746 </dd>
747 </dl>
748 <a NAME="Module.addModule" ID="Module.addModule"></a>
749 <h4>Module.addModule</h4>
750 <b>addModule</b>(<i>name, module</i>)
751
752 <p>
753 Public method to add information about a Ruby module.
754 </p>
755 <dl>
756
757 <dt><i>name</i></dt>
758 <dd>
759 name of module to be added (string)
760 </dd>
761 <dt><i>module</i></dt>
762 <dd>
763 Module object to be added
764 </dd>
765 </dl>
766 <a NAME="Module.addPathToHierarchy" ID="Module.addPathToHierarchy"></a>
767 <h4>Module.addPathToHierarchy</h4>
768 <b>addPathToHierarchy</b>(<i>path, result, fn</i>)
769
770 <p>
771 Public method to put the exhausted path into the result dictionary.
772 </p>
773 <dl>
774
775 <dt><i>path</i></dt>
776 <dd>
777 the exhausted path of classes
778 </dd>
779 <dt><i>result</i></dt>
780 <dd>
781 the result dictionary
782 </dd>
783 <dt><i>fn</i></dt>
784 <dd>
785 function to call for classe that are already part of the
786 result dictionary
787 </dd>
788 </dl>
789 <a NAME="Module.assembleHierarchy" ID="Module.assembleHierarchy"></a>
790 <h4>Module.assembleHierarchy</h4>
791 <b>assembleHierarchy</b>(<i>name, classes, path, result</i>)
792
793 <p>
794 Public method to assemble the inheritance hierarchy.
795 </p>
796 <p>
797 This method will traverse the class hierarchy, from a given class
798 and build up a nested dictionary of super-classes. The result is
799 intended to be inverted, i.e. the highest level are the super classes.
800 </p>
801 <p>
802 This code is borrowed from Boa Constructor.
803 </p>
804 <dl>
805
806 <dt><i>name</i></dt>
807 <dd>
808 name of class to assemble hierarchy (string)
809 </dd>
810 <dt><i>classes</i></dt>
811 <dd>
812 A dictionary of classes to look in.
813 </dd>
814 <dt><i>path</i></dt>
815 <dd>
816
817 </dd>
818 <dt><i>result</i></dt>
819 <dd>
820 The resultant hierarchy
821 </dd>
822 </dl>
823 <a NAME="Module.calculateEndline" ID="Module.calculateEndline"></a>
824 <h4>Module.calculateEndline</h4>
825 <b>calculateEndline</b>(<i>lines, indent</i>)
826
827 <p>
828 Function to calculate the end line of a class or method/function.
829 </p>
830 <dl>
831
832 <dt><i>lineno</i> (int)</dt>
833 <dd>
834 line number to start at (one based)
835 </dd>
836 <dt><i>lines</i> (list of str)</dt>
837 <dd>
838 list of source lines
839 </dd>
840 <dt><i>indent</i> (int)</dt>
841 <dd>
842 indent length the class/method/function definition
843 </dd>
844 </dl>
845 <dl>
846 <dt>Return:</dt>
847 <dd>
848 end line of the class/method/function (one based)
849 </dd>
850 </dl>
851 <dl>
852 <dt>Return Type:</dt>
853 <dd>
854 int
855 </dd>
856 </dl>
857 <a NAME="Module.createHierarchy" ID="Module.createHierarchy"></a>
858 <h4>Module.createHierarchy</h4>
859 <b>createHierarchy</b>(<i></i>)
860
861 <p>
862 Public method to build the inheritance hierarchy for all classes of
863 this module.
864 </p>
865 <dl>
866 <dt>Return:</dt>
867 <dd>
868 A dictionary with inheritance hierarchies.
869 </dd>
870 </dl>
871 <a NAME="Module.getFileName" ID="Module.getFileName"></a>
872 <h4>Module.getFileName</h4>
873 <b>getFileName</b>(<i></i>)
874
875 <p>
876 Public method to retrieve the modules filename.
877 </p>
878 <dl>
879 <dt>Return:</dt>
880 <dd>
881 module filename (string)
882 </dd>
883 </dl>
884 <a NAME="Module.getName" ID="Module.getName"></a>
885 <h4>Module.getName</h4>
886 <b>getName</b>(<i></i>)
887
888 <p>
889 Public method to retrieve the modules name.
890 </p>
891 <dl>
892 <dt>Return:</dt>
893 <dd>
894 module name (string)
895 </dd>
896 </dl>
897 <a NAME="Module.getType" ID="Module.getType"></a>
898 <h4>Module.getType</h4>
899 <b>getType</b>(<i></i>)
900
901 <p>
902 Public method to get the type of the module's source.
903 </p>
904 <dl>
905 <dt>Return:</dt>
906 <dd>
907 type of the modules's source (string)
908 </dd>
909 </dl>
910 <a NAME="Module.scan" ID="Module.scan"></a>
911 <h4>Module.scan</h4>
912 <b>scan</b>(<i>src</i>)
913
914 <p>
915 Public method to scan the source text and retrieve the relevant
916 information.
917 </p>
918 <dl>
919
920 <dt><i>src</i></dt>
921 <dd>
922 the source text to be scanned (string)
923 </dd>
924 </dl>
925 <div align="right"><a href="#top">Up</a></div>
926 <hr />
927 <hr />
928 <a NAME="RbModule" ID="RbModule"></a>
929 <h2>RbModule</h2>
930
931 <p>
932 Class to represent a Ruby module.
933 </p>
934 <h3>Derived from</h3>
935 Class
936 <h3>Class Attributes</h3>
937
938 <table>
939 <tr><td>None</td></tr>
940 </table>
941 <h3>Class Methods</h3>
942
943 <table>
944 <tr><td>None</td></tr>
945 </table>
946 <h3>Methods</h3>
947
948 <table>
949
950 <tr>
951 <td><a href="#RbModule.__init__">RbModule</a></td>
952 <td>Constructor</td>
953 </tr>
954 <tr>
955 <td><a href="#RbModule.addClass">addClass</a></td>
956 <td>Public method to add information about a class.</td>
957 </tr>
958 </table>
959 <h3>Static Methods</h3>
960
961 <table>
962 <tr><td>None</td></tr>
963 </table>
964
965 <a NAME="RbModule.__init__" ID="RbModule.__init__"></a>
966 <h4>RbModule (Constructor)</h4>
967 <b>RbModule</b>(<i>module, name, file, lineno</i>)
968
969 <p>
970 Constructor
971 </p>
972 <dl>
973
974 <dt><i>module</i></dt>
975 <dd>
976 name of module containing this class (string)
977 </dd>
978 <dt><i>name</i></dt>
979 <dd>
980 name of the class (string)
981 </dd>
982 <dt><i>file</i></dt>
983 <dd>
984 name of file containing this class (string)
985 </dd>
986 <dt><i>lineno</i></dt>
987 <dd>
988 linenumber of the class definition (integer)
989 </dd>
990 </dl>
991 <a NAME="RbModule.addClass" ID="RbModule.addClass"></a>
992 <h4>RbModule.addClass</h4>
993 <b>addClass</b>(<i>name, _class</i>)
994
995 <p>
996 Public method to add information about a class.
997 </p>
998 <dl>
999
1000 <dt><i>name</i></dt>
1001 <dd>
1002 name of class to be added (string)
1003 </dd>
1004 <dt><i>_class</i></dt>
1005 <dd>
1006 Class object to be added
1007 </dd>
1008 </dl>
1009 <div align="right"><a href="#top">Up</a></div>
1010 <hr />
1011 <hr />
1012 <a NAME="VisibilityBase" ID="VisibilityBase"></a>
1013 <h2>VisibilityBase</h2>
1014
1015 <p>
1016 Class implementing the visibility aspect of all objects.
1017 </p>
1018 <h3>Derived from</h3>
1019 None
1020 <h3>Class Attributes</h3>
1021
1022 <table>
1023 <tr><td>None</td></tr>
1024 </table>
1025 <h3>Class Methods</h3>
1026
1027 <table>
1028 <tr><td>None</td></tr>
1029 </table>
1030 <h3>Methods</h3>
1031
1032 <table>
1033
1034 <tr>
1035 <td><a href="#VisibilityBase.isPrivate">isPrivate</a></td>
1036 <td>Public method to check, if the visibility is Private.</td>
1037 </tr>
1038 <tr>
1039 <td><a href="#VisibilityBase.isProtected">isProtected</a></td>
1040 <td>Public method to check, if the visibility is Protected.</td>
1041 </tr>
1042 <tr>
1043 <td><a href="#VisibilityBase.isPublic">isPublic</a></td>
1044 <td>Public method to check, if the visibility is Public.</td>
1045 </tr>
1046 <tr>
1047 <td><a href="#VisibilityBase.setPrivate">setPrivate</a></td>
1048 <td>Public method to set the visibility to Private.</td>
1049 </tr>
1050 <tr>
1051 <td><a href="#VisibilityBase.setProtected">setProtected</a></td>
1052 <td>Public method to set the visibility to Protected.</td>
1053 </tr>
1054 <tr>
1055 <td><a href="#VisibilityBase.setPublic">setPublic</a></td>
1056 <td>Public method to set the visibility to Public.</td>
1057 </tr>
1058 </table>
1059 <h3>Static Methods</h3>
1060
1061 <table>
1062 <tr><td>None</td></tr>
1063 </table>
1064
1065 <a NAME="VisibilityBase.isPrivate" ID="VisibilityBase.isPrivate"></a>
1066 <h4>VisibilityBase.isPrivate</h4>
1067 <b>isPrivate</b>(<i></i>)
1068
1069 <p>
1070 Public method to check, if the visibility is Private.
1071 </p>
1072 <dl>
1073 <dt>Return:</dt>
1074 <dd>
1075 flag indicating Private visibility (boolean)
1076 </dd>
1077 </dl>
1078 <a NAME="VisibilityBase.isProtected" ID="VisibilityBase.isProtected"></a>
1079 <h4>VisibilityBase.isProtected</h4>
1080 <b>isProtected</b>(<i></i>)
1081
1082 <p>
1083 Public method to check, if the visibility is Protected.
1084 </p>
1085 <dl>
1086 <dt>Return:</dt>
1087 <dd>
1088 flag indicating Protected visibility (boolean)
1089 </dd>
1090 </dl>
1091 <a NAME="VisibilityBase.isPublic" ID="VisibilityBase.isPublic"></a>
1092 <h4>VisibilityBase.isPublic</h4>
1093 <b>isPublic</b>(<i></i>)
1094
1095 <p>
1096 Public method to check, if the visibility is Public.
1097 </p>
1098 <dl>
1099 <dt>Return:</dt>
1100 <dd>
1101 flag indicating Public visibility (boolean)
1102 </dd>
1103 </dl>
1104 <a NAME="VisibilityBase.setPrivate" ID="VisibilityBase.setPrivate"></a>
1105 <h4>VisibilityBase.setPrivate</h4>
1106 <b>setPrivate</b>(<i></i>)
1107
1108 <p>
1109 Public method to set the visibility to Private.
1110 </p>
1111 <a NAME="VisibilityBase.setProtected" ID="VisibilityBase.setProtected"></a>
1112 <h4>VisibilityBase.setProtected</h4>
1113 <b>setProtected</b>(<i></i>)
1114
1115 <p>
1116 Public method to set the visibility to Protected.
1117 </p>
1118 <a NAME="VisibilityBase.setPublic" ID="VisibilityBase.setPublic"></a>
1119 <h4>VisibilityBase.setPublic</h4>
1120 <b>setPublic</b>(<i></i>)
1121
1122 <p>
1123 Public method to set the visibility to Public.
1124 </p>
1125 <div align="right"><a href="#top">Up</a></div>
1126 <hr />
1127 <hr />
1128 <a NAME="_indent" ID="_indent"></a>
1129 <h2>_indent</h2>
1130 <b>_indent</b>(<i>ws</i>)
1131
1132 <p>
1133 Protected function to determine the indent width of a whitespace string.
1134 </p>
1135 <dl>
1136
1137 <dt><i>ws</i></dt>
1138 <dd>
1139 The whitespace string to be cheked. (string)
1140 </dd>
1141 </dl>
1142 <dl>
1143 <dt>Return:</dt>
1144 <dd>
1145 Length of the whitespace string after tab expansion.
1146 </dd>
1147 </dl>
1148 <div align="right"><a href="#top">Up</a></div>
1149 <hr />
1150 <hr />
1151 <a NAME="find_module" ID="find_module"></a>
1152 <h2>find_module</h2>
1153 <b>find_module</b>(<i>name, path, extensions</i>)
1154
1155 <p>
1156 Module function to extend the Python module finding mechanism.
1157 </p>
1158 <p>
1159 This function searches for files in the given path. If the filename
1160 doesn't have an extension or an extension of .py, the normal search
1161 implemented in the imp module is used. For all other supported files
1162 only path is searched.
1163 </p>
1164 <dl>
1165
1166 <dt><i>name</i></dt>
1167 <dd>
1168 filename or modulename to search for (string)
1169 </dd>
1170 <dt><i>path</i></dt>
1171 <dd>
1172 search path (list of strings)
1173 </dd>
1174 <dt><i>extensions</i></dt>
1175 <dd>
1176 list of extensions, which should be considered valid
1177 source file extensions (list of strings)
1178 </dd>
1179 </dl>
1180 <dl>
1181 <dt>Return:</dt>
1182 <dd>
1183 tuple of the open file, pathname and description. Description
1184 is a tuple of file suffix, file mode and file type)
1185 </dd>
1186 </dl>
1187 <dl>
1188
1189 <dt>Raises <b>ImportError</b>:</dt>
1190 <dd>
1191 The file or module wasn't found.
1192 </dd>
1193 </dl>
1194 <div align="right"><a href="#top">Up</a></div>
1195 <hr />
1196 <hr />
1197 <a NAME="getTypeFromTypeName" ID="getTypeFromTypeName"></a>
1198 <h2>getTypeFromTypeName</h2>
1199 <b>getTypeFromTypeName</b>(<i>name</i>)
1200
1201 <p>
1202 Module function to determine the module type given the module type name.
1203 </p>
1204 <dl>
1205
1206 <dt><i>name</i></dt>
1207 <dd>
1208 module type name (string)
1209 </dd>
1210 </dl>
1211 <dl>
1212 <dt>Return:</dt>
1213 <dd>
1214 module type or -1 for failure (integer)
1215 </dd>
1216 </dl>
1217 <div align="right"><a href="#top">Up</a></div>
1218 <hr />
1219 <hr />
1220 <a NAME="readModule" ID="readModule"></a>
1221 <h2>readModule</h2>
1222 <b>readModule</b>(<i>module, path=None, inpackage=False, basename="", extensions=None, caching=True, ignoreBuiltinModules=False</i>)
1223
1224 <p>
1225 Function to read a module file and parse it.
1226 </p>
1227 <p>
1228 The module is searched in path and sys.path, read and parsed.
1229 If the module was parsed before, the information is taken
1230 from a cache in order to speed up processing.
1231 </p>
1232 <dl>
1233
1234 <dt><i>module</i></dt>
1235 <dd>
1236 name of the module to be parsed (string)
1237 </dd>
1238 <dt><i>path</i></dt>
1239 <dd>
1240 search path for the module (list of strings)
1241 </dd>
1242 <dt><i>inpackage</i></dt>
1243 <dd>
1244 flag indicating that module is inside a
1245 package (boolean)
1246 </dd>
1247 <dt><i>basename</i></dt>
1248 <dd>
1249 a path basename that is deleted from the filename of
1250 the module file to be read (string)
1251 </dd>
1252 <dt><i>extensions</i></dt>
1253 <dd>
1254 list of extensions, which should be considered valid
1255 source file extensions (list of strings)
1256 </dd>
1257 <dt><i>caching</i></dt>
1258 <dd>
1259 flag indicating that the parsed module should be
1260 cached (boolean)
1261 </dd>
1262 <dt><i>ignoreBuiltinModules</i></dt>
1263 <dd>
1264 flag indicating to ignore the builtin modules
1265 (boolean)
1266 </dd>
1267 </dl>
1268 <dl>
1269 <dt>Return:</dt>
1270 <dd>
1271 reference to a Module object containing the parsed
1272 module information (Module)
1273 </dd>
1274 </dl>
1275 <div align="right"><a href="#top">Up</a></div>
1276 <hr />
1277 <hr />
1278 <a NAME="resetParsedModule" ID="resetParsedModule"></a>
1279 <h2>resetParsedModule</h2>
1280 <b>resetParsedModule</b>(<i>module, basename=""</i>)
1281
1282 <p>
1283 Module function to clear one module from the list of parsed modules.
1284 </p>
1285 <dl>
1286
1287 <dt><i>module</i></dt>
1288 <dd>
1289 Name of the module to be parsed (string)
1290 </dd>
1291 <dt><i>basename</i></dt>
1292 <dd>
1293 a path basename. This basename is deleted from
1294 the filename of the module file to be cleared. (string)
1295 </dd>
1296 </dl>
1297 <div align="right"><a href="#top">Up</a></div>
1298 <hr />
1299 <hr />
1300 <a NAME="resetParsedModules" ID="resetParsedModules"></a>
1301 <h2>resetParsedModules</h2>
1302 <b>resetParsedModules</b>(<i></i>)
1303
1304 <p>
1305 Module function to reset the list of modules already parsed.
1306 </p>
1307 <div align="right"><a href="#top">Up</a></div>
1308 <hr />
1309 </body></html>

eric ide

mercurial