|
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="#Publics">Publics</a></td> |
|
48 <td>Class to represent the list of public identifiers.</td> |
|
49 </tr><tr> |
|
50 <td><a href="#VisibilityMixin">VisibilityMixin</a></td> |
|
51 <td>Mixin class implementing the notion of visibility.</td> |
|
52 </tr> |
|
53 </table> |
|
54 <h3>Functions</h3> |
|
55 <table> |
|
56 <tr> |
|
57 <td><a href="#_indent">_indent</a></td> |
|
58 <td>Module function to return the indentation depth.</td> |
|
59 </tr><tr> |
|
60 <td><a href="#readmodule_ex">readmodule_ex</a></td> |
|
61 <td>Read a module file and return a dictionary of classes.</td> |
|
62 </tr> |
|
63 </table> |
|
64 <hr /><hr /> |
|
65 <a NAME="Attribute" ID="Attribute"></a> |
|
66 <h2>Attribute</h2> |
|
67 <p> |
|
68 Class to represent a class attribute. |
|
69 </p> |
|
70 <h3>Derived from</h3> |
|
71 ClbrBaseClasses.Attribute, VisibilityMixin |
|
72 <h3>Class Attributes</h3> |
|
73 <table> |
|
74 <tr><td>None</td></tr> |
|
75 </table> |
|
76 <h3>Class Methods</h3> |
|
77 <table> |
|
78 <tr><td>None</td></tr> |
|
79 </table> |
|
80 <h3>Methods</h3> |
|
81 <table> |
|
82 <tr> |
|
83 <td><a href="#Attribute.__init__">Attribute</a></td> |
|
84 <td>Constructor</td> |
|
85 </tr> |
|
86 </table> |
|
87 <h3>Static Methods</h3> |
|
88 <table> |
|
89 <tr><td>None</td></tr> |
|
90 </table> |
|
91 <a NAME="Attribute.__init__" ID="Attribute.__init__"></a> |
|
92 <h4>Attribute (Constructor)</h4> |
|
93 <b>Attribute</b>(<i>module, name, file, lineno</i>) |
|
94 <p> |
|
95 Constructor |
|
96 </p><dl> |
|
97 <dt><i>module</i></dt> |
|
98 <dd> |
|
99 name of the module containing this class |
|
100 </dd><dt><i>name</i></dt> |
|
101 <dd> |
|
102 name of this class |
|
103 </dd><dt><i>file</i></dt> |
|
104 <dd> |
|
105 filename containing this attribute |
|
106 </dd><dt><i>lineno</i></dt> |
|
107 <dd> |
|
108 linenumber of the class definition |
|
109 </dd> |
|
110 </dl> |
|
111 <div align="right"><a href="#top">Up</a></div> |
|
112 <hr /><hr /> |
|
113 <a NAME="Class" ID="Class"></a> |
|
114 <h2>Class</h2> |
|
115 <p> |
|
116 Class to represent a Python class. |
|
117 </p> |
|
118 <h3>Derived from</h3> |
|
119 ClbrBaseClasses.Class, VisibilityMixin |
|
120 <h3>Class Attributes</h3> |
|
121 <table> |
|
122 <tr><td>None</td></tr> |
|
123 </table> |
|
124 <h3>Class Methods</h3> |
|
125 <table> |
|
126 <tr><td>None</td></tr> |
|
127 </table> |
|
128 <h3>Methods</h3> |
|
129 <table> |
|
130 <tr> |
|
131 <td><a href="#Class.__init__">Class</a></td> |
|
132 <td>Constructor</td> |
|
133 </tr> |
|
134 </table> |
|
135 <h3>Static Methods</h3> |
|
136 <table> |
|
137 <tr><td>None</td></tr> |
|
138 </table> |
|
139 <a NAME="Class.__init__" ID="Class.__init__"></a> |
|
140 <h4>Class (Constructor)</h4> |
|
141 <b>Class</b>(<i>module, name, super, file, lineno</i>) |
|
142 <p> |
|
143 Constructor |
|
144 </p><dl> |
|
145 <dt><i>module</i></dt> |
|
146 <dd> |
|
147 name of the module containing this class |
|
148 </dd><dt><i>name</i></dt> |
|
149 <dd> |
|
150 name of this class |
|
151 </dd><dt><i>super</i></dt> |
|
152 <dd> |
|
153 list of class names this class is inherited from |
|
154 </dd><dt><i>file</i></dt> |
|
155 <dd> |
|
156 filename containing this class |
|
157 </dd><dt><i>lineno</i></dt> |
|
158 <dd> |
|
159 linenumber of the class definition |
|
160 </dd> |
|
161 </dl> |
|
162 <div align="right"><a href="#top">Up</a></div> |
|
163 <hr /><hr /> |
|
164 <a NAME="Function" ID="Function"></a> |
|
165 <h2>Function</h2> |
|
166 <p> |
|
167 Class to represent a Python function. |
|
168 </p> |
|
169 <h3>Derived from</h3> |
|
170 ClbrBaseClasses.Function, VisibilityMixin |
|
171 <h3>Class Attributes</h3> |
|
172 <table> |
|
173 <tr><td>None</td></tr> |
|
174 </table> |
|
175 <h3>Class Methods</h3> |
|
176 <table> |
|
177 <tr><td>None</td></tr> |
|
178 </table> |
|
179 <h3>Methods</h3> |
|
180 <table> |
|
181 <tr> |
|
182 <td><a href="#Function.__init__">Function</a></td> |
|
183 <td>Constructor</td> |
|
184 </tr> |
|
185 </table> |
|
186 <h3>Static Methods</h3> |
|
187 <table> |
|
188 <tr><td>None</td></tr> |
|
189 </table> |
|
190 <a NAME="Function.__init__" ID="Function.__init__"></a> |
|
191 <h4>Function (Constructor)</h4> |
|
192 <b>Function</b>(<i>module, name, file, lineno, signature='', separator=', ', modifierType=ClbrBaseClasses.Function.General</i>) |
|
193 <p> |
|
194 Constructor |
|
195 </p><dl> |
|
196 <dt><i>module</i></dt> |
|
197 <dd> |
|
198 name of the module containing this function |
|
199 </dd><dt><i>name</i></dt> |
|
200 <dd> |
|
201 name of this function |
|
202 </dd><dt><i>file</i></dt> |
|
203 <dd> |
|
204 filename containing this class |
|
205 </dd><dt><i>lineno</i></dt> |
|
206 <dd> |
|
207 linenumber of the class definition |
|
208 </dd><dt><i>signature</i></dt> |
|
209 <dd> |
|
210 parameterlist of the method |
|
211 </dd><dt><i>separator</i></dt> |
|
212 <dd> |
|
213 string separating the parameters |
|
214 </dd><dt><i>modifierType</i></dt> |
|
215 <dd> |
|
216 type of the function |
|
217 </dd> |
|
218 </dl> |
|
219 <div align="right"><a href="#top">Up</a></div> |
|
220 <hr /><hr /> |
|
221 <a NAME="Publics" ID="Publics"></a> |
|
222 <h2>Publics</h2> |
|
223 <p> |
|
224 Class to represent the list of public identifiers. |
|
225 </p> |
|
226 <h3>Derived from</h3> |
|
227 object |
|
228 <h3>Class Attributes</h3> |
|
229 <table> |
|
230 <tr><td>None</td></tr> |
|
231 </table> |
|
232 <h3>Class Methods</h3> |
|
233 <table> |
|
234 <tr><td>None</td></tr> |
|
235 </table> |
|
236 <h3>Methods</h3> |
|
237 <table> |
|
238 <tr> |
|
239 <td><a href="#Publics.__init__">Publics</a></td> |
|
240 <td>Constructor</td> |
|
241 </tr> |
|
242 </table> |
|
243 <h3>Static Methods</h3> |
|
244 <table> |
|
245 <tr><td>None</td></tr> |
|
246 </table> |
|
247 <a NAME="Publics.__init__" ID="Publics.__init__"></a> |
|
248 <h4>Publics (Constructor)</h4> |
|
249 <b>Publics</b>(<i>module, file, lineno, idents</i>) |
|
250 <p> |
|
251 Constructor |
|
252 </p><dl> |
|
253 <dt><i>module</i></dt> |
|
254 <dd> |
|
255 name of the module containing this function |
|
256 </dd><dt><i>file</i></dt> |
|
257 <dd> |
|
258 filename containing this class |
|
259 </dd><dt><i>lineno</i></dt> |
|
260 <dd> |
|
261 linenumber of the class definition |
|
262 </dd><dt><i>idents</i></dt> |
|
263 <dd> |
|
264 list of public identifiers |
|
265 </dd> |
|
266 </dl> |
|
267 <div align="right"><a href="#top">Up</a></div> |
|
268 <hr /><hr /> |
|
269 <a NAME="VisibilityMixin" ID="VisibilityMixin"></a> |
|
270 <h2>VisibilityMixin</h2> |
|
271 <p> |
|
272 Mixin class implementing the notion of visibility. |
|
273 </p> |
|
274 <h3>Derived from</h3> |
|
275 ClbrBaseClasses.ClbrVisibilityMixinBase |
|
276 <h3>Class Attributes</h3> |
|
277 <table> |
|
278 <tr><td>None</td></tr> |
|
279 </table> |
|
280 <h3>Class Methods</h3> |
|
281 <table> |
|
282 <tr><td>None</td></tr> |
|
283 </table> |
|
284 <h3>Methods</h3> |
|
285 <table> |
|
286 <tr> |
|
287 <td><a href="#VisibilityMixin.__init__">VisibilityMixin</a></td> |
|
288 <td>Constructor</td> |
|
289 </tr> |
|
290 </table> |
|
291 <h3>Static Methods</h3> |
|
292 <table> |
|
293 <tr><td>None</td></tr> |
|
294 </table> |
|
295 <a NAME="VisibilityMixin.__init__" ID="VisibilityMixin.__init__"></a> |
|
296 <h4>VisibilityMixin (Constructor)</h4> |
|
297 <b>VisibilityMixin</b>(<i></i>) |
|
298 <p> |
|
299 Constructor |
|
300 </p> |
|
301 <div align="right"><a href="#top">Up</a></div> |
|
302 <hr /><hr /> |
|
303 <a NAME="_indent" ID="_indent"></a> |
|
304 <h2>_indent</h2> |
|
305 <b>_indent</b>(<i>ws</i>) |
|
306 <p> |
|
307 Module function to return the indentation depth. |
|
308 </p><dl> |
|
309 <dt><i>ws</i></dt> |
|
310 <dd> |
|
311 the whitespace to be checked (string) |
|
312 </dd> |
|
313 </dl><dl> |
|
314 <dt>Returns:</dt> |
|
315 <dd> |
|
316 length of the whitespace string (integer) |
|
317 </dd> |
|
318 </dl> |
|
319 <div align="right"><a href="#top">Up</a></div> |
|
320 <hr /><hr /> |
|
321 <a NAME="readmodule_ex" ID="readmodule_ex"></a> |
|
322 <h2>readmodule_ex</h2> |
|
323 <b>readmodule_ex</b>(<i>module, path=[], inpackage=False, isPyFile=False</i>) |
|
324 <p> |
|
325 Read a module file and return a dictionary of classes. |
|
326 </p><p> |
|
327 Search for MODULE in PATH and sys.path, read and parse the |
|
328 module and return a dictionary with one entry for each class |
|
329 found in the module. |
|
330 </p><dl> |
|
331 <dt><i>module</i></dt> |
|
332 <dd> |
|
333 name of the module file (string) |
|
334 </dd><dt><i>path</i></dt> |
|
335 <dd> |
|
336 path the module should be searched in (list of strings) |
|
337 </dd><dt><i>inpackage</i></dt> |
|
338 <dd> |
|
339 flag indicating a module inside a package is scanned |
|
340 </dd><dt><i>isPyFile</i></dt> |
|
341 <dd> |
|
342 flag indicating a Python file (boolean) |
|
343 </dd> |
|
344 </dl><dl> |
|
345 <dt>Returns:</dt> |
|
346 <dd> |
|
347 the resulting dictionary |
|
348 </dd> |
|
349 </dl> |
|
350 <div align="right"><a href="#top">Up</a></div> |
|
351 <hr /> |
|
352 </body></html> |