5 <link rel="stylesheet" href="styles.css"> |
5 <link rel="stylesheet" href="styles.css"> |
6 </head> |
6 </head> |
7 <body> |
7 <body> |
8 <a NAME="top" ID="top"></a> |
8 <a NAME="top" ID="top"></a> |
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker</h1> |
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Imports.ImportsChecker</h1> |
10 |
|
11 <p> |
10 <p> |
12 Module implementing a checker for import statements. |
11 Module implementing a checker for import statements. |
13 </p> |
12 </p> |
|
13 |
14 <h3>Global Attributes</h3> |
14 <h3>Global Attributes</h3> |
15 |
|
16 <table> |
15 <table> |
17 <tr><td>None</td></tr> |
16 <tr><td>None</td></tr> |
18 </table> |
17 </table> |
|
18 |
19 <h3>Classes</h3> |
19 <h3>Classes</h3> |
20 |
20 <table> |
21 <table> |
|
22 |
|
23 <tr> |
21 <tr> |
24 <td><a href="#ImportsChecker">ImportsChecker</a></td> |
22 <td><a href="#ImportsChecker">ImportsChecker</a></td> |
25 <td>Class implementing a checker for import statements.</td> |
23 <td>Class implementing a checker for import statements.</td> |
26 </tr> |
24 </tr> |
27 </table> |
25 </table> |
|
26 |
28 <h3>Functions</h3> |
27 <h3>Functions</h3> |
29 |
|
30 <table> |
28 <table> |
31 <tr><td>None</td></tr> |
29 <tr><td>None</td></tr> |
32 </table> |
30 </table> |
|
31 |
33 <hr /> |
32 <hr /> |
34 <hr /> |
33 <hr /> |
35 <a NAME="ImportsChecker" ID="ImportsChecker"></a> |
34 <a NAME="ImportsChecker" ID="ImportsChecker"></a> |
36 <h2>ImportsChecker</h2> |
35 <h2>ImportsChecker</h2> |
37 |
|
38 <p> |
36 <p> |
39 Class implementing a checker for import statements. |
37 Class implementing a checker for import statements. |
40 </p> |
38 </p> |
|
39 |
41 <h3>Derived from</h3> |
40 <h3>Derived from</h3> |
42 None |
41 None |
43 <h3>Class Attributes</h3> |
42 <h3>Class Attributes</h3> |
44 |
|
45 <table> |
43 <table> |
46 <tr><td>Codes</td></tr> |
44 <tr><td>Codes</td></tr> |
47 </table> |
45 </table> |
|
46 |
48 <h3>Class Methods</h3> |
47 <h3>Class Methods</h3> |
49 |
|
50 <table> |
48 <table> |
51 <tr><td>None</td></tr> |
49 <tr><td>None</td></tr> |
52 </table> |
50 </table> |
|
51 |
53 <h3>Methods</h3> |
52 <h3>Methods</h3> |
54 |
53 <table> |
55 <table> |
|
56 |
|
57 <tr> |
54 <tr> |
58 <td><a href="#ImportsChecker.__init__">ImportsChecker</a></td> |
55 <td><a href="#ImportsChecker.__init__">ImportsChecker</a></td> |
59 <td>Constructor</td> |
56 <td>Constructor</td> |
60 </tr> |
57 </tr> |
61 <tr> |
58 <tr> |
97 <tr> |
94 <tr> |
98 <td><a href="#ImportsChecker.run">run</a></td> |
95 <td><a href="#ImportsChecker.run">run</a></td> |
99 <td>Public method to check the given source against miscellaneous conditions.</td> |
96 <td>Public method to check the given source against miscellaneous conditions.</td> |
100 </tr> |
97 </tr> |
101 </table> |
98 </table> |
|
99 |
102 <h3>Static Methods</h3> |
100 <h3>Static Methods</h3> |
103 |
|
104 <table> |
101 <table> |
105 <tr><td>None</td></tr> |
102 <tr><td>None</td></tr> |
106 </table> |
103 </table> |
|
104 |
107 |
105 |
108 <a NAME="ImportsChecker.__init__" ID="ImportsChecker.__init__"></a> |
106 <a NAME="ImportsChecker.__init__" ID="ImportsChecker.__init__"></a> |
109 <h4>ImportsChecker (Constructor)</h4> |
107 <h4>ImportsChecker (Constructor)</h4> |
110 <b>ImportsChecker</b>(<i>source, filename, tree, select, ignore, expected, repeat, args</i>) |
108 <b>ImportsChecker</b>(<i>source, filename, tree, select, ignore, expected, repeat, args</i>) |
111 |
|
112 <p> |
109 <p> |
113 Constructor |
110 Constructor |
114 </p> |
111 </p> |
|
112 |
115 <dl> |
113 <dl> |
116 |
114 |
117 <dt><i>source</i> (list of str)</dt> |
115 <dt><i>source</i> (list of str)</dt> |
118 <dd> |
116 <dd> |
119 source code to be checked |
117 source code to be checked |
148 </dd> |
146 </dd> |
149 </dl> |
147 </dl> |
150 <a NAME="ImportsChecker.__checkBannedImport" ID="ImportsChecker.__checkBannedImport"></a> |
148 <a NAME="ImportsChecker.__checkBannedImport" ID="ImportsChecker.__checkBannedImport"></a> |
151 <h4>ImportsChecker.__checkBannedImport</h4> |
149 <h4>ImportsChecker.__checkBannedImport</h4> |
152 <b>__checkBannedImport</b>(<i>node</i>) |
150 <b>__checkBannedImport</b>(<i>node</i>) |
153 |
|
154 <p> |
151 <p> |
155 Private method to check import of banned modules. |
152 Private method to check import of banned modules. |
156 </p> |
153 </p> |
|
154 |
157 <dl> |
155 <dl> |
158 |
156 |
159 <dt><i>node</i> (ast.AST)</dt> |
157 <dt><i>node</i> (ast.AST)</dt> |
160 <dd> |
158 <dd> |
161 reference to the node to be checked |
159 reference to the node to be checked |
162 </dd> |
160 </dd> |
163 </dl> |
161 </dl> |
164 <a NAME="ImportsChecker.__checkBannedRelativeImports" ID="ImportsChecker.__checkBannedRelativeImports"></a> |
162 <a NAME="ImportsChecker.__checkBannedRelativeImports" ID="ImportsChecker.__checkBannedRelativeImports"></a> |
165 <h4>ImportsChecker.__checkBannedRelativeImports</h4> |
163 <h4>ImportsChecker.__checkBannedRelativeImports</h4> |
166 <b>__checkBannedRelativeImports</b>(<i>node</i>) |
164 <b>__checkBannedRelativeImports</b>(<i>node</i>) |
167 |
|
168 <p> |
165 <p> |
169 Private method to check if relative imports are banned. |
166 Private method to check if relative imports are banned. |
170 </p> |
167 </p> |
|
168 |
171 <dl> |
169 <dl> |
172 |
170 |
173 <dt><i>node</i> (ast.AST)</dt> |
171 <dt><i>node</i> (ast.AST)</dt> |
174 <dd> |
172 <dd> |
175 reference to the node to be checked |
173 reference to the node to be checked |
176 </dd> |
174 </dd> |
177 </dl> |
175 </dl> |
178 <a NAME="ImportsChecker.__checkLocalImports" ID="ImportsChecker.__checkLocalImports"></a> |
176 <a NAME="ImportsChecker.__checkLocalImports" ID="ImportsChecker.__checkLocalImports"></a> |
179 <h4>ImportsChecker.__checkLocalImports</h4> |
177 <h4>ImportsChecker.__checkLocalImports</h4> |
180 <b>__checkLocalImports</b>(<i></i>) |
178 <b>__checkLocalImports</b>(<i></i>) |
181 |
|
182 <p> |
179 <p> |
183 Private method to check local imports. |
180 Private method to check local imports. |
184 </p> |
181 </p> |
|
182 |
185 <a NAME="ImportsChecker.__checkUnnecessaryAlias" ID="ImportsChecker.__checkUnnecessaryAlias"></a> |
183 <a NAME="ImportsChecker.__checkUnnecessaryAlias" ID="ImportsChecker.__checkUnnecessaryAlias"></a> |
186 <h4>ImportsChecker.__checkUnnecessaryAlias</h4> |
184 <h4>ImportsChecker.__checkUnnecessaryAlias</h4> |
187 <b>__checkUnnecessaryAlias</b>(<i>node</i>) |
185 <b>__checkUnnecessaryAlias</b>(<i>node</i>) |
188 |
|
189 <p> |
186 <p> |
190 Private method to check unnecessary import aliases. |
187 Private method to check unnecessary import aliases. |
191 </p> |
188 </p> |
|
189 |
192 <dl> |
190 <dl> |
193 |
191 |
194 <dt><i>node</i> (ast.AST)</dt> |
192 <dt><i>node</i> (ast.AST)</dt> |
195 <dd> |
193 <dd> |
196 reference to the node to be checked |
194 reference to the node to be checked |
197 </dd> |
195 </dd> |
198 </dl> |
196 </dl> |
199 <a NAME="ImportsChecker.__compileUnstructuredGlob" ID="ImportsChecker.__compileUnstructuredGlob"></a> |
197 <a NAME="ImportsChecker.__compileUnstructuredGlob" ID="ImportsChecker.__compileUnstructuredGlob"></a> |
200 <h4>ImportsChecker.__compileUnstructuredGlob</h4> |
198 <h4>ImportsChecker.__compileUnstructuredGlob</h4> |
201 <b>__compileUnstructuredGlob</b>(<i>module</i>) |
199 <b>__compileUnstructuredGlob</b>(<i>module</i>) |
202 |
|
203 <p> |
200 <p> |
204 Private method to convert a pattern to a regex such that ".*" matches zero or |
201 Private method to convert a pattern to a regex such that ".*" matches zero or |
205 more modules. |
202 more modules. |
206 </p> |
203 </p> |
|
204 |
207 <dl> |
205 <dl> |
208 |
206 |
209 <dt><i>module</i> (str)</dt> |
207 <dt><i>module</i> (str)</dt> |
210 <dd> |
208 <dd> |
211 module pattern to be converted |
209 module pattern to be converted |
224 </dd> |
222 </dd> |
225 </dl> |
223 </dl> |
226 <a NAME="ImportsChecker.__error" ID="ImportsChecker.__error"></a> |
224 <a NAME="ImportsChecker.__error" ID="ImportsChecker.__error"></a> |
227 <h4>ImportsChecker.__error</h4> |
225 <h4>ImportsChecker.__error</h4> |
228 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) |
226 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) |
229 |
|
230 <p> |
227 <p> |
231 Private method to record an issue. |
228 Private method to record an issue. |
232 </p> |
229 </p> |
|
230 |
233 <dl> |
231 <dl> |
234 |
232 |
235 <dt><i>lineNumber</i> (int)</dt> |
233 <dt><i>lineNumber</i> (int)</dt> |
236 <dd> |
234 <dd> |
237 line number of the issue |
235 line number of the issue |
250 </dd> |
248 </dd> |
251 </dl> |
249 </dl> |
252 <a NAME="ImportsChecker.__ignoreCode" ID="ImportsChecker.__ignoreCode"></a> |
250 <a NAME="ImportsChecker.__ignoreCode" ID="ImportsChecker.__ignoreCode"></a> |
253 <h4>ImportsChecker.__ignoreCode</h4> |
251 <h4>ImportsChecker.__ignoreCode</h4> |
254 <b>__ignoreCode</b>(<i>code</i>) |
252 <b>__ignoreCode</b>(<i>code</i>) |
255 |
|
256 <p> |
253 <p> |
257 Private method to check if the message code should be ignored. |
254 Private method to check if the message code should be ignored. |
258 </p> |
255 </p> |
|
256 |
259 <dl> |
257 <dl> |
260 |
258 |
261 <dt><i>code</i> (str)</dt> |
259 <dt><i>code</i> (str)</dt> |
262 <dd> |
260 <dd> |
263 message code to check for |
261 message code to check for |
276 </dd> |
274 </dd> |
277 </dl> |
275 </dl> |
278 <a NAME="ImportsChecker.__isModuleBanned" ID="ImportsChecker.__isModuleBanned"></a> |
276 <a NAME="ImportsChecker.__isModuleBanned" ID="ImportsChecker.__isModuleBanned"></a> |
279 <h4>ImportsChecker.__isModuleBanned</h4> |
277 <h4>ImportsChecker.__isModuleBanned</h4> |
280 <b>__isModuleBanned</b>(<i>moduleName</i>) |
278 <b>__isModuleBanned</b>(<i>moduleName</i>) |
281 |
|
282 <p> |
279 <p> |
283 Private method to check, if the given module name banned. |
280 Private method to check, if the given module name banned. |
284 </p> |
281 </p> |
|
282 |
285 <dl> |
283 <dl> |
286 |
284 |
287 <dt><i>moduleName</i> (str)</dt> |
285 <dt><i>moduleName</i> (str)</dt> |
288 <dd> |
286 <dd> |
289 module name to be checked |
287 module name to be checked |
302 </dd> |
300 </dd> |
303 </dl> |
301 </dl> |
304 <a NAME="ImportsChecker.__tidyImports" ID="ImportsChecker.__tidyImports"></a> |
302 <a NAME="ImportsChecker.__tidyImports" ID="ImportsChecker.__tidyImports"></a> |
305 <h4>ImportsChecker.__tidyImports</h4> |
303 <h4>ImportsChecker.__tidyImports</h4> |
306 <b>__tidyImports</b>(<i></i>) |
304 <b>__tidyImports</b>(<i></i>) |
307 |
|
308 <p> |
305 <p> |
309 Private method to check various other import related topics. |
306 Private method to check various other import related topics. |
310 </p> |
307 </p> |
|
308 |
311 <a NAME="ImportsChecker.run" ID="ImportsChecker.run"></a> |
309 <a NAME="ImportsChecker.run" ID="ImportsChecker.run"></a> |
312 <h4>ImportsChecker.run</h4> |
310 <h4>ImportsChecker.run</h4> |
313 <b>run</b>(<i></i>) |
311 <b>run</b>(<i></i>) |
314 |
|
315 <p> |
312 <p> |
316 Public method to check the given source against miscellaneous |
313 Public method to check the given source against miscellaneous |
317 conditions. |
314 conditions. |
318 </p> |
315 </p> |
|
316 |
319 <div align="right"><a href="#top">Up</a></div> |
317 <div align="right"><a href="#top">Up</a></div> |
320 <hr /> |
318 <hr /> |
321 </body></html> |
319 </body></html> |