20 </style> |
20 </style> |
21 </head> |
21 </head> |
22 <body><a NAME="top" ID="top"></a> |
22 <body><a NAME="top" ID="top"></a> |
23 <h1>eric5.Utilities.ClassBrowsers.pyclbr</h1> |
23 <h1>eric5.Utilities.ClassBrowsers.pyclbr</h1> |
24 <p> |
24 <p> |
25 Parse a Python file and retrieve classes, functions/methods and attributes. |
25 Parse a Python file and retrieve classes, functions/methods and attributes. |
26 </p><p> |
26 </p><p> |
27 Parse enough of a Python file to recognize class and method definitions and |
27 Parse enough of a Python file to recognize class and method definitions and |
28 to find out the superclasses of a class as well as its attributes. |
28 to find out the superclasses of a class as well as its attributes. |
29 </p><p> |
29 </p><p> |
30 This is module is based on pyclbr found in the Python 2.2.2 distribution. |
30 This is module is based on pyclbr found in the Python 2.2.2 distribution. |
31 </p> |
31 </p> |
32 <h3>Global Attributes</h3> |
32 <h3>Global Attributes</h3> |
33 <table> |
33 <table> |
34 <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 <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> |
35 </table> |
35 </table> |
36 <h3>Classes</h3> |
36 <h3>Classes</h3> |
37 <table> |
37 <table> |
38 <tr> |
38 <tr> |
39 <td><a href="#Attribute">Attribute</a></td> |
39 <td><a href="#Attribute">Attribute</a></td> |
40 <td>Class to represent a class attribute.</td> |
40 <td>Class to represent a class attribute.</td> |
41 </tr><tr> |
41 </tr><tr> |
42 <td><a href="#Class">Class</a></td> |
42 <td><a href="#Class">Class</a></td> |
43 <td>Class to represent a Python class.</td> |
43 <td>Class to represent a Python class.</td> |
44 </tr><tr> |
44 </tr><tr> |
45 <td><a href="#Function">Function</a></td> |
45 <td><a href="#Function">Function</a></td> |
46 <td>Class to represent a Python function.</td> |
46 <td>Class to represent a Python function.</td> |
47 </tr><tr> |
47 </tr><tr> |
48 <td><a href="#Publics">Publics</a></td> |
48 <td><a href="#Publics">Publics</a></td> |
49 <td>Class to represent the list of public identifiers.</td> |
49 <td>Class to represent the list of public identifiers.</td> |
50 </tr><tr> |
50 </tr><tr> |
51 <td><a href="#VisibilityMixin">VisibilityMixin</a></td> |
51 <td><a href="#VisibilityMixin">VisibilityMixin</a></td> |
52 <td>Mixin class implementing the notion of visibility.</td> |
52 <td>Mixin class implementing the notion of visibility.</td> |
53 </tr> |
53 </tr> |
54 </table> |
54 </table> |
55 <h3>Functions</h3> |
55 <h3>Functions</h3> |
56 <table> |
56 <table> |
57 <tr> |
57 <tr> |
58 <td><a href="#_indent">_indent</a></td> |
58 <td><a href="#_indent">_indent</a></td> |
59 <td>Module function to return the indentation depth.</td> |
59 <td>Module function to return the indentation depth.</td> |
60 </tr><tr> |
60 </tr><tr> |
61 <td><a href="#readmodule_ex">readmodule_ex</a></td> |
61 <td><a href="#readmodule_ex">readmodule_ex</a></td> |
62 <td>Read a module file and return a dictionary of classes.</td> |
62 <td>Read a module file and return a dictionary of classes.</td> |
63 </tr> |
63 </tr> |
64 </table> |
64 </table> |
65 <hr /><hr /> |
65 <hr /><hr /> |
66 <a NAME="Attribute" ID="Attribute"></a> |
66 <a NAME="Attribute" ID="Attribute"></a> |
67 <h2>Attribute</h2> |
67 <h2>Attribute</h2> |
68 <p> |
68 <p> |
69 Class to represent a class attribute. |
69 Class to represent a class attribute. |
70 </p> |
70 </p> |
71 <h3>Derived from</h3> |
71 <h3>Derived from</h3> |
72 ClbrBaseClasses.Attribute, VisibilityMixin |
72 ClbrBaseClasses.Attribute, VisibilityMixin |
73 <h3>Class Attributes</h3> |
73 <h3>Class Attributes</h3> |
74 <table> |
74 <table> |
76 </table> |
76 </table> |
77 <h3>Methods</h3> |
77 <h3>Methods</h3> |
78 <table> |
78 <table> |
79 <tr> |
79 <tr> |
80 <td><a href="#Attribute.__init__">Attribute</a></td> |
80 <td><a href="#Attribute.__init__">Attribute</a></td> |
81 <td>Constructor</td> |
81 <td>Constructor</td> |
82 </tr> |
82 </tr> |
83 </table> |
83 </table> |
84 <a NAME="Attribute.__init__" ID="Attribute.__init__"></a> |
84 <a NAME="Attribute.__init__" ID="Attribute.__init__"></a> |
85 <h4>Attribute (Constructor)</h4> |
85 <h4>Attribute (Constructor)</h4> |
86 <b>Attribute</b>(<i>module, name, file, lineno</i>) |
86 <b>Attribute</b>(<i>module, name, file, lineno</i>) |
87 <p> |
87 <p> |
88 Constructor |
88 Constructor |
89 </p><dl> |
89 </p><dl> |
90 <dt><i>module</i></dt> |
90 <dt><i>module</i></dt> |
91 <dd> |
91 <dd> |
92 name of the module containing this class |
92 name of the module containing this class |
93 </dd><dt><i>name</i></dt> |
93 </dd><dt><i>name</i></dt> |
94 <dd> |
94 <dd> |
95 name of this class |
95 name of this class |
96 </dd><dt><i>file</i></dt> |
96 </dd><dt><i>file</i></dt> |
97 <dd> |
97 <dd> |
98 filename containing this attribute |
98 filename containing this attribute |
99 </dd><dt><i>lineno</i></dt> |
99 </dd><dt><i>lineno</i></dt> |
100 <dd> |
100 <dd> |
101 linenumber of the class definition |
101 linenumber of the class definition |
102 </dd> |
102 </dd> |
103 </dl> |
103 </dl> |
104 <div align="right"><a href="#top">Up</a></div> |
104 <div align="right"><a href="#top">Up</a></div> |
105 <hr /><hr /> |
105 <hr /><hr /> |
106 <a NAME="Class" ID="Class"></a> |
106 <a NAME="Class" ID="Class"></a> |
107 <h2>Class</h2> |
107 <h2>Class</h2> |
108 <p> |
108 <p> |
109 Class to represent a Python class. |
109 Class to represent a Python class. |
110 </p> |
110 </p> |
111 <h3>Derived from</h3> |
111 <h3>Derived from</h3> |
112 ClbrBaseClasses.Class, VisibilityMixin |
112 ClbrBaseClasses.Class, VisibilityMixin |
113 <h3>Class Attributes</h3> |
113 <h3>Class Attributes</h3> |
114 <table> |
114 <table> |
116 </table> |
116 </table> |
117 <h3>Methods</h3> |
117 <h3>Methods</h3> |
118 <table> |
118 <table> |
119 <tr> |
119 <tr> |
120 <td><a href="#Class.__init__">Class</a></td> |
120 <td><a href="#Class.__init__">Class</a></td> |
121 <td>Constructor</td> |
121 <td>Constructor</td> |
122 </tr> |
122 </tr> |
123 </table> |
123 </table> |
124 <a NAME="Class.__init__" ID="Class.__init__"></a> |
124 <a NAME="Class.__init__" ID="Class.__init__"></a> |
125 <h4>Class (Constructor)</h4> |
125 <h4>Class (Constructor)</h4> |
126 <b>Class</b>(<i>module, name, super, file, lineno</i>) |
126 <b>Class</b>(<i>module, name, super, file, lineno</i>) |
127 <p> |
127 <p> |
128 Constructor |
128 Constructor |
129 </p><dl> |
129 </p><dl> |
130 <dt><i>module</i></dt> |
130 <dt><i>module</i></dt> |
131 <dd> |
131 <dd> |
132 name of the module containing this class |
132 name of the module containing this class |
133 </dd><dt><i>name</i></dt> |
133 </dd><dt><i>name</i></dt> |
134 <dd> |
134 <dd> |
135 name of this class |
135 name of this class |
136 </dd><dt><i>super</i></dt> |
136 </dd><dt><i>super</i></dt> |
137 <dd> |
137 <dd> |
138 list of class names this class is inherited from |
138 list of class names this class is inherited from |
139 </dd><dt><i>file</i></dt> |
139 </dd><dt><i>file</i></dt> |
140 <dd> |
140 <dd> |
141 filename containing this class |
141 filename containing this class |
142 </dd><dt><i>lineno</i></dt> |
142 </dd><dt><i>lineno</i></dt> |
143 <dd> |
143 <dd> |
144 linenumber of the class definition |
144 linenumber of the class definition |
145 </dd> |
145 </dd> |
146 </dl> |
146 </dl> |
147 <div align="right"><a href="#top">Up</a></div> |
147 <div align="right"><a href="#top">Up</a></div> |
148 <hr /><hr /> |
148 <hr /><hr /> |
149 <a NAME="Function" ID="Function"></a> |
149 <a NAME="Function" ID="Function"></a> |
150 <h2>Function</h2> |
150 <h2>Function</h2> |
151 <p> |
151 <p> |
152 Class to represent a Python function. |
152 Class to represent a Python function. |
153 </p> |
153 </p> |
154 <h3>Derived from</h3> |
154 <h3>Derived from</h3> |
155 ClbrBaseClasses.Function, VisibilityMixin |
155 ClbrBaseClasses.Function, VisibilityMixin |
156 <h3>Class Attributes</h3> |
156 <h3>Class Attributes</h3> |
157 <table> |
157 <table> |
159 </table> |
159 </table> |
160 <h3>Methods</h3> |
160 <h3>Methods</h3> |
161 <table> |
161 <table> |
162 <tr> |
162 <tr> |
163 <td><a href="#Function.__init__">Function</a></td> |
163 <td><a href="#Function.__init__">Function</a></td> |
164 <td>Constructor</td> |
164 <td>Constructor</td> |
165 </tr> |
165 </tr> |
166 </table> |
166 </table> |
167 <a NAME="Function.__init__" ID="Function.__init__"></a> |
167 <a NAME="Function.__init__" ID="Function.__init__"></a> |
168 <h4>Function (Constructor)</h4> |
168 <h4>Function (Constructor)</h4> |
169 <b>Function</b>(<i>module, name, file, lineno, signature = '', separator = ', '</i>) |
169 <b>Function</b>(<i>module, name, file, lineno, signature = '', separator = ', '</i>) |
170 <p> |
170 <p> |
171 Constructor |
171 Constructor |
172 </p><dl> |
172 </p><dl> |
173 <dt><i>module</i></dt> |
173 <dt><i>module</i></dt> |
174 <dd> |
174 <dd> |
175 name of the module containing this function |
175 name of the module containing this function |
176 </dd><dt><i>name</i></dt> |
176 </dd><dt><i>name</i></dt> |
177 <dd> |
177 <dd> |
178 name of this function |
178 name of this function |
179 </dd><dt><i>file</i></dt> |
179 </dd><dt><i>file</i></dt> |
180 <dd> |
180 <dd> |
181 filename containing this class |
181 filename containing this class |
182 </dd><dt><i>lineno</i></dt> |
182 </dd><dt><i>lineno</i></dt> |
183 <dd> |
183 <dd> |
184 linenumber of the class definition |
184 linenumber of the class definition |
185 </dd><dt><i>signature</i></dt> |
185 </dd><dt><i>signature</i></dt> |
186 <dd> |
186 <dd> |
187 parameterlist of the method |
187 parameterlist of the method |
188 </dd><dt><i>separator</i></dt> |
188 </dd><dt><i>separator</i></dt> |
189 <dd> |
189 <dd> |
190 string separating the parameters |
190 string separating the parameters |
191 </dd> |
191 </dd> |
192 </dl> |
192 </dl> |
193 <div align="right"><a href="#top">Up</a></div> |
193 <div align="right"><a href="#top">Up</a></div> |
194 <hr /><hr /> |
194 <hr /><hr /> |
195 <a NAME="Publics" ID="Publics"></a> |
195 <a NAME="Publics" ID="Publics"></a> |
196 <h2>Publics</h2> |
196 <h2>Publics</h2> |
197 <p> |
197 <p> |
198 Class to represent the list of public identifiers. |
198 Class to represent the list of public identifiers. |
199 </p> |
199 </p> |
200 <h3>Derived from</h3> |
200 <h3>Derived from</h3> |
201 object |
201 object |
202 <h3>Class Attributes</h3> |
202 <h3>Class Attributes</h3> |
203 <table> |
203 <table> |
205 </table> |
205 </table> |
206 <h3>Methods</h3> |
206 <h3>Methods</h3> |
207 <table> |
207 <table> |
208 <tr> |
208 <tr> |
209 <td><a href="#Publics.__init__">Publics</a></td> |
209 <td><a href="#Publics.__init__">Publics</a></td> |
210 <td>Constructor</td> |
210 <td>Constructor</td> |
211 </tr> |
211 </tr> |
212 </table> |
212 </table> |
213 <a NAME="Publics.__init__" ID="Publics.__init__"></a> |
213 <a NAME="Publics.__init__" ID="Publics.__init__"></a> |
214 <h4>Publics (Constructor)</h4> |
214 <h4>Publics (Constructor)</h4> |
215 <b>Publics</b>(<i>module, file, lineno, idents</i>) |
215 <b>Publics</b>(<i>module, file, lineno, idents</i>) |
216 <p> |
216 <p> |
217 Constructor |
217 Constructor |
218 </p><dl> |
218 </p><dl> |
219 <dt><i>module</i></dt> |
219 <dt><i>module</i></dt> |
220 <dd> |
220 <dd> |
221 name of the module containing this function |
221 name of the module containing this function |
222 </dd><dt><i>file</i></dt> |
222 </dd><dt><i>file</i></dt> |
223 <dd> |
223 <dd> |
224 filename containing this class |
224 filename containing this class |
225 </dd><dt><i>lineno</i></dt> |
225 </dd><dt><i>lineno</i></dt> |
226 <dd> |
226 <dd> |
227 linenumber of the class definition |
227 linenumber of the class definition |
228 </dd><dt><i>idents</i></dt> |
228 </dd><dt><i>idents</i></dt> |
229 <dd> |
229 <dd> |
230 list of public identifiers |
230 list of public identifiers |
231 </dd> |
231 </dd> |
232 </dl> |
232 </dl> |
233 <div align="right"><a href="#top">Up</a></div> |
233 <div align="right"><a href="#top">Up</a></div> |
234 <hr /><hr /> |
234 <hr /><hr /> |
235 <a NAME="VisibilityMixin" ID="VisibilityMixin"></a> |
235 <a NAME="VisibilityMixin" ID="VisibilityMixin"></a> |
236 <h2>VisibilityMixin</h2> |
236 <h2>VisibilityMixin</h2> |
237 <p> |
237 <p> |
238 Mixin class implementing the notion of visibility. |
238 Mixin class implementing the notion of visibility. |
239 </p> |
239 </p> |
240 <h3>Derived from</h3> |
240 <h3>Derived from</h3> |
241 ClbrBaseClasses.ClbrVisibilityMixinBase |
241 ClbrBaseClasses.ClbrVisibilityMixinBase |
242 <h3>Class Attributes</h3> |
242 <h3>Class Attributes</h3> |
243 <table> |
243 <table> |
245 </table> |
245 </table> |
246 <h3>Methods</h3> |
246 <h3>Methods</h3> |
247 <table> |
247 <table> |
248 <tr> |
248 <tr> |
249 <td><a href="#VisibilityMixin.__init__">VisibilityMixin</a></td> |
249 <td><a href="#VisibilityMixin.__init__">VisibilityMixin</a></td> |
250 <td>Method to initialize the visibility.</td> |
250 <td>Method to initialize the visibility.</td> |
251 </tr> |
251 </tr> |
252 </table> |
252 </table> |
253 <a NAME="VisibilityMixin.__init__" ID="VisibilityMixin.__init__"></a> |
253 <a NAME="VisibilityMixin.__init__" ID="VisibilityMixin.__init__"></a> |
254 <h4>VisibilityMixin (Constructor)</h4> |
254 <h4>VisibilityMixin (Constructor)</h4> |
255 <b>VisibilityMixin</b>(<i></i>) |
255 <b>VisibilityMixin</b>(<i></i>) |
256 <p> |
256 <p> |
257 Method to initialize the visibility. |
257 Method to initialize the visibility. |
258 </p> |
258 </p> |
259 <div align="right"><a href="#top">Up</a></div> |
259 <div align="right"><a href="#top">Up</a></div> |
260 <hr /><hr /> |
260 <hr /><hr /> |
261 <a NAME="_indent" ID="_indent"></a> |
261 <a NAME="_indent" ID="_indent"></a> |
262 <h2>_indent</h2> |
262 <h2>_indent</h2> |
263 <b>_indent</b>(<i>ws</i>) |
263 <b>_indent</b>(<i>ws</i>) |
264 <p> |
264 <p> |
265 Module function to return the indentation depth. |
265 Module function to return the indentation depth. |
266 </p><dl> |
266 </p><dl> |
267 <dt><i>ws</i></dt> |
267 <dt><i>ws</i></dt> |
268 <dd> |
268 <dd> |
269 the whitespace to be checked (string) |
269 the whitespace to be checked (string) |
270 </dd> |
270 </dd> |
271 </dl><dl> |
271 </dl><dl> |
272 <dt>Returns:</dt> |
272 <dt>Returns:</dt> |
273 <dd> |
273 <dd> |
274 length of the whitespace string (integer) |
274 length of the whitespace string (integer) |
275 </dd> |
275 </dd> |
276 </dl> |
276 </dl> |
277 <div align="right"><a href="#top">Up</a></div> |
277 <div align="right"><a href="#top">Up</a></div> |
278 <hr /><hr /> |
278 <hr /><hr /> |
279 <a NAME="readmodule_ex" ID="readmodule_ex"></a> |
279 <a NAME="readmodule_ex" ID="readmodule_ex"></a> |
280 <h2>readmodule_ex</h2> |
280 <h2>readmodule_ex</h2> |
281 <b>readmodule_ex</b>(<i>module, path=[], inpackage = False, isPyFile = False</i>) |
281 <b>readmodule_ex</b>(<i>module, path=[], inpackage = False, isPyFile = False</i>) |
282 <p> |
282 <p> |
283 Read a module file and return a dictionary of classes. |
283 Read a module file and return a dictionary of classes. |
284 </p><p> |
284 </p><p> |
285 Search for MODULE in PATH and sys.path, read and parse the |
285 Search for MODULE in PATH and sys.path, read and parse the |
286 module and return a dictionary with one entry for each class |
286 module and return a dictionary with one entry for each class |
287 found in the module. |
287 found in the module. |
288 </p><dl> |
288 </p><dl> |
289 <dt><i>module</i></dt> |
289 <dt><i>module</i></dt> |
290 <dd> |
290 <dd> |
291 name of the module file (string) |
291 name of the module file (string) |
292 </dd><dt><i>path</i></dt> |
292 </dd><dt><i>path</i></dt> |
293 <dd> |
293 <dd> |
294 path the module should be searched in (list of strings) |
294 path the module should be searched in (list of strings) |
295 </dd><dt><i>inpackage</i></dt> |
295 </dd><dt><i>inpackage</i></dt> |
296 <dd> |
296 <dd> |
297 flag indicating a module inside a package is scanned |
297 flag indicating a module inside a package is scanned |
298 </dd> |
298 </dd> |
299 </dl><dl> |
299 </dl><dl> |
300 <dt>Returns:</dt> |
300 <dt>Returns:</dt> |
301 <dd> |
301 <dd> |
302 the resulting dictionary |
302 the resulting dictionary |
303 </dd> |
303 </dd> |
304 </dl> |
304 </dl> |
305 <div align="right"><a href="#top">Up</a></div> |
305 <div align="right"><a href="#top">Up</a></div> |
306 <hr /> |
306 <hr /> |
307 </body></html> |
307 </body></html> |