src/eric7/Documentation/Source/eric7.Utilities.ClassBrowsers.pyclbr.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8596
d64760b2da50
child 9236
db53a9efe7ef
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Utilities.ClassBrowsers.pyclbr</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.Utilities.ClassBrowsers.pyclbr</h1>
10
11 <p>
12 Parse a Python file and retrieve classes, functions/methods and attributes.
13 </p>
14 <p>
15 Parse enough of a Python file to recognize class and method definitions and
16 to find out the superclasses of a class as well as its attributes.
17 </p>
18 <h3>Global Attributes</h3>
19
20 <table>
21 <tr><td>SUPPORTED_TYPES</td></tr><tr><td>TABWIDTH</td></tr><tr><td>_commentsub</td></tr><tr><td>_getnext</td></tr><tr><td>_modules</td></tr>
22 </table>
23 <h3>Classes</h3>
24
25 <table>
26
27 <tr>
28 <td><a href="#Attribute">Attribute</a></td>
29 <td>Class to represent a class attribute.</td>
30 </tr>
31 <tr>
32 <td><a href="#Class">Class</a></td>
33 <td>Class to represent a Python class.</td>
34 </tr>
35 <tr>
36 <td><a href="#Function">Function</a></td>
37 <td>Class to represent a Python function.</td>
38 </tr>
39 <tr>
40 <td><a href="#ImportedModule">ImportedModule</a></td>
41 <td>Class to represent an imported module.</td>
42 </tr>
43 <tr>
44 <td><a href="#Imports">Imports</a></td>
45 <td>Class to represent the list of imported modules.</td>
46 </tr>
47 <tr>
48 <td><a href="#Publics">Publics</a></td>
49 <td>Class to represent the list of public identifiers.</td>
50 </tr>
51 <tr>
52 <td><a href="#VisibilityMixin">VisibilityMixin</a></td>
53 <td>Mixin class implementing the notion of visibility.</td>
54 </tr>
55 </table>
56 <h3>Functions</h3>
57
58 <table>
59
60 <tr>
61 <td><a href="#_indent">_indent</a></td>
62 <td>Module function to return the indentation depth.</td>
63 </tr>
64 <tr>
65 <td><a href="#calculateEndline">calculateEndline</a></td>
66 <td>Function to calculate the end line of a class or method/function.</td>
67 </tr>
68 <tr>
69 <td><a href="#readmodule_ex">readmodule_ex</a></td>
70 <td>Read a module file and return a dictionary of classes.</td>
71 </tr>
72 <tr>
73 <td><a href="#scan">scan</a></td>
74 <td>Public method to scan the given source text.</td>
75 </tr>
76 </table>
77 <hr />
78 <hr />
79 <a NAME="Attribute" ID="Attribute"></a>
80 <h2>Attribute</h2>
81
82 <p>
83 Class to represent a class attribute.
84 </p>
85 <h3>Derived from</h3>
86 ClbrBaseClasses.Attribute, VisibilityMixin
87 <h3>Class Attributes</h3>
88
89 <table>
90 <tr><td>None</td></tr>
91 </table>
92 <h3>Class Methods</h3>
93
94 <table>
95 <tr><td>None</td></tr>
96 </table>
97 <h3>Methods</h3>
98
99 <table>
100
101 <tr>
102 <td><a href="#Attribute.__init__">Attribute</a></td>
103 <td>Constructor</td>
104 </tr>
105 </table>
106 <h3>Static Methods</h3>
107
108 <table>
109 <tr><td>None</td></tr>
110 </table>
111
112 <a NAME="Attribute.__init__" ID="Attribute.__init__"></a>
113 <h4>Attribute (Constructor)</h4>
114 <b>Attribute</b>(<i>module, name, file, lineno</i>)
115
116 <p>
117 Constructor
118 </p>
119 <dl>
120
121 <dt><i>module</i></dt>
122 <dd>
123 name of the module containing this class
124 </dd>
125 <dt><i>name</i></dt>
126 <dd>
127 name of this class
128 </dd>
129 <dt><i>file</i></dt>
130 <dd>
131 filename containing this attribute
132 </dd>
133 <dt><i>lineno</i></dt>
134 <dd>
135 linenumber of the class definition
136 </dd>
137 </dl>
138 <div align="right"><a href="#top">Up</a></div>
139 <hr />
140 <hr />
141 <a NAME="Class" ID="Class"></a>
142 <h2>Class</h2>
143
144 <p>
145 Class to represent a Python class.
146 </p>
147 <h3>Derived from</h3>
148 ClbrBaseClasses.Class, VisibilityMixin
149 <h3>Class Attributes</h3>
150
151 <table>
152 <tr><td>None</td></tr>
153 </table>
154 <h3>Class Methods</h3>
155
156 <table>
157 <tr><td>None</td></tr>
158 </table>
159 <h3>Methods</h3>
160
161 <table>
162
163 <tr>
164 <td><a href="#Class.__init__">Class</a></td>
165 <td>Constructor</td>
166 </tr>
167 </table>
168 <h3>Static Methods</h3>
169
170 <table>
171 <tr><td>None</td></tr>
172 </table>
173
174 <a NAME="Class.__init__" ID="Class.__init__"></a>
175 <h4>Class (Constructor)</h4>
176 <b>Class</b>(<i>module, name, superClasses, file, lineno</i>)
177
178 <p>
179 Constructor
180 </p>
181 <dl>
182
183 <dt><i>module</i></dt>
184 <dd>
185 name of the module containing this class
186 </dd>
187 <dt><i>name</i></dt>
188 <dd>
189 name of this class
190 </dd>
191 <dt><i>superClasses</i></dt>
192 <dd>
193 list of class names this class is inherited from
194 </dd>
195 <dt><i>file</i></dt>
196 <dd>
197 filename containing this class
198 </dd>
199 <dt><i>lineno</i></dt>
200 <dd>
201 linenumber of the class definition
202 </dd>
203 </dl>
204 <div align="right"><a href="#top">Up</a></div>
205 <hr />
206 <hr />
207 <a NAME="Function" ID="Function"></a>
208 <h2>Function</h2>
209
210 <p>
211 Class to represent a Python function.
212 </p>
213 <h3>Derived from</h3>
214 ClbrBaseClasses.Function, VisibilityMixin
215 <h3>Class Attributes</h3>
216
217 <table>
218 <tr><td>None</td></tr>
219 </table>
220 <h3>Class Methods</h3>
221
222 <table>
223 <tr><td>None</td></tr>
224 </table>
225 <h3>Methods</h3>
226
227 <table>
228
229 <tr>
230 <td><a href="#Function.__init__">Function</a></td>
231 <td>Constructor</td>
232 </tr>
233 </table>
234 <h3>Static Methods</h3>
235
236 <table>
237 <tr><td>None</td></tr>
238 </table>
239
240 <a NAME="Function.__init__" ID="Function.__init__"></a>
241 <h4>Function (Constructor)</h4>
242 <b>Function</b>(<i>module, name, file, lineno, signature='', separator=', ', modifierType=ClbrBaseClasses.Function.General, annotation=""</i>)
243
244 <p>
245 Constructor
246 </p>
247 <dl>
248
249 <dt><i>module</i></dt>
250 <dd>
251 name of the module containing this function
252 </dd>
253 <dt><i>name</i></dt>
254 <dd>
255 name of this function
256 </dd>
257 <dt><i>file</i></dt>
258 <dd>
259 filename containing this class
260 </dd>
261 <dt><i>lineno</i></dt>
262 <dd>
263 linenumber of the class definition
264 </dd>
265 <dt><i>signature</i></dt>
266 <dd>
267 parameterlist of the method
268 </dd>
269 <dt><i>separator</i></dt>
270 <dd>
271 string separating the parameters
272 </dd>
273 <dt><i>modifierType</i></dt>
274 <dd>
275 type of the function
276 </dd>
277 <dt><i>annotation</i></dt>
278 <dd>
279 return annotation
280 </dd>
281 </dl>
282 <div align="right"><a href="#top">Up</a></div>
283 <hr />
284 <hr />
285 <a NAME="ImportedModule" ID="ImportedModule"></a>
286 <h2>ImportedModule</h2>
287
288 <p>
289 Class to represent an imported module.
290 </p>
291 <h3>Derived from</h3>
292 None
293 <h3>Class Attributes</h3>
294
295 <table>
296 <tr><td>None</td></tr>
297 </table>
298 <h3>Class Methods</h3>
299
300 <table>
301 <tr><td>None</td></tr>
302 </table>
303 <h3>Methods</h3>
304
305 <table>
306
307 <tr>
308 <td><a href="#ImportedModule.__init__">ImportedModule</a></td>
309 <td>Constructor</td>
310 </tr>
311 <tr>
312 <td><a href="#ImportedModule.addImport">addImport</a></td>
313 <td>Public method to add a list of imported names.</td>
314 </tr>
315 </table>
316 <h3>Static Methods</h3>
317
318 <table>
319 <tr><td>None</td></tr>
320 </table>
321
322 <a NAME="ImportedModule.__init__" ID="ImportedModule.__init__"></a>
323 <h4>ImportedModule (Constructor)</h4>
324 <b>ImportedModule</b>(<i>module, file, importedModule</i>)
325
326 <p>
327 Constructor
328 </p>
329 <dl>
330
331 <dt><i>module</i></dt>
332 <dd>
333 name of the module containing the import (string)
334 </dd>
335 <dt><i>file</i></dt>
336 <dd>
337 file name containing the import (string)
338 </dd>
339 <dt><i>importedModule</i></dt>
340 <dd>
341 name of the imported module (string)
342 </dd>
343 </dl>
344 <a NAME="ImportedModule.addImport" ID="ImportedModule.addImport"></a>
345 <h4>ImportedModule.addImport</h4>
346 <b>addImport</b>(<i>lineno, importedNames</i>)
347
348 <p>
349 Public method to add a list of imported names.
350 </p>
351 <dl>
352
353 <dt><i>lineno</i></dt>
354 <dd>
355 line number of the import
356 </dd>
357 <dt><i>importedNames</i></dt>
358 <dd>
359 list of imported names (list of strings)
360 </dd>
361 </dl>
362 <div align="right"><a href="#top">Up</a></div>
363 <hr />
364 <hr />
365 <a NAME="Imports" ID="Imports"></a>
366 <h2>Imports</h2>
367
368 <p>
369 Class to represent the list of imported modules.
370 </p>
371 <h3>Derived from</h3>
372 None
373 <h3>Class Attributes</h3>
374
375 <table>
376 <tr><td>None</td></tr>
377 </table>
378 <h3>Class Methods</h3>
379
380 <table>
381 <tr><td>None</td></tr>
382 </table>
383 <h3>Methods</h3>
384
385 <table>
386
387 <tr>
388 <td><a href="#Imports.__init__">Imports</a></td>
389 <td>Constructor</td>
390 </tr>
391 <tr>
392 <td><a href="#Imports.addImport">addImport</a></td>
393 <td>Public method to add a list of imported names.</td>
394 </tr>
395 <tr>
396 <td><a href="#Imports.getImport">getImport</a></td>
397 <td>Public method to get an imported module item.</td>
398 </tr>
399 <tr>
400 <td><a href="#Imports.getImports">getImports</a></td>
401 <td>Public method to get all imported module names.</td>
402 </tr>
403 </table>
404 <h3>Static Methods</h3>
405
406 <table>
407 <tr><td>None</td></tr>
408 </table>
409
410 <a NAME="Imports.__init__" ID="Imports.__init__"></a>
411 <h4>Imports (Constructor)</h4>
412 <b>Imports</b>(<i>module, file</i>)
413
414 <p>
415 Constructor
416 </p>
417 <dl>
418
419 <dt><i>module</i></dt>
420 <dd>
421 name of the module containing the import (string)
422 </dd>
423 <dt><i>file</i></dt>
424 <dd>
425 file name containing the import (string)
426 </dd>
427 </dl>
428 <a NAME="Imports.addImport" ID="Imports.addImport"></a>
429 <h4>Imports.addImport</h4>
430 <b>addImport</b>(<i>moduleName, names, lineno</i>)
431
432 <p>
433 Public method to add a list of imported names.
434 </p>
435 <dl>
436
437 <dt><i>moduleName</i></dt>
438 <dd>
439 name of the imported module (string)
440 </dd>
441 <dt><i>names</i></dt>
442 <dd>
443 list of names (list of strings)
444 </dd>
445 <dt><i>lineno</i></dt>
446 <dd>
447 line number of the import
448 </dd>
449 </dl>
450 <a NAME="Imports.getImport" ID="Imports.getImport"></a>
451 <h4>Imports.getImport</h4>
452 <b>getImport</b>(<i>moduleName</i>)
453
454 <p>
455 Public method to get an imported module item.
456 </p>
457 <dl>
458
459 <dt><i>moduleName</i></dt>
460 <dd>
461 name of the imported module (string)
462 </dd>
463 </dl>
464 <dl>
465 <dt>Return:</dt>
466 <dd>
467 imported module item (ImportedModule) or None
468 </dd>
469 </dl>
470 <a NAME="Imports.getImports" ID="Imports.getImports"></a>
471 <h4>Imports.getImports</h4>
472 <b>getImports</b>(<i></i>)
473
474 <p>
475 Public method to get all imported module names.
476 </p>
477 <dl>
478 <dt>Return:</dt>
479 <dd>
480 dictionary of imported module names with name as key and list
481 of line numbers of imports as value
482 </dd>
483 </dl>
484 <div align="right"><a href="#top">Up</a></div>
485 <hr />
486 <hr />
487 <a NAME="Publics" ID="Publics"></a>
488 <h2>Publics</h2>
489
490 <p>
491 Class to represent the list of public identifiers.
492 </p>
493 <h3>Derived from</h3>
494 None
495 <h3>Class Attributes</h3>
496
497 <table>
498 <tr><td>None</td></tr>
499 </table>
500 <h3>Class Methods</h3>
501
502 <table>
503 <tr><td>None</td></tr>
504 </table>
505 <h3>Methods</h3>
506
507 <table>
508
509 <tr>
510 <td><a href="#Publics.__init__">Publics</a></td>
511 <td>Constructor</td>
512 </tr>
513 </table>
514 <h3>Static Methods</h3>
515
516 <table>
517 <tr><td>None</td></tr>
518 </table>
519
520 <a NAME="Publics.__init__" ID="Publics.__init__"></a>
521 <h4>Publics (Constructor)</h4>
522 <b>Publics</b>(<i>module, file, lineno, idents</i>)
523
524 <p>
525 Constructor
526 </p>
527 <dl>
528
529 <dt><i>module</i></dt>
530 <dd>
531 name of the module containing this function
532 </dd>
533 <dt><i>file</i></dt>
534 <dd>
535 filename containing this class
536 </dd>
537 <dt><i>lineno</i></dt>
538 <dd>
539 linenumber of the class definition
540 </dd>
541 <dt><i>idents</i></dt>
542 <dd>
543 list of public identifiers
544 </dd>
545 </dl>
546 <div align="right"><a href="#top">Up</a></div>
547 <hr />
548 <hr />
549 <a NAME="VisibilityMixin" ID="VisibilityMixin"></a>
550 <h2>VisibilityMixin</h2>
551
552 <p>
553 Mixin class implementing the notion of visibility.
554 </p>
555 <h3>Derived from</h3>
556 ClbrBaseClasses.ClbrVisibilityMixinBase
557 <h3>Class Attributes</h3>
558
559 <table>
560 <tr><td>None</td></tr>
561 </table>
562 <h3>Class Methods</h3>
563
564 <table>
565 <tr><td>None</td></tr>
566 </table>
567 <h3>Methods</h3>
568
569 <table>
570
571 <tr>
572 <td><a href="#VisibilityMixin.__init__">VisibilityMixin</a></td>
573 <td>Constructor</td>
574 </tr>
575 </table>
576 <h3>Static Methods</h3>
577
578 <table>
579 <tr><td>None</td></tr>
580 </table>
581
582 <a NAME="VisibilityMixin.__init__" ID="VisibilityMixin.__init__"></a>
583 <h4>VisibilityMixin (Constructor)</h4>
584 <b>VisibilityMixin</b>(<i></i>)
585
586 <p>
587 Constructor
588 </p>
589 <div align="right"><a href="#top">Up</a></div>
590 <hr />
591 <hr />
592 <a NAME="_indent" ID="_indent"></a>
593 <h2>_indent</h2>
594 <b>_indent</b>(<i>ws</i>)
595
596 <p>
597 Module function to return the indentation depth.
598 </p>
599 <dl>
600
601 <dt><i>ws</i></dt>
602 <dd>
603 the whitespace to be checked (string)
604 </dd>
605 </dl>
606 <dl>
607 <dt>Return:</dt>
608 <dd>
609 length of the whitespace string (integer)
610 </dd>
611 </dl>
612 <div align="right"><a href="#top">Up</a></div>
613 <hr />
614 <hr />
615 <a NAME="calculateEndline" ID="calculateEndline"></a>
616 <h2>calculateEndline</h2>
617 <b>calculateEndline</b>(<i>lineno, lines, indent</i>)
618
619 <p>
620 Function to calculate the end line of a class or method/function.
621 </p>
622 <dl>
623
624 <dt><i>lineno</i> (int)</dt>
625 <dd>
626 line number to start at (one based)
627 </dd>
628 <dt><i>lines</i> (list of str)</dt>
629 <dd>
630 list of source lines
631 </dd>
632 <dt><i>indent</i> (int)</dt>
633 <dd>
634 indent length the class/method/function definition
635 </dd>
636 </dl>
637 <dl>
638 <dt>Return:</dt>
639 <dd>
640 end line of the class/method/function (one based)
641 </dd>
642 </dl>
643 <dl>
644 <dt>Return Type:</dt>
645 <dd>
646 int
647 </dd>
648 </dl>
649 <div align="right"><a href="#top">Up</a></div>
650 <hr />
651 <hr />
652 <a NAME="readmodule_ex" ID="readmodule_ex"></a>
653 <h2>readmodule_ex</h2>
654 <b>readmodule_ex</b>(<i>module, path=None, inpackage=False, isPyFile=False</i>)
655
656 <p>
657 Read a module file and return a dictionary of classes.
658 </p>
659 <p>
660 Search for MODULE in PATH and sys.path, read and parse the
661 module and return a dictionary with one entry for each class
662 found in the module.
663 </p>
664 <dl>
665
666 <dt><i>module</i> (str)</dt>
667 <dd>
668 name of the module file
669 </dd>
670 <dt><i>path</i> (list of str)</dt>
671 <dd>
672 path the module should be searched in
673 </dd>
674 <dt><i>inpackage</i> (bool)</dt>
675 <dd>
676 flag indicating a module inside a package is scanned
677 </dd>
678 <dt><i>isPyFile</i> (bool)</dt>
679 <dd>
680 flag indicating a Python file
681 </dd>
682 </dl>
683 <dl>
684 <dt>Return:</dt>
685 <dd>
686 the resulting dictionary
687 </dd>
688 </dl>
689 <dl>
690 <dt>Return Type:</dt>
691 <dd>
692 dict
693 </dd>
694 </dl>
695 <div align="right"><a href="#top">Up</a></div>
696 <hr />
697 <hr />
698 <a NAME="scan" ID="scan"></a>
699 <h2>scan</h2>
700 <b>scan</b>(<i>src, file, module</i>)
701
702 <p>
703 Public method to scan the given source text.
704 </p>
705 <dl>
706
707 <dt><i>src</i> (str)</dt>
708 <dd>
709 source text to be scanned
710 </dd>
711 <dt><i>file</i> (str)</dt>
712 <dd>
713 file name associated with the source text
714 </dd>
715 <dt><i>module</i> (str)</dt>
716 <dd>
717 module name associated with the source text
718 </dd>
719 </dl>
720 <dl>
721 <dt>Return:</dt>
722 <dd>
723 dictionary containing the extracted data
724 </dd>
725 </dl>
726 <dl>
727 <dt>Return Type:</dt>
728 <dd>
729 dict
730 </dd>
731 </dl>
732 <div align="right"><a href="#top">Up</a></div>
733 <hr />
734 </body></html>

eric ide

mercurial