40 Note: Name ordering is checked for import statements, the '__all__' statement |
40 Note: Name ordering is checked for import statements, the '__all__' statement |
41 and exception names of exception handlers. |
41 and exception names of exception handlers. |
42 </p> |
42 </p> |
43 |
43 |
44 <h3>Derived from</h3> |
44 <h3>Derived from</h3> |
45 None |
45 CodeStyleTopicChecker |
46 <h3>Class Attributes</h3> |
46 <h3>Class Attributes</h3> |
47 <table> |
47 <table> |
|
48 <tr><td>Category</td></tr> |
48 <tr><td>Codes</td></tr> |
49 <tr><td>Codes</td></tr> |
49 <tr><td>Prefix</td></tr> |
|
50 </table> |
50 </table> |
51 |
51 |
52 <h3>Class Methods</h3> |
52 <h3>Class Methods</h3> |
53 <table> |
53 <table> |
54 <tr><td>None</td></tr> |
54 <tr><td>None</td></tr> |
67 <tr> |
67 <tr> |
68 <td><a href="#NameOrderChecker.__checkNameOrder">__checkNameOrder</a></td> |
68 <td><a href="#NameOrderChecker.__checkNameOrder">__checkNameOrder</a></td> |
69 <td>Private method to check the order of import statements and handled exceptions.</td> |
69 <td>Private method to check the order of import statements and handled exceptions.</td> |
70 </tr> |
70 </tr> |
71 <tr> |
71 <tr> |
72 <td><a href="#NameOrderChecker.__error">__error</a></td> |
|
73 <td>Private method to record an issue.</td> |
|
74 </tr> |
|
75 <tr> |
|
76 <td><a href="#NameOrderChecker.__findErrorInAll">__findErrorInAll</a></td> |
72 <td><a href="#NameOrderChecker.__findErrorInAll">__findErrorInAll</a></td> |
77 <td>Private method to check the '__all__' node for errors.</td> |
73 <td>Private method to check the '__all__' node for errors.</td> |
78 </tr> |
74 </tr> |
79 <tr> |
75 <tr> |
80 <td><a href="#NameOrderChecker.__findExceptionListErrors">__findExceptionListErrors</a></td> |
76 <td><a href="#NameOrderChecker.__findExceptionListErrors">__findExceptionListErrors</a></td> |
91 <tr> |
87 <tr> |
92 <td><a href="#NameOrderChecker.__findNodes">__findNodes</a></td> |
88 <td><a href="#NameOrderChecker.__findNodes">__findNodes</a></td> |
93 <td>Private method to find all import and import from nodes of the given tree.</td> |
89 <td>Private method to find all import and import from nodes of the given tree.</td> |
94 </tr> |
90 </tr> |
95 <tr> |
91 <tr> |
96 <td><a href="#NameOrderChecker.__ignoreCode">__ignoreCode</a></td> |
|
97 <td>Private method to check if the message code should be ignored.</td> |
|
98 </tr> |
|
99 <tr> |
|
100 <td><a href="#NameOrderChecker.__naturalKeys">__naturalKeys</a></td> |
92 <td><a href="#NameOrderChecker.__naturalKeys">__naturalKeys</a></td> |
101 <td>Private method to generate keys for natural sorting.</td> |
93 <td>Private method to generate keys for natural sorting.</td> |
102 </tr> |
94 </tr> |
103 <tr> |
95 <tr> |
104 <td><a href="#NameOrderChecker.__naturally">__naturally</a></td> |
96 <td><a href="#NameOrderChecker.__naturally">__naturally</a></td> |
109 <td></td> |
101 <td></td> |
110 </tr> |
102 </tr> |
111 <tr> |
103 <tr> |
112 <td><a href="#NameOrderChecker.moduleKey">moduleKey</a></td> |
104 <td><a href="#NameOrderChecker.moduleKey">moduleKey</a></td> |
113 <td>Public method to generate a key for the given module name.</td> |
105 <td>Public method to generate a key for the given module name.</td> |
114 </tr> |
|
115 <tr> |
|
116 <td><a href="#NameOrderChecker.run">run</a></td> |
|
117 <td>Public method to check the given source against miscellaneous conditions.</td> |
|
118 </tr> |
106 </tr> |
119 <tr> |
107 <tr> |
120 <td><a href="#NameOrderChecker.sorted">sorted</a></td> |
108 <td><a href="#NameOrderChecker.sorted">sorted</a></td> |
121 <td>Public method to sort the given list of names.</td> |
109 <td>Public method to sort the given list of names.</td> |
122 </tr> |
110 </tr> |
201 <b>__checkNameOrder</b>(<i></i>) |
189 <b>__checkNameOrder</b>(<i></i>) |
202 <p> |
190 <p> |
203 Private method to check the order of import statements and handled exceptions. |
191 Private method to check the order of import statements and handled exceptions. |
204 </p> |
192 </p> |
205 |
193 |
206 <a NAME="NameOrderChecker.__error" ID="NameOrderChecker.__error"></a> |
|
207 <h4>NameOrderChecker.__error</h4> |
|
208 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) |
|
209 <p> |
|
210 Private method to record an issue. |
|
211 </p> |
|
212 |
|
213 <dl> |
|
214 |
|
215 <dt><i>lineNumber</i> (int)</dt> |
|
216 <dd> |
|
217 line number of the issue |
|
218 </dd> |
|
219 <dt><i>offset</i> (int)</dt> |
|
220 <dd> |
|
221 position within line of the issue |
|
222 </dd> |
|
223 <dt><i>code</i> (str)</dt> |
|
224 <dd> |
|
225 message code |
|
226 </dd> |
|
227 <dt><i>args</i> (list)</dt> |
|
228 <dd> |
|
229 arguments for the message |
|
230 </dd> |
|
231 </dl> |
|
232 <a NAME="NameOrderChecker.__findErrorInAll" ID="NameOrderChecker.__findErrorInAll"></a> |
194 <a NAME="NameOrderChecker.__findErrorInAll" ID="NameOrderChecker.__findErrorInAll"></a> |
233 <h4>NameOrderChecker.__findErrorInAll</h4> |
195 <h4>NameOrderChecker.__findErrorInAll</h4> |
234 <b>__findErrorInAll</b>(<i>node</i>) |
196 <b>__findErrorInAll</b>(<i>node</i>) |
235 <p> |
197 <p> |
236 Private method to check the '__all__' node for errors. |
198 Private method to check the '__all__' node for errors. |
361 <dd> |
323 <dd> |
362 tuple of (ast.Import | ast.ImportFrom, ast.List | ast.Tuple, |
324 tuple of (ast.Import | ast.ImportFrom, ast.List | ast.Tuple, |
363 ast.List | ast.Tuple) |
325 ast.List | ast.Tuple) |
364 </dd> |
326 </dd> |
365 </dl> |
327 </dl> |
366 <a NAME="NameOrderChecker.__ignoreCode" ID="NameOrderChecker.__ignoreCode"></a> |
|
367 <h4>NameOrderChecker.__ignoreCode</h4> |
|
368 <b>__ignoreCode</b>(<i>code</i>) |
|
369 <p> |
|
370 Private method to check if the message code should be ignored. |
|
371 </p> |
|
372 |
|
373 <dl> |
|
374 |
|
375 <dt><i>code</i> (str)</dt> |
|
376 <dd> |
|
377 message code to check for |
|
378 </dd> |
|
379 </dl> |
|
380 <dl> |
|
381 <dt>Return:</dt> |
|
382 <dd> |
|
383 flag indicating to ignore the given code |
|
384 </dd> |
|
385 </dl> |
|
386 <dl> |
|
387 <dt>Return Type:</dt> |
|
388 <dd> |
|
389 bool |
|
390 </dd> |
|
391 </dl> |
|
392 <a NAME="NameOrderChecker.__naturalKeys" ID="NameOrderChecker.__naturalKeys"></a> |
328 <a NAME="NameOrderChecker.__naturalKeys" ID="NameOrderChecker.__naturalKeys"></a> |
393 <h4>NameOrderChecker.__naturalKeys</h4> |
329 <h4>NameOrderChecker.__naturalKeys</h4> |
394 <b>__naturalKeys</b>(<i>text</i>) |
330 <b>__naturalKeys</b>(<i>text</i>) |
395 <p> |
331 <p> |
396 Private method to generate keys for natural sorting. |
332 Private method to generate keys for natural sorting. |
487 <dt>Return Type:</dt> |
423 <dt>Return Type:</dt> |
488 <dd> |
424 <dd> |
489 str |
425 str |
490 </dd> |
426 </dd> |
491 </dl> |
427 </dl> |
492 <a NAME="NameOrderChecker.run" ID="NameOrderChecker.run"></a> |
|
493 <h4>NameOrderChecker.run</h4> |
|
494 <b>run</b>(<i></i>) |
|
495 <p> |
|
496 Public method to check the given source against miscellaneous |
|
497 conditions. |
|
498 </p> |
|
499 |
|
500 <a NAME="NameOrderChecker.sorted" ID="NameOrderChecker.sorted"></a> |
428 <a NAME="NameOrderChecker.sorted" ID="NameOrderChecker.sorted"></a> |
501 <h4>NameOrderChecker.sorted</h4> |
429 <h4>NameOrderChecker.sorted</h4> |
502 <b>sorted</b>(<i>toSort, key=None, reverse=False</i>) |
430 <b>sorted</b>(<i>toSort, key=None, reverse=False</i>) |
503 <p> |
431 <p> |
504 Public method to sort the given list of names. |
432 Public method to sort the given list of names. |