eric6/Documentation/Source/eric6.Utilities.ClassBrowsers.pyclbr.html

changeset 6942
2602857055c5
parent 5651
982465f8389c
child 7273
391d6b7b1eff
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.Utilities.ClassBrowsers.pyclbr</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.ClassBrowsers.pyclbr</h1>
23 <p>
24 Parse a Python file and retrieve classes, functions/methods and attributes.
25 </p><p>
26 Parse enough of a Python file to recognize class and method definitions and
27 to find out the superclasses of a class as well as its attributes.
28 </p><p>
29 This is module is based on pyclbr found in the Python 2.2.2 distribution.
30 </p>
31 <h3>Global Attributes</h3>
32 <table>
33 <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>
34 </table>
35 <h3>Classes</h3>
36 <table>
37 <tr>
38 <td><a href="#Attribute">Attribute</a></td>
39 <td>Class to represent a class attribute.</td>
40 </tr><tr>
41 <td><a href="#Class">Class</a></td>
42 <td>Class to represent a Python class.</td>
43 </tr><tr>
44 <td><a href="#Function">Function</a></td>
45 <td>Class to represent a Python function.</td>
46 </tr><tr>
47 <td><a href="#ImportedModule">ImportedModule</a></td>
48 <td>Class to represent an imported module.</td>
49 </tr><tr>
50 <td><a href="#Imports">Imports</a></td>
51 <td>Class to represent the list of imported modules.</td>
52 </tr><tr>
53 <td><a href="#Publics">Publics</a></td>
54 <td>Class to represent the list of public identifiers.</td>
55 </tr><tr>
56 <td><a href="#VisibilityMixin">VisibilityMixin</a></td>
57 <td>Mixin class implementing the notion of visibility.</td>
58 </tr>
59 </table>
60 <h3>Functions</h3>
61 <table>
62 <tr>
63 <td><a href="#_indent">_indent</a></td>
64 <td>Module function to return the indentation depth.</td>
65 </tr><tr>
66 <td><a href="#readmodule_ex">readmodule_ex</a></td>
67 <td>Read a module file and return a dictionary of classes.</td>
68 </tr>
69 </table>
70 <hr /><hr />
71 <a NAME="Attribute" ID="Attribute"></a>
72 <h2>Attribute</h2>
73 <p>
74 Class to represent a class attribute.
75 </p>
76 <h3>Derived from</h3>
77 ClbrBaseClasses.Attribute, VisibilityMixin
78 <h3>Class Attributes</h3>
79 <table>
80 <tr><td>None</td></tr>
81 </table>
82 <h3>Class Methods</h3>
83 <table>
84 <tr><td>None</td></tr>
85 </table>
86 <h3>Methods</h3>
87 <table>
88 <tr>
89 <td><a href="#Attribute.__init__">Attribute</a></td>
90 <td>Constructor</td>
91 </tr>
92 </table>
93 <h3>Static Methods</h3>
94 <table>
95 <tr><td>None</td></tr>
96 </table>
97 <a NAME="Attribute.__init__" ID="Attribute.__init__"></a>
98 <h4>Attribute (Constructor)</h4>
99 <b>Attribute</b>(<i>module, name, file, lineno</i>)
100 <p>
101 Constructor
102 </p><dl>
103 <dt><i>module</i></dt>
104 <dd>
105 name of the module containing this class
106 </dd><dt><i>name</i></dt>
107 <dd>
108 name of this class
109 </dd><dt><i>file</i></dt>
110 <dd>
111 filename containing this attribute
112 </dd><dt><i>lineno</i></dt>
113 <dd>
114 linenumber of the class definition
115 </dd>
116 </dl>
117 <div align="right"><a href="#top">Up</a></div>
118 <hr /><hr />
119 <a NAME="Class" ID="Class"></a>
120 <h2>Class</h2>
121 <p>
122 Class to represent a Python class.
123 </p>
124 <h3>Derived from</h3>
125 ClbrBaseClasses.Class, VisibilityMixin
126 <h3>Class Attributes</h3>
127 <table>
128 <tr><td>None</td></tr>
129 </table>
130 <h3>Class Methods</h3>
131 <table>
132 <tr><td>None</td></tr>
133 </table>
134 <h3>Methods</h3>
135 <table>
136 <tr>
137 <td><a href="#Class.__init__">Class</a></td>
138 <td>Constructor</td>
139 </tr>
140 </table>
141 <h3>Static Methods</h3>
142 <table>
143 <tr><td>None</td></tr>
144 </table>
145 <a NAME="Class.__init__" ID="Class.__init__"></a>
146 <h4>Class (Constructor)</h4>
147 <b>Class</b>(<i>module, name, superClasses, file, lineno</i>)
148 <p>
149 Constructor
150 </p><dl>
151 <dt><i>module</i></dt>
152 <dd>
153 name of the module containing this class
154 </dd><dt><i>name</i></dt>
155 <dd>
156 name of this class
157 </dd><dt><i>superClasses</i></dt>
158 <dd>
159 list of class names this class is inherited from
160 </dd><dt><i>file</i></dt>
161 <dd>
162 filename containing this class
163 </dd><dt><i>lineno</i></dt>
164 <dd>
165 linenumber of the class definition
166 </dd>
167 </dl>
168 <div align="right"><a href="#top">Up</a></div>
169 <hr /><hr />
170 <a NAME="Function" ID="Function"></a>
171 <h2>Function</h2>
172 <p>
173 Class to represent a Python function.
174 </p>
175 <h3>Derived from</h3>
176 ClbrBaseClasses.Function, VisibilityMixin
177 <h3>Class Attributes</h3>
178 <table>
179 <tr><td>None</td></tr>
180 </table>
181 <h3>Class Methods</h3>
182 <table>
183 <tr><td>None</td></tr>
184 </table>
185 <h3>Methods</h3>
186 <table>
187 <tr>
188 <td><a href="#Function.__init__">Function</a></td>
189 <td>Constructor</td>
190 </tr>
191 </table>
192 <h3>Static Methods</h3>
193 <table>
194 <tr><td>None</td></tr>
195 </table>
196 <a NAME="Function.__init__" ID="Function.__init__"></a>
197 <h4>Function (Constructor)</h4>
198 <b>Function</b>(<i>module, name, file, lineno, signature='', separator=', ', modifierType=ClbrBaseClasses.Function.General, annotation=""</i>)
199 <p>
200 Constructor
201 </p><dl>
202 <dt><i>module</i></dt>
203 <dd>
204 name of the module containing this function
205 </dd><dt><i>name</i></dt>
206 <dd>
207 name of this function
208 </dd><dt><i>file</i></dt>
209 <dd>
210 filename containing this class
211 </dd><dt><i>lineno</i></dt>
212 <dd>
213 linenumber of the class definition
214 </dd><dt><i>signature</i></dt>
215 <dd>
216 parameterlist of the method
217 </dd><dt><i>separator</i></dt>
218 <dd>
219 string separating the parameters
220 </dd><dt><i>modifierType</i></dt>
221 <dd>
222 type of the function
223 </dd><dt><i>annotation</i></dt>
224 <dd>
225 return annotation
226 </dd>
227 </dl>
228 <div align="right"><a href="#top">Up</a></div>
229 <hr /><hr />
230 <a NAME="ImportedModule" ID="ImportedModule"></a>
231 <h2>ImportedModule</h2>
232 <p>
233 Class to represent an imported module.
234 </p>
235 <h3>Derived from</h3>
236 object
237 <h3>Class Attributes</h3>
238 <table>
239 <tr><td>None</td></tr>
240 </table>
241 <h3>Class Methods</h3>
242 <table>
243 <tr><td>None</td></tr>
244 </table>
245 <h3>Methods</h3>
246 <table>
247 <tr>
248 <td><a href="#ImportedModule.__init__">ImportedModule</a></td>
249 <td>Constructor</td>
250 </tr><tr>
251 <td><a href="#ImportedModule.addImport">addImport</a></td>
252 <td>Public method to add a list of imported names.</td>
253 </tr>
254 </table>
255 <h3>Static Methods</h3>
256 <table>
257 <tr><td>None</td></tr>
258 </table>
259 <a NAME="ImportedModule.__init__" ID="ImportedModule.__init__"></a>
260 <h4>ImportedModule (Constructor)</h4>
261 <b>ImportedModule</b>(<i>module, file, importedModule</i>)
262 <p>
263 Constructor
264 </p><dl>
265 <dt><i>module</i></dt>
266 <dd>
267 name of the module containing the import (string)
268 </dd><dt><i>file</i></dt>
269 <dd>
270 file name containing the import (string)
271 </dd><dt><i>importedModule</i></dt>
272 <dd>
273 name of the imported module (string)
274 </dd>
275 </dl><a NAME="ImportedModule.addImport" ID="ImportedModule.addImport"></a>
276 <h4>ImportedModule.addImport</h4>
277 <b>addImport</b>(<i>lineno, importedNames</i>)
278 <p>
279 Public method to add a list of imported names.
280 </p><dl>
281 <dt><i>lineno</i></dt>
282 <dd>
283 line number of the import
284 </dd><dt><i>importedNames</i></dt>
285 <dd>
286 list of imported names (list of strings)
287 </dd>
288 </dl>
289 <div align="right"><a href="#top">Up</a></div>
290 <hr /><hr />
291 <a NAME="Imports" ID="Imports"></a>
292 <h2>Imports</h2>
293 <p>
294 Class to represent the list of imported modules.
295 </p>
296 <h3>Derived from</h3>
297 object
298 <h3>Class Attributes</h3>
299 <table>
300 <tr><td>None</td></tr>
301 </table>
302 <h3>Class Methods</h3>
303 <table>
304 <tr><td>None</td></tr>
305 </table>
306 <h3>Methods</h3>
307 <table>
308 <tr>
309 <td><a href="#Imports.__init__">Imports</a></td>
310 <td>Constructor</td>
311 </tr><tr>
312 <td><a href="#Imports.addImport">addImport</a></td>
313 <td>Public method to add a list of imported names.</td>
314 </tr><tr>
315 <td><a href="#Imports.getImport">getImport</a></td>
316 <td>Public method to get an imported module item.</td>
317 </tr><tr>
318 <td><a href="#Imports.getImports">getImports</a></td>
319 <td>Public method to get all imported module names.</td>
320 </tr>
321 </table>
322 <h3>Static Methods</h3>
323 <table>
324 <tr><td>None</td></tr>
325 </table>
326 <a NAME="Imports.__init__" ID="Imports.__init__"></a>
327 <h4>Imports (Constructor)</h4>
328 <b>Imports</b>(<i>module, file</i>)
329 <p>
330 Constructor
331 </p><dl>
332 <dt><i>module</i></dt>
333 <dd>
334 name of the module containing the import (string)
335 </dd><dt><i>file</i></dt>
336 <dd>
337 file name containing the import (string)
338 </dd>
339 </dl><a NAME="Imports.addImport" ID="Imports.addImport"></a>
340 <h4>Imports.addImport</h4>
341 <b>addImport</b>(<i>moduleName, names, lineno</i>)
342 <p>
343 Public method to add a list of imported names.
344 </p><dl>
345 <dt><i>moduleName</i></dt>
346 <dd>
347 name of the imported module (string)
348 </dd><dt><i>names</i></dt>
349 <dd>
350 list of names (list of strings)
351 </dd><dt><i>lineno</i></dt>
352 <dd>
353 line number of the import
354 </dd>
355 </dl><a NAME="Imports.getImport" ID="Imports.getImport"></a>
356 <h4>Imports.getImport</h4>
357 <b>getImport</b>(<i>moduleName</i>)
358 <p>
359 Public method to get an imported module item.
360 </p><dl>
361 <dt><i>moduleName</i></dt>
362 <dd>
363 name of the imported module (string)
364 </dd>
365 </dl><dl>
366 <dt>Returns:</dt>
367 <dd>
368 imported module item (ImportedModule) or None
369 </dd>
370 </dl><a NAME="Imports.getImports" ID="Imports.getImports"></a>
371 <h4>Imports.getImports</h4>
372 <b>getImports</b>(<i></i>)
373 <p>
374 Public method to get all imported module names.
375 </p><dl>
376 <dt>Returns:</dt>
377 <dd>
378 dictionary of imported module names with name as key and list
379 of line numbers of imports as value
380 </dd>
381 </dl>
382 <div align="right"><a href="#top">Up</a></div>
383 <hr /><hr />
384 <a NAME="Publics" ID="Publics"></a>
385 <h2>Publics</h2>
386 <p>
387 Class to represent the list of public identifiers.
388 </p>
389 <h3>Derived from</h3>
390 object
391 <h3>Class Attributes</h3>
392 <table>
393 <tr><td>None</td></tr>
394 </table>
395 <h3>Class Methods</h3>
396 <table>
397 <tr><td>None</td></tr>
398 </table>
399 <h3>Methods</h3>
400 <table>
401 <tr>
402 <td><a href="#Publics.__init__">Publics</a></td>
403 <td>Constructor</td>
404 </tr>
405 </table>
406 <h3>Static Methods</h3>
407 <table>
408 <tr><td>None</td></tr>
409 </table>
410 <a NAME="Publics.__init__" ID="Publics.__init__"></a>
411 <h4>Publics (Constructor)</h4>
412 <b>Publics</b>(<i>module, file, lineno, idents</i>)
413 <p>
414 Constructor
415 </p><dl>
416 <dt><i>module</i></dt>
417 <dd>
418 name of the module containing this function
419 </dd><dt><i>file</i></dt>
420 <dd>
421 filename containing this class
422 </dd><dt><i>lineno</i></dt>
423 <dd>
424 linenumber of the class definition
425 </dd><dt><i>idents</i></dt>
426 <dd>
427 list of public identifiers
428 </dd>
429 </dl>
430 <div align="right"><a href="#top">Up</a></div>
431 <hr /><hr />
432 <a NAME="VisibilityMixin" ID="VisibilityMixin"></a>
433 <h2>VisibilityMixin</h2>
434 <p>
435 Mixin class implementing the notion of visibility.
436 </p>
437 <h3>Derived from</h3>
438 ClbrBaseClasses.ClbrVisibilityMixinBase
439 <h3>Class Attributes</h3>
440 <table>
441 <tr><td>None</td></tr>
442 </table>
443 <h3>Class Methods</h3>
444 <table>
445 <tr><td>None</td></tr>
446 </table>
447 <h3>Methods</h3>
448 <table>
449 <tr>
450 <td><a href="#VisibilityMixin.__init__">VisibilityMixin</a></td>
451 <td>Constructor</td>
452 </tr>
453 </table>
454 <h3>Static Methods</h3>
455 <table>
456 <tr><td>None</td></tr>
457 </table>
458 <a NAME="VisibilityMixin.__init__" ID="VisibilityMixin.__init__"></a>
459 <h4>VisibilityMixin (Constructor)</h4>
460 <b>VisibilityMixin</b>(<i></i>)
461 <p>
462 Constructor
463 </p>
464 <div align="right"><a href="#top">Up</a></div>
465 <hr /><hr />
466 <a NAME="_indent" ID="_indent"></a>
467 <h2>_indent</h2>
468 <b>_indent</b>(<i>ws</i>)
469 <p>
470 Module function to return the indentation depth.
471 </p><dl>
472 <dt><i>ws</i></dt>
473 <dd>
474 the whitespace to be checked (string)
475 </dd>
476 </dl><dl>
477 <dt>Returns:</dt>
478 <dd>
479 length of the whitespace string (integer)
480 </dd>
481 </dl>
482 <div align="right"><a href="#top">Up</a></div>
483 <hr /><hr />
484 <a NAME="readmodule_ex" ID="readmodule_ex"></a>
485 <h2>readmodule_ex</h2>
486 <b>readmodule_ex</b>(<i>module, path=None, inpackage=False, isPyFile=False</i>)
487 <p>
488 Read a module file and return a dictionary of classes.
489 </p><p>
490 Search for MODULE in PATH and sys.path, read and parse the
491 module and return a dictionary with one entry for each class
492 found in the module.
493 </p><dl>
494 <dt><i>module</i></dt>
495 <dd>
496 name of the module file (string)
497 </dd><dt><i>path</i></dt>
498 <dd>
499 path the module should be searched in (list of strings)
500 </dd><dt><i>inpackage</i></dt>
501 <dd>
502 flag indicating a module inside a package is scanned
503 </dd><dt><i>isPyFile</i></dt>
504 <dd>
505 flag indicating a Python file (boolean)
506 </dd>
507 </dl><dl>
508 <dt>Returns:</dt>
509 <dd>
510 the resulting dictionary
511 </dd>
512 </dl>
513 <div align="right"><a href="#top">Up</a></div>
514 <hr />
515 </body></html>

eric ide

mercurial