eric6/Documentation/Source/eric6.Utilities.ModuleParser.html

changeset 6942
2602857055c5
parent 5651
982465f8389c
child 7163
00166038bba5
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
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>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, superClasses, 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>superClasses</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, annotation=""</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><dt><i>annotation</i></dt>
371 <dd>
372 return annotation
373 </dd>
374 </dl><a NAME="Function.addDescription" ID="Function.addDescription"></a>
375 <h4>Function.addDescription</h4>
376 <b>addDescription</b>(<i>description</i>)
377 <p>
378 Public method to store the functions docstring.
379 </p><dl>
380 <dt><i>description</i></dt>
381 <dd>
382 the docstring to be stored (string)
383 </dd>
384 </dl><a NAME="Function.setEndLine" ID="Function.setEndLine"></a>
385 <h4>Function.setEndLine</h4>
386 <b>setEndLine</b>(<i>endLineNo</i>)
387 <p>
388 Public method to record the number of the last line of a class.
389 </p><dl>
390 <dt><i>endLineNo</i></dt>
391 <dd>
392 number of the last line (integer)
393 </dd>
394 </dl>
395 <div align="right"><a href="#top">Up</a></div>
396 <hr /><hr />
397 <a NAME="Module" ID="Module"></a>
398 <h2>Module</h2>
399 <p>
400 Class to represent a Python module.
401 </p>
402 <h3>Derived from</h3>
403 object
404 <h3>Class Attributes</h3>
405 <table>
406 <tr><td>None</td></tr>
407 </table>
408 <h3>Class Methods</h3>
409 <table>
410 <tr><td>None</td></tr>
411 </table>
412 <h3>Methods</h3>
413 <table>
414 <tr>
415 <td><a href="#Module.__init__">Module</a></td>
416 <td>Constructor</td>
417 </tr><tr>
418 <td><a href="#Module.__py_scan">__py_scan</a></td>
419 <td>Private method to scan the source text of a Python module and retrieve the relevant information.</td>
420 </tr><tr>
421 <td><a href="#Module.__py_setVisibility">__py_setVisibility</a></td>
422 <td>Private method to set the visibility of an object.</td>
423 </tr><tr>
424 <td><a href="#Module.__rb_scan">__rb_scan</a></td>
425 <td>Private method to scan the source text of a Python module and retrieve the relevant information.</td>
426 </tr><tr>
427 <td><a href="#Module.addClass">addClass</a></td>
428 <td>Public method to add information about a class.</td>
429 </tr><tr>
430 <td><a href="#Module.addDescription">addDescription</a></td>
431 <td>Public method to store the modules docstring.</td>
432 </tr><tr>
433 <td><a href="#Module.addFunction">addFunction</a></td>
434 <td>Public method to add information about a function.</td>
435 </tr><tr>
436 <td><a href="#Module.addGlobal">addGlobal</a></td>
437 <td>Public method to add information about global variables.</td>
438 </tr><tr>
439 <td><a href="#Module.addModule">addModule</a></td>
440 <td>Public method to add information about a Ruby module.</td>
441 </tr><tr>
442 <td><a href="#Module.addPathToHierarchy">addPathToHierarchy</a></td>
443 <td>Public method to put the exhausted path into the result dictionary.</td>
444 </tr><tr>
445 <td><a href="#Module.assembleHierarchy">assembleHierarchy</a></td>
446 <td>Public method to assemble the inheritance hierarchy.</td>
447 </tr><tr>
448 <td><a href="#Module.createHierarchy">createHierarchy</a></td>
449 <td>Public method to build the inheritance hierarchy for all classes of this module.</td>
450 </tr><tr>
451 <td><a href="#Module.getFileName">getFileName</a></td>
452 <td>Public method to retrieve the modules filename.</td>
453 </tr><tr>
454 <td><a href="#Module.getName">getName</a></td>
455 <td>Public method to retrieve the modules name.</td>
456 </tr><tr>
457 <td><a href="#Module.getType">getType</a></td>
458 <td>Public method to get the type of the module's source.</td>
459 </tr><tr>
460 <td><a href="#Module.scan">scan</a></td>
461 <td>Public method to scan the source text and retrieve the relevant information.</td>
462 </tr>
463 </table>
464 <h3>Static Methods</h3>
465 <table>
466 <tr><td>None</td></tr>
467 </table>
468 <a NAME="Module.__init__" ID="Module.__init__"></a>
469 <h4>Module (Constructor)</h4>
470 <b>Module</b>(<i>name, file=None, moduleType=None</i>)
471 <p>
472 Constructor
473 </p><dl>
474 <dt><i>name</i></dt>
475 <dd>
476 name of this module (string)
477 </dd><dt><i>file</i></dt>
478 <dd>
479 filename of file containing this module (string)
480 </dd><dt><i>moduleType</i></dt>
481 <dd>
482 type of this module
483 </dd>
484 </dl><a NAME="Module.__py_scan" ID="Module.__py_scan"></a>
485 <h4>Module.__py_scan</h4>
486 <b>__py_scan</b>(<i>src</i>)
487 <p>
488 Private method to scan the source text of a Python module and retrieve
489 the relevant information.
490 </p><dl>
491 <dt><i>src</i></dt>
492 <dd>
493 the source text to be scanned (string)
494 </dd>
495 </dl><a NAME="Module.__py_setVisibility" ID="Module.__py_setVisibility"></a>
496 <h4>Module.__py_setVisibility</h4>
497 <b>__py_setVisibility</b>(<i>objectRef</i>)
498 <p>
499 Private method to set the visibility of an object.
500 </p><dl>
501 <dt><i>objectRef</i></dt>
502 <dd>
503 reference to the object (Attribute, Class or Function)
504 </dd>
505 </dl><a NAME="Module.__rb_scan" ID="Module.__rb_scan"></a>
506 <h4>Module.__rb_scan</h4>
507 <b>__rb_scan</b>(<i>src</i>)
508 <p>
509 Private method to scan the source text of a Python module and retrieve
510 the relevant information.
511 </p><dl>
512 <dt><i>src</i></dt>
513 <dd>
514 the source text to be scanned (string)
515 </dd>
516 </dl><a NAME="Module.addClass" ID="Module.addClass"></a>
517 <h4>Module.addClass</h4>
518 <b>addClass</b>(<i>name, _class</i>)
519 <p>
520 Public method to add information about a class.
521 </p><dl>
522 <dt><i>name</i></dt>
523 <dd>
524 name of class to be added (string)
525 </dd><dt><i>_class</i></dt>
526 <dd>
527 Class object to be added
528 </dd>
529 </dl><a NAME="Module.addDescription" ID="Module.addDescription"></a>
530 <h4>Module.addDescription</h4>
531 <b>addDescription</b>(<i>description</i>)
532 <p>
533 Public method to store the modules docstring.
534 </p><dl>
535 <dt><i>description</i></dt>
536 <dd>
537 the docstring to be stored (string)
538 </dd>
539 </dl><a NAME="Module.addFunction" ID="Module.addFunction"></a>
540 <h4>Module.addFunction</h4>
541 <b>addFunction</b>(<i>name, function</i>)
542 <p>
543 Public method to add information about a function.
544 </p><dl>
545 <dt><i>name</i></dt>
546 <dd>
547 name of function to be added (string)
548 </dd><dt><i>function</i></dt>
549 <dd>
550 Function object to be added
551 </dd>
552 </dl><a NAME="Module.addGlobal" ID="Module.addGlobal"></a>
553 <h4>Module.addGlobal</h4>
554 <b>addGlobal</b>(<i>name, attr</i>)
555 <p>
556 Public method to add information about global variables.
557 </p><dl>
558 <dt><i>name</i></dt>
559 <dd>
560 name of the global to add (string)
561 </dd><dt><i>attr</i></dt>
562 <dd>
563 Attribute object to be added
564 </dd>
565 </dl><a NAME="Module.addModule" ID="Module.addModule"></a>
566 <h4>Module.addModule</h4>
567 <b>addModule</b>(<i>name, module</i>)
568 <p>
569 Public method to add information about a Ruby module.
570 </p><dl>
571 <dt><i>name</i></dt>
572 <dd>
573 name of module to be added (string)
574 </dd><dt><i>module</i></dt>
575 <dd>
576 Module object to be added
577 </dd>
578 </dl><a NAME="Module.addPathToHierarchy" ID="Module.addPathToHierarchy"></a>
579 <h4>Module.addPathToHierarchy</h4>
580 <b>addPathToHierarchy</b>(<i>path, result, fn</i>)
581 <p>
582 Public method to put the exhausted path into the result dictionary.
583 </p><dl>
584 <dt><i>path</i></dt>
585 <dd>
586 the exhausted path of classes
587 </dd><dt><i>result</i></dt>
588 <dd>
589 the result dictionary
590 </dd><dt><i>fn</i></dt>
591 <dd>
592 function to call for classe that are already part of the
593 result dictionary
594 </dd>
595 </dl><a NAME="Module.assembleHierarchy" ID="Module.assembleHierarchy"></a>
596 <h4>Module.assembleHierarchy</h4>
597 <b>assembleHierarchy</b>(<i>name, classes, path, result</i>)
598 <p>
599 Public method to assemble the inheritance hierarchy.
600 </p><p>
601 This method will traverse the class hierarchy, from a given class
602 and build up a nested dictionary of super-classes. The result is
603 intended to be inverted, i.e. the highest level are the super classes.
604 </p><p>
605 This code is borrowed from Boa Constructor.
606 </p><dl>
607 <dt><i>name</i></dt>
608 <dd>
609 name of class to assemble hierarchy (string)
610 </dd><dt><i>classes</i></dt>
611 <dd>
612 A dictionary of classes to look in.
613 </dd><dt><i>path</i></dt>
614 <dd>
615
616 </dd><dt><i>result</i></dt>
617 <dd>
618 The resultant hierarchy
619 </dd>
620 </dl><a NAME="Module.createHierarchy" ID="Module.createHierarchy"></a>
621 <h4>Module.createHierarchy</h4>
622 <b>createHierarchy</b>(<i></i>)
623 <p>
624 Public method to build the inheritance hierarchy for all classes of
625 this module.
626 </p><dl>
627 <dt>Returns:</dt>
628 <dd>
629 A dictionary with inheritance hierarchies.
630 </dd>
631 </dl><a NAME="Module.getFileName" ID="Module.getFileName"></a>
632 <h4>Module.getFileName</h4>
633 <b>getFileName</b>(<i></i>)
634 <p>
635 Public method to retrieve the modules filename.
636 </p><dl>
637 <dt>Returns:</dt>
638 <dd>
639 module filename (string)
640 </dd>
641 </dl><a NAME="Module.getName" ID="Module.getName"></a>
642 <h4>Module.getName</h4>
643 <b>getName</b>(<i></i>)
644 <p>
645 Public method to retrieve the modules name.
646 </p><dl>
647 <dt>Returns:</dt>
648 <dd>
649 module name (string)
650 </dd>
651 </dl><a NAME="Module.getType" ID="Module.getType"></a>
652 <h4>Module.getType</h4>
653 <b>getType</b>(<i></i>)
654 <p>
655 Public method to get the type of the module's source.
656 </p><dl>
657 <dt>Returns:</dt>
658 <dd>
659 type of the modules's source (string)
660 </dd>
661 </dl><a NAME="Module.scan" ID="Module.scan"></a>
662 <h4>Module.scan</h4>
663 <b>scan</b>(<i>src</i>)
664 <p>
665 Public method to scan the source text and retrieve the relevant
666 information.
667 </p><dl>
668 <dt><i>src</i></dt>
669 <dd>
670 the source text to be scanned (string)
671 </dd>
672 </dl>
673 <div align="right"><a href="#top">Up</a></div>
674 <hr /><hr />
675 <a NAME="RbModule" ID="RbModule"></a>
676 <h2>RbModule</h2>
677 <p>
678 Class to represent a Ruby module.
679 </p>
680 <h3>Derived from</h3>
681 Class
682 <h3>Class Attributes</h3>
683 <table>
684 <tr><td>None</td></tr>
685 </table>
686 <h3>Class Methods</h3>
687 <table>
688 <tr><td>None</td></tr>
689 </table>
690 <h3>Methods</h3>
691 <table>
692 <tr>
693 <td><a href="#RbModule.__init__">RbModule</a></td>
694 <td>Constructor</td>
695 </tr><tr>
696 <td><a href="#RbModule.addClass">addClass</a></td>
697 <td>Public method to add information about a class.</td>
698 </tr>
699 </table>
700 <h3>Static Methods</h3>
701 <table>
702 <tr><td>None</td></tr>
703 </table>
704 <a NAME="RbModule.__init__" ID="RbModule.__init__"></a>
705 <h4>RbModule (Constructor)</h4>
706 <b>RbModule</b>(<i>module, name, file, lineno</i>)
707 <p>
708 Constructor
709 </p><dl>
710 <dt><i>module</i></dt>
711 <dd>
712 name of module containing this class (string)
713 </dd><dt><i>name</i></dt>
714 <dd>
715 name of the class (string)
716 </dd><dt><i>file</i></dt>
717 <dd>
718 name of file containing this class (string)
719 </dd><dt><i>lineno</i></dt>
720 <dd>
721 linenumber of the class definition (integer)
722 </dd>
723 </dl><a NAME="RbModule.addClass" ID="RbModule.addClass"></a>
724 <h4>RbModule.addClass</h4>
725 <b>addClass</b>(<i>name, _class</i>)
726 <p>
727 Public method to add information about a class.
728 </p><dl>
729 <dt><i>name</i></dt>
730 <dd>
731 name of class to be added (string)
732 </dd><dt><i>_class</i></dt>
733 <dd>
734 Class object to be added
735 </dd>
736 </dl>
737 <div align="right"><a href="#top">Up</a></div>
738 <hr /><hr />
739 <a NAME="VisibilityBase" ID="VisibilityBase"></a>
740 <h2>VisibilityBase</h2>
741 <p>
742 Class implementing the visibility aspect of all objects.
743 </p>
744 <h3>Derived from</h3>
745 object
746 <h3>Class Attributes</h3>
747 <table>
748 <tr><td>None</td></tr>
749 </table>
750 <h3>Class Methods</h3>
751 <table>
752 <tr><td>None</td></tr>
753 </table>
754 <h3>Methods</h3>
755 <table>
756 <tr>
757 <td><a href="#VisibilityBase.isPrivate">isPrivate</a></td>
758 <td>Public method to check, if the visibility is Private.</td>
759 </tr><tr>
760 <td><a href="#VisibilityBase.isProtected">isProtected</a></td>
761 <td>Public method to check, if the visibility is Protected.</td>
762 </tr><tr>
763 <td><a href="#VisibilityBase.isPublic">isPublic</a></td>
764 <td>Public method to check, if the visibility is Public.</td>
765 </tr><tr>
766 <td><a href="#VisibilityBase.setPrivate">setPrivate</a></td>
767 <td>Public method to set the visibility to Private.</td>
768 </tr><tr>
769 <td><a href="#VisibilityBase.setProtected">setProtected</a></td>
770 <td>Public method to set the visibility to Protected.</td>
771 </tr><tr>
772 <td><a href="#VisibilityBase.setPublic">setPublic</a></td>
773 <td>Public method to set the visibility to Public.</td>
774 </tr>
775 </table>
776 <h3>Static Methods</h3>
777 <table>
778 <tr><td>None</td></tr>
779 </table>
780 <a NAME="VisibilityBase.isPrivate" ID="VisibilityBase.isPrivate"></a>
781 <h4>VisibilityBase.isPrivate</h4>
782 <b>isPrivate</b>(<i></i>)
783 <p>
784 Public method to check, if the visibility is Private.
785 </p><dl>
786 <dt>Returns:</dt>
787 <dd>
788 flag indicating Private visibility (boolean)
789 </dd>
790 </dl><a NAME="VisibilityBase.isProtected" ID="VisibilityBase.isProtected"></a>
791 <h4>VisibilityBase.isProtected</h4>
792 <b>isProtected</b>(<i></i>)
793 <p>
794 Public method to check, if the visibility is Protected.
795 </p><dl>
796 <dt>Returns:</dt>
797 <dd>
798 flag indicating Protected visibility (boolean)
799 </dd>
800 </dl><a NAME="VisibilityBase.isPublic" ID="VisibilityBase.isPublic"></a>
801 <h4>VisibilityBase.isPublic</h4>
802 <b>isPublic</b>(<i></i>)
803 <p>
804 Public method to check, if the visibility is Public.
805 </p><dl>
806 <dt>Returns:</dt>
807 <dd>
808 flag indicating Public visibility (boolean)
809 </dd>
810 </dl><a NAME="VisibilityBase.setPrivate" ID="VisibilityBase.setPrivate"></a>
811 <h4>VisibilityBase.setPrivate</h4>
812 <b>setPrivate</b>(<i></i>)
813 <p>
814 Public method to set the visibility to Private.
815 </p><a NAME="VisibilityBase.setProtected" ID="VisibilityBase.setProtected"></a>
816 <h4>VisibilityBase.setProtected</h4>
817 <b>setProtected</b>(<i></i>)
818 <p>
819 Public method to set the visibility to Protected.
820 </p><a NAME="VisibilityBase.setPublic" ID="VisibilityBase.setPublic"></a>
821 <h4>VisibilityBase.setPublic</h4>
822 <b>setPublic</b>(<i></i>)
823 <p>
824 Public method to set the visibility to Public.
825 </p>
826 <div align="right"><a href="#top">Up</a></div>
827 <hr /><hr />
828 <a NAME="_indent" ID="_indent"></a>
829 <h2>_indent</h2>
830 <b>_indent</b>(<i>ws</i>)
831 <p>
832 Protected function to determine the indent width of a whitespace string.
833 </p><dl>
834 <dt><i>ws</i></dt>
835 <dd>
836 The whitespace string to be cheked. (string)
837 </dd>
838 </dl><dl>
839 <dt>Returns:</dt>
840 <dd>
841 Length of the whitespace string after tab expansion.
842 </dd>
843 </dl>
844 <div align="right"><a href="#top">Up</a></div>
845 <hr /><hr />
846 <a NAME="find_module" ID="find_module"></a>
847 <h2>find_module</h2>
848 <b>find_module</b>(<i>name, path, extensions</i>)
849 <p>
850 Module function to extend the Python module finding mechanism.
851 </p><p>
852 This function searches for files in the given path. If the filename
853 doesn't have an extension or an extension of .py, the normal search
854 implemented in the imp module is used. For all other supported files
855 only path is searched.
856 </p><dl>
857 <dt><i>name</i></dt>
858 <dd>
859 filename or modulename to search for (string)
860 </dd><dt><i>path</i></dt>
861 <dd>
862 search path (list of strings)
863 </dd><dt><i>extensions</i></dt>
864 <dd>
865 list of extensions, which should be considered valid
866 source file extensions (list of strings)
867 </dd>
868 </dl><dl>
869 <dt>Returns:</dt>
870 <dd>
871 tuple of the open file, pathname and description. Description
872 is a tuple of file suffix, file mode and file type)
873 </dd>
874 </dl><dl>
875 <dt>Raises <b>ImportError</b>:</dt>
876 <dd>
877 The file or module wasn't found.
878 </dd>
879 </dl>
880 <div align="right"><a href="#top">Up</a></div>
881 <hr /><hr />
882 <a NAME="getTypeFromTypeName" ID="getTypeFromTypeName"></a>
883 <h2>getTypeFromTypeName</h2>
884 <b>getTypeFromTypeName</b>(<i>name</i>)
885 <p>
886 Module function to determine the module type given the module type name.
887 </p><dl>
888 <dt><i>name</i></dt>
889 <dd>
890 module type name (string)
891 </dd>
892 </dl><dl>
893 <dt>Returns:</dt>
894 <dd>
895 module type or -1 for failure (integer)
896 </dd>
897 </dl>
898 <div align="right"><a href="#top">Up</a></div>
899 <hr /><hr />
900 <a NAME="readModule" ID="readModule"></a>
901 <h2>readModule</h2>
902 <b>readModule</b>(<i>module, path=None, inpackage=False, basename="", extensions=None, caching=True</i>)
903 <p>
904 Function to read a module file and parse it.
905 </p><p>
906 The module is searched in path and sys.path, read and parsed.
907 If the module was parsed before, the information is taken
908 from a cache in order to speed up processing.
909 </p><dl>
910 <dt><i>module</i></dt>
911 <dd>
912 name of the module to be parsed (string)
913 </dd><dt><i>path</i></dt>
914 <dd>
915 search path for the module (list of strings)
916 </dd><dt><i>inpackage</i></dt>
917 <dd>
918 flag indicating that module is inside a
919 package (boolean)
920 </dd><dt><i>basename</i></dt>
921 <dd>
922 a path basename that is deleted from the filename of
923 the module file to be read (string)
924 </dd><dt><i>extensions</i></dt>
925 <dd>
926 list of extensions, which should be considered valid
927 source file extensions (list of strings)
928 </dd><dt><i>caching</i></dt>
929 <dd>
930 flag indicating that the parsed module should be
931 cached (boolean)
932 </dd>
933 </dl><dl>
934 <dt>Returns:</dt>
935 <dd>
936 reference to a Module object containing the parsed
937 module information (Module)
938 </dd>
939 </dl>
940 <div align="right"><a href="#top">Up</a></div>
941 <hr /><hr />
942 <a NAME="resetParsedModule" ID="resetParsedModule"></a>
943 <h2>resetParsedModule</h2>
944 <b>resetParsedModule</b>(<i>module, basename=""</i>)
945 <p>
946 Module function to clear one module from the list of parsed modules.
947 </p><dl>
948 <dt><i>module</i></dt>
949 <dd>
950 Name of the module to be parsed (string)
951 </dd><dt><i>basename</i></dt>
952 <dd>
953 a path basename. This basename is deleted from
954 the filename of the module file to be cleared. (string)
955 </dd>
956 </dl>
957 <div align="right"><a href="#top">Up</a></div>
958 <hr /><hr />
959 <a NAME="resetParsedModules" ID="resetParsedModules"></a>
960 <h2>resetParsedModules</h2>
961 <b>resetParsedModules</b>(<i></i>)
962 <p>
963 Module function to reset the list of modules already parsed.
964 </p>
965 <div align="right"><a href="#top">Up</a></div>
966 <hr />
967 </body></html>

eric ide

mercurial