src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker.html

branch
eric7
changeset 10510
fa7b8ebfbe13
parent 10479
856476537696
child 10648
57b0f5657250
equal deleted inserted replaced
10509:094ab8028423 10510:fa7b8ebfbe13
25 <tr> 25 <tr>
26 <td><a href="#DateTimeVisitor">DateTimeVisitor</a></td> 26 <td><a href="#DateTimeVisitor">DateTimeVisitor</a></td>
27 <td>Class implementing a node visitor to check datetime function calls.</td> 27 <td>Class implementing a node visitor to check datetime function calls.</td>
28 </tr> 28 </tr>
29 <tr> 29 <tr>
30 <td><a href="#ExceptBaseExceptionVisitor">ExceptBaseExceptionVisitor</a></td>
31 <td>Class to determine, if a 'BaseException' is re-raised.</td>
32 </tr>
33 <tr>
30 <td><a href="#M520NameFinder">M520NameFinder</a></td> 34 <td><a href="#M520NameFinder">M520NameFinder</a></td>
31 <td>Class to extract a name out of a tree of nodes ignoring names defined within the local scope of a comprehension.</td> 35 <td>Class to extract a name out of a tree of nodes ignoring names defined within the local scope of a comprehension.</td>
32 </tr> 36 </tr>
33 <tr> 37 <tr>
38 <td><a href="#M538Checker">M538Checker</a></td>
39 <td>Class traversing a 'for' loop body to check for modifications to a loop's mutable iterable.</td>
40 </tr>
41 <tr>
34 <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td> 42 <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td>
35 <td>Class implementing a checker for miscellaneous checks.</td> 43 <td>Class implementing a checker for miscellaneous checks.</td>
36 </tr> 44 </tr>
37 <tr> 45 <tr>
38 <td><a href="#NameFinder">NameFinder</a></td> 46 <td><a href="#NameFinder">NameFinder</a></td>
39 <td>Class to extract a name out of a tree of nodes.</td> 47 <td>Class to extract a name out of a tree of nodes.</td>
48 </tr>
49 <tr>
50 <td><a href="#NamedExprFinder">NamedExprFinder</a></td>
51 <td>Class to extract names defined through an ast.NamedExpr.</td>
40 </tr> 52 </tr>
41 <tr> 53 <tr>
42 <td><a href="#ReturnVisitor">ReturnVisitor</a></td> 54 <td><a href="#ReturnVisitor">ReturnVisitor</a></td>
43 <td>Class implementing a node visitor to check return statements.</td> 55 <td>Class implementing a node visitor to check return statements.</td>
44 </tr> 56 </tr>
175 <tr> 187 <tr>
176 <td><a href="#BugBearVisitor.__checkForM535">__checkForM535</a></td> 188 <td><a href="#BugBearVisitor.__checkForM535">__checkForM535</a></td>
177 <td>Private method to check that a static key isn't used in a dict comprehension.</td> 189 <td>Private method to check that a static key isn't used in a dict comprehension.</td>
178 </tr> 190 </tr>
179 <tr> 191 <tr>
192 <td><a href="#BugBearVisitor.__checkForM538">__checkForM538</a></td>
193 <td>Private method to check for changes to a loop's mutable iterable.</td>
194 </tr>
195 <tr>
180 <td><a href="#BugBearVisitor.__checkRedundantExcepthandlers">__checkRedundantExcepthandlers</a></td> 196 <td><a href="#BugBearVisitor.__checkRedundantExcepthandlers">__checkRedundantExcepthandlers</a></td>
181 <td>Private method to check for redundant exception types in an exception handler.</td> 197 <td>Private method to check for redundant exception types in an exception handler.</td>
182 </tr> 198 </tr>
183 <tr> 199 <tr>
184 <td><a href="#BugBearVisitor.__childrenInScope">__childrenInScope</a></td> 200 <td><a href="#BugBearVisitor.__childrenInScope">__childrenInScope</a></td>
195 <tr> 211 <tr>
196 <td><a href="#BugBearVisitor.__getAssignedNames">__getAssignedNames</a></td> 212 <td><a href="#BugBearVisitor.__getAssignedNames">__getAssignedNames</a></td>
197 <td>Private method to get the names of a for loop.</td> 213 <td>Private method to get the names of a for loop.</td>
198 </tr> 214 </tr>
199 <tr> 215 <tr>
200 <td><a href="#BugBearVisitor.__getDictCompLoopVarNames">__getDictCompLoopVarNames</a></td> 216 <td><a href="#BugBearVisitor.__getDictCompLoopAndNamedExprVarNames">__getDictCompLoopAndNamedExprVarNames</a></td>
201 <td>Private method to get the names of comprehension loop variables.</td> 217 <td>Private method to get the names of comprehension loop variables.</td>
202 </tr> 218 </tr>
203 <tr> 219 <tr>
204 <td><a href="#BugBearVisitor.__getNamesFromTuple">__getNamesFromTuple</a></td> 220 <td><a href="#BugBearVisitor.__getNamesFromTuple">__getNamesFromTuple</a></td>
205 <td>Private method to get the names from an ast.Tuple node.</td> 221 <td>Private method to get the names from an ast.Tuple node.</td>
206 </tr> 222 </tr>
207 <tr> 223 <tr>
224 <td><a href="#BugBearVisitor.__inClassInit">__inClassInit</a></td>
225 <td>Private method to check, if we are inside an '__init__' method.</td>
226 </tr>
227 <tr>
208 <td><a href="#BugBearVisitor.__isIdentifier">__isIdentifier</a></td> 228 <td><a href="#BugBearVisitor.__isIdentifier">__isIdentifier</a></td>
209 <td>Private method to check if arg is a valid identifier.</td> 229 <td>Private method to check if arg is a valid identifier.</td>
210 </tr> 230 </tr>
211 <tr> 231 <tr>
212 <td><a href="#BugBearVisitor.__namesFromAssignments">__namesFromAssignments</a></td> 232 <td><a href="#BugBearVisitor.__namesFromAssignments">__namesFromAssignments</a></td>
213 <td>Private method to get names of an assignment.</td> 233 <td>Private method to get names of an assignment.</td>
214 </tr> 234 </tr>
215 <tr> 235 <tr>
216 <td><a href="#BugBearVisitor.__toNameStr">__toNameStr</a></td>
217 <td>Private method to turn Name and Attribute nodes to strings, handling any depth of attribute accesses.</td>
218 </tr>
219 <tr>
220 <td><a href="#BugBearVisitor.__typesafeIssubclass">__typesafeIssubclass</a></td> 236 <td><a href="#BugBearVisitor.__typesafeIssubclass">__typesafeIssubclass</a></td>
221 <td>Private method implementing a type safe issubclass() function.</td> 237 <td>Private method implementing a type safe issubclass() function.</td>
222 </tr> 238 </tr>
223 <tr> 239 <tr>
224 <td><a href="#BugBearVisitor.__walkList">__walkList</a></td> 240 <td><a href="#BugBearVisitor.__walkList">__walkList</a></td>
255 <tr> 271 <tr>
256 <td><a href="#BugBearVisitor.nodeStack">nodeStack</a></td> 272 <td><a href="#BugBearVisitor.nodeStack">nodeStack</a></td>
257 <td>Public method to get a reference to the most recent node stack.</td> 273 <td>Public method to get a reference to the most recent node stack.</td>
258 </tr> 274 </tr>
259 <tr> 275 <tr>
276 <td><a href="#BugBearVisitor.toNameStr">toNameStr</a></td>
277 <td>Public method to turn Name and Attribute nodes to strings, handling any depth of attribute accesses.</td>
278 </tr>
279 <tr>
260 <td><a href="#BugBearVisitor.visit">visit</a></td> 280 <td><a href="#BugBearVisitor.visit">visit</a></td>
261 <td>Public method to traverse a given AST node.</td> 281 <td>Public method to traverse a given AST node.</td>
262 </tr> 282 </tr>
263 <tr> 283 <tr>
264 <td><a href="#BugBearVisitor.visit_AnnAssign">visit_AnnAssign</a></td> 284 <td><a href="#BugBearVisitor.visit_AnnAssign">visit_AnnAssign</a></td>
331 <tr> 351 <tr>
332 <td><a href="#BugBearVisitor.visit_Raise">visit_Raise</a></td> 352 <td><a href="#BugBearVisitor.visit_Raise">visit_Raise</a></td>
333 <td>Public method to handle 'raise' statements.</td> 353 <td>Public method to handle 'raise' statements.</td>
334 </tr> 354 </tr>
335 <tr> 355 <tr>
356 <td><a href="#BugBearVisitor.visit_Return">visit_Return</a></td>
357 <td>Public method to handle 'Return' nodes.</td>
358 </tr>
359 <tr>
336 <td><a href="#BugBearVisitor.visit_Set">visit_Set</a></td> 360 <td><a href="#BugBearVisitor.visit_Set">visit_Set</a></td>
337 <td>Public method to check a set.</td> 361 <td>Public method to check a set.</td>
338 </tr> 362 </tr>
339 <tr> 363 <tr>
340 <td><a href="#BugBearVisitor.visit_SetComp">visit_SetComp</a></td> 364 <td><a href="#BugBearVisitor.visit_SetComp">visit_SetComp</a></td>
353 <td>Public method to handle 'while' statements.</td> 377 <td>Public method to handle 'while' statements.</td>
354 </tr> 378 </tr>
355 <tr> 379 <tr>
356 <td><a href="#BugBearVisitor.visit_With">visit_With</a></td> 380 <td><a href="#BugBearVisitor.visit_With">visit_With</a></td>
357 <td>Public method to handle 'with' statements.</td> 381 <td>Public method to handle 'with' statements.</td>
382 </tr>
383 <tr>
384 <td><a href="#BugBearVisitor.visit_Yield">visit_Yield</a></td>
385 <td>Public method to handle 'Yield' nodes.</td>
386 </tr>
387 <tr>
388 <td><a href="#BugBearVisitor.visit_YieldFrom">visit_YieldFrom</a></td>
389 <td>Public method to handle 'YieldFrom' nodes.</td>
358 </tr> 390 </tr>
359 </table> 391 </table>
360 392
361 <h3>Static Methods</h3> 393 <h3>Static Methods</h3>
362 <table> 394 <table>
661 reference to the node to be processed 693 reference to the node to be processed
662 </dd> 694 </dd>
663 </dl> 695 </dl>
664 <a NAME="BugBearVisitor.__checkForM535" ID="BugBearVisitor.__checkForM535"></a> 696 <a NAME="BugBearVisitor.__checkForM535" ID="BugBearVisitor.__checkForM535"></a>
665 <h4>BugBearVisitor.__checkForM535</h4> 697 <h4>BugBearVisitor.__checkForM535</h4>
666 <b>__checkForM535</b>(<i>node: ast.DictComp</i>) 698 <b>__checkForM535</b>(<i>node</i>)
667 <p> 699 <p>
668 Private method to check that a static key isn't used in a dict comprehension. 700 Private method to check that a static key isn't used in a dict comprehension.
669 </p> 701 </p>
670 <p> 702 <p>
671 Record a warning if a likely unchanging key is used - either a constant, 703 Record a warning if a likely unchanging key is used - either a constant,
675 <dl> 707 <dl>
676 708
677 <dt><i>node</i> (ast.DictComp)</dt> 709 <dt><i>node</i> (ast.DictComp)</dt>
678 <dd> 710 <dd>
679 reference to the node to be processed 711 reference to the node to be processed
712 </dd>
713 </dl>
714 <a NAME="BugBearVisitor.__checkForM538" ID="BugBearVisitor.__checkForM538"></a>
715 <h4>BugBearVisitor.__checkForM538</h4>
716 <b>__checkForM538</b>(<i>node</i>)
717 <p>
718 Private method to check for changes to a loop's mutable iterable.
719 </p>
720
721 <dl>
722
723 <dt><i>node</i> (ast.For)</dt>
724 <dd>
725 loop node to be checked
680 </dd> 726 </dd>
681 </dl> 727 </dl>
682 <a NAME="BugBearVisitor.__checkRedundantExcepthandlers" ID="BugBearVisitor.__checkRedundantExcepthandlers"></a> 728 <a NAME="BugBearVisitor.__checkRedundantExcepthandlers" ID="BugBearVisitor.__checkRedundantExcepthandlers"></a>
683 <h4>BugBearVisitor.__checkRedundantExcepthandlers</h4> 729 <h4>BugBearVisitor.__checkRedundantExcepthandlers</h4>
684 <b>__checkRedundantExcepthandlers</b>(<i>names, node</i>) 730 <b>__checkRedundantExcepthandlers</b>(<i>names, node</i>)
811 <dt>Yield Type:</dt> 857 <dt>Yield Type:</dt>
812 <dd> 858 <dd>
813 TYPE 859 TYPE
814 </dd> 860 </dd>
815 </dl> 861 </dl>
816 <a NAME="BugBearVisitor.__getDictCompLoopVarNames" ID="BugBearVisitor.__getDictCompLoopVarNames"></a> 862 <a NAME="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames" ID="BugBearVisitor.__getDictCompLoopAndNamedExprVarNames"></a>
817 <h4>BugBearVisitor.__getDictCompLoopVarNames</h4> 863 <h4>BugBearVisitor.__getDictCompLoopAndNamedExprVarNames</h4>
818 <b>__getDictCompLoopVarNames</b>(<i>node</i>) 864 <b>__getDictCompLoopAndNamedExprVarNames</b>(<i>node</i>)
819 <p> 865 <p>
820 Private method to get the names of comprehension loop variables. 866 Private method to get the names of comprehension loop variables.
821 </p> 867 </p>
822 868
823 <dl> 869 <dl>
863 <dt>Yield Type:</dt> 909 <dt>Yield Type:</dt>
864 <dd> 910 <dd>
865 str 911 str
866 </dd> 912 </dd>
867 </dl> 913 </dl>
914 <a NAME="BugBearVisitor.__inClassInit" ID="BugBearVisitor.__inClassInit"></a>
915 <h4>BugBearVisitor.__inClassInit</h4>
916 <b>__inClassInit</b>(<i></i>)
917 <p>
918 Private method to check, if we are inside an '__init__' method.
919 </p>
920
921 <dl>
922 <dt>Return:</dt>
923 <dd>
924 flag indicating being within the '__init__' method
925 </dd>
926 </dl>
927 <dl>
928 <dt>Return Type:</dt>
929 <dd>
930 bool
931 </dd>
932 </dl>
868 <a NAME="BugBearVisitor.__isIdentifier" ID="BugBearVisitor.__isIdentifier"></a> 933 <a NAME="BugBearVisitor.__isIdentifier" ID="BugBearVisitor.__isIdentifier"></a>
869 <h4>BugBearVisitor.__isIdentifier</h4> 934 <h4>BugBearVisitor.__isIdentifier</h4>
870 <b>__isIdentifier</b>(<i>arg</i>) 935 <b>__isIdentifier</b>(<i>arg</i>)
871 <p> 936 <p>
872 Private method to check if arg is a valid identifier. 937 Private method to check if arg is a valid identifier.
918 <dt>Yield Type:</dt> 983 <dt>Yield Type:</dt>
919 <dd> 984 <dd>
920 str 985 str
921 </dd> 986 </dd>
922 </dl> 987 </dl>
923 <a NAME="BugBearVisitor.__toNameStr" ID="BugBearVisitor.__toNameStr"></a>
924 <h4>BugBearVisitor.__toNameStr</h4>
925 <b>__toNameStr</b>(<i>node</i>)
926 <p>
927 Private method to turn Name and Attribute nodes to strings, handling any
928 depth of attribute accesses.
929 </p>
930 <p>
931
932 </p>
933
934 <dl>
935
936 <dt><i>node</i> (ast.Name or ast.Attribute)</dt>
937 <dd>
938 reference to the node
939 </dd>
940 </dl>
941 <dl>
942 <dt>Return:</dt>
943 <dd>
944 string representation
945 </dd>
946 </dl>
947 <dl>
948 <dt>Return Type:</dt>
949 <dd>
950 str
951 </dd>
952 </dl>
953 <a NAME="BugBearVisitor.__typesafeIssubclass" ID="BugBearVisitor.__typesafeIssubclass"></a> 988 <a NAME="BugBearVisitor.__typesafeIssubclass" ID="BugBearVisitor.__typesafeIssubclass"></a>
954 <h4>BugBearVisitor.__typesafeIssubclass</h4> 989 <h4>BugBearVisitor.__typesafeIssubclass</h4>
955 <b>__typesafeIssubclass</b>(<i>obj, classOrTuple</i>) 990 <b>__typesafeIssubclass</b>(<i>obj, classOrTuple</i>)
956 <p> 991 <p>
957 Private method implementing a type safe issubclass() function. 992 Private method implementing a type safe issubclass() function.
1051 <dt>Return Type:</dt> 1086 <dt>Return Type:</dt>
1052 <dd> 1087 <dd>
1053 list 1088 list
1054 </dd> 1089 </dd>
1055 </dl> 1090 </dl>
1091 <a NAME="BugBearVisitor.toNameStr" ID="BugBearVisitor.toNameStr"></a>
1092 <h4>BugBearVisitor.toNameStr</h4>
1093 <b>toNameStr</b>(<i>node</i>)
1094 <p>
1095 Public method to turn Name and Attribute nodes to strings, handling any
1096 depth of attribute accesses.
1097 </p>
1098 <p>
1099
1100 </p>
1101
1102 <dl>
1103
1104 <dt><i>node</i> (ast.Name or ast.Attribute)</dt>
1105 <dd>
1106 reference to the node
1107 </dd>
1108 </dl>
1109 <dl>
1110 <dt>Return:</dt>
1111 <dd>
1112 string representation
1113 </dd>
1114 </dl>
1115 <dl>
1116 <dt>Return Type:</dt>
1117 <dd>
1118 str
1119 </dd>
1120 </dl>
1056 <a NAME="BugBearVisitor.visit" ID="BugBearVisitor.visit"></a> 1121 <a NAME="BugBearVisitor.visit" ID="BugBearVisitor.visit"></a>
1057 <h4>BugBearVisitor.visit</h4> 1122 <h4>BugBearVisitor.visit</h4>
1058 <b>visit</b>(<i>node</i>) 1123 <b>visit</b>(<i>node</i>)
1059 <p> 1124 <p>
1060 Public method to traverse a given AST node. 1125 Public method to traverse a given AST node.
1317 <dt><i>node</i> (ast.Raise)</dt> 1382 <dt><i>node</i> (ast.Raise)</dt>
1318 <dd> 1383 <dd>
1319 reference to the node to be processed 1384 reference to the node to be processed
1320 </dd> 1385 </dd>
1321 </dl> 1386 </dl>
1387 <a NAME="BugBearVisitor.visit_Return" ID="BugBearVisitor.visit_Return"></a>
1388 <h4>BugBearVisitor.visit_Return</h4>
1389 <b>visit_Return</b>(<i>node</i>)
1390 <p>
1391 Public method to handle 'Return' nodes.
1392 </p>
1393
1394 <dl>
1395
1396 <dt><i>node</i> (ast.Return)</dt>
1397 <dd>
1398 reference to the node to be processed
1399 </dd>
1400 </dl>
1322 <a NAME="BugBearVisitor.visit_Set" ID="BugBearVisitor.visit_Set"></a> 1401 <a NAME="BugBearVisitor.visit_Set" ID="BugBearVisitor.visit_Set"></a>
1323 <h4>BugBearVisitor.visit_Set</h4> 1402 <h4>BugBearVisitor.visit_Set</h4>
1324 <b>visit_Set</b>(<i>node</i>) 1403 <b>visit_Set</b>(<i>node</i>)
1325 <p> 1404 <p>
1326 Public method to check a set. 1405 Public method to check a set.
1397 </p> 1476 </p>
1398 1477
1399 <dl> 1478 <dl>
1400 1479
1401 <dt><i>node</i> (ast.With)</dt> 1480 <dt><i>node</i> (ast.With)</dt>
1481 <dd>
1482 reference to the node to be processed
1483 </dd>
1484 </dl>
1485 <a NAME="BugBearVisitor.visit_Yield" ID="BugBearVisitor.visit_Yield"></a>
1486 <h4>BugBearVisitor.visit_Yield</h4>
1487 <b>visit_Yield</b>(<i>node</i>)
1488 <p>
1489 Public method to handle 'Yield' nodes.
1490 </p>
1491
1492 <dl>
1493
1494 <dt><i>node</i> (ast.Yield)</dt>
1495 <dd>
1496 reference to the node to be processed
1497 </dd>
1498 </dl>
1499 <a NAME="BugBearVisitor.visit_YieldFrom" ID="BugBearVisitor.visit_YieldFrom"></a>
1500 <h4>BugBearVisitor.visit_YieldFrom</h4>
1501 <b>visit_YieldFrom</b>(<i>node</i>)
1502 <p>
1503 Public method to handle 'YieldFrom' nodes.
1504 </p>
1505
1506 <dl>
1507
1508 <dt><i>node</i> (ast.YieldFrom)</dt>
1402 <dd> 1509 <dd>
1403 reference to the node to be processed 1510 reference to the node to be processed
1404 </dd> 1511 </dd>
1405 </dl> 1512 </dl>
1406 <div align="right"><a href="#top">Up</a></div> 1513 <div align="right"><a href="#top">Up</a></div>
1505 </dd> 1612 </dd>
1506 </dl> 1613 </dl>
1507 <div align="right"><a href="#top">Up</a></div> 1614 <div align="right"><a href="#top">Up</a></div>
1508 <hr /> 1615 <hr />
1509 <hr /> 1616 <hr />
1617 <a NAME="ExceptBaseExceptionVisitor" ID="ExceptBaseExceptionVisitor"></a>
1618 <h2>ExceptBaseExceptionVisitor</h2>
1619 <p>
1620 Class to determine, if a 'BaseException' is re-raised.
1621 </p>
1622
1623 <h3>Derived from</h3>
1624 ast.NodeVisitor
1625 <h3>Class Attributes</h3>
1626 <table>
1627 <tr><td>None</td></tr>
1628 </table>
1629
1630 <h3>Class Methods</h3>
1631 <table>
1632 <tr><td>None</td></tr>
1633 </table>
1634
1635 <h3>Methods</h3>
1636 <table>
1637 <tr>
1638 <td><a href="#ExceptBaseExceptionVisitor.__init__">ExceptBaseExceptionVisitor</a></td>
1639 <td>Constructor</td>
1640 </tr>
1641 <tr>
1642 <td><a href="#ExceptBaseExceptionVisitor.reRaised">reRaised</a></td>
1643 <td>Public method to check, if the exception is re-raised.</td>
1644 </tr>
1645 <tr>
1646 <td><a href="#ExceptBaseExceptionVisitor.visit_ExceptHandler">visit_ExceptHandler</a></td>
1647 <td>Public method to handle 'ExceptHandler' nodes.</td>
1648 </tr>
1649 <tr>
1650 <td><a href="#ExceptBaseExceptionVisitor.visit_Raise">visit_Raise</a></td>
1651 <td>Public method to handle 'Raise' nodes.</td>
1652 </tr>
1653 </table>
1654
1655 <h3>Static Methods</h3>
1656 <table>
1657 <tr><td>None</td></tr>
1658 </table>
1659
1660
1661 <a NAME="ExceptBaseExceptionVisitor.__init__" ID="ExceptBaseExceptionVisitor.__init__"></a>
1662 <h4>ExceptBaseExceptionVisitor (Constructor)</h4>
1663 <b>ExceptBaseExceptionVisitor</b>(<i>exceptNode</i>)
1664 <p>
1665 Constructor
1666 </p>
1667
1668 <dl>
1669
1670 <dt><i>exceptNode</i> (ast.ExceptHandler)</dt>
1671 <dd>
1672 exception node to be inspected
1673 </dd>
1674 </dl>
1675 <a NAME="ExceptBaseExceptionVisitor.reRaised" ID="ExceptBaseExceptionVisitor.reRaised"></a>
1676 <h4>ExceptBaseExceptionVisitor.reRaised</h4>
1677 <b>reRaised</b>(<i></i>)
1678 <p>
1679 Public method to check, if the exception is re-raised.
1680 </p>
1681
1682 <dl>
1683 <dt>Return:</dt>
1684 <dd>
1685 flag indicating a re-raised exception
1686 </dd>
1687 </dl>
1688 <dl>
1689 <dt>Return Type:</dt>
1690 <dd>
1691 bool
1692 </dd>
1693 </dl>
1694 <a NAME="ExceptBaseExceptionVisitor.visit_ExceptHandler" ID="ExceptBaseExceptionVisitor.visit_ExceptHandler"></a>
1695 <h4>ExceptBaseExceptionVisitor.visit_ExceptHandler</h4>
1696 <b>visit_ExceptHandler</b>(<i>node: ast.ExceptHandler</i>)
1697 <p>
1698 Public method to handle 'ExceptHandler' nodes.
1699 </p>
1700
1701 <dl>
1702
1703 <dt><i>node</i> (ast.ExceptHandler)</dt>
1704 <dd>
1705 reference to the node to be processed
1706 </dd>
1707 </dl>
1708 <a NAME="ExceptBaseExceptionVisitor.visit_Raise" ID="ExceptBaseExceptionVisitor.visit_Raise"></a>
1709 <h4>ExceptBaseExceptionVisitor.visit_Raise</h4>
1710 <b>visit_Raise</b>(<i>node</i>)
1711 <p>
1712 Public method to handle 'Raise' nodes.
1713 </p>
1714 <p>
1715 If we find a corresponding `raise` or `raise e` where e was from
1716 `except BaseException as e:` then we mark re_raised as True and can
1717 stop scanning.
1718 </p>
1719
1720 <dl>
1721
1722 <dt><i>node</i> (ast.Raise)</dt>
1723 <dd>
1724 reference to the node to be processed
1725 </dd>
1726 </dl>
1727 <div align="right"><a href="#top">Up</a></div>
1728 <hr />
1729 <hr />
1510 <a NAME="M520NameFinder" ID="M520NameFinder"></a> 1730 <a NAME="M520NameFinder" ID="M520NameFinder"></a>
1511 <h2>M520NameFinder</h2> 1731 <h2>M520NameFinder</h2>
1512 <p> 1732 <p>
1513 Class to extract a name out of a tree of nodes ignoring names defined within the 1733 Class to extract a name out of a tree of nodes ignoring names defined within the
1514 local scope of a comprehension. 1734 local scope of a comprehension.
1620 </p> 1840 </p>
1621 1841
1622 <dl> 1842 <dl>
1623 1843
1624 <dt><i>node</i> (ast.comprehension)</dt> 1844 <dt><i>node</i> (ast.comprehension)</dt>
1845 <dd>
1846 reference to the node to be processed
1847 </dd>
1848 </dl>
1849 <div align="right"><a href="#top">Up</a></div>
1850 <hr />
1851 <hr />
1852 <a NAME="M538Checker" ID="M538Checker"></a>
1853 <h2>M538Checker</h2>
1854 <p>
1855 Class traversing a 'for' loop body to check for modifications to a loop's
1856 mutable iterable.
1857 </p>
1858
1859 <h3>Derived from</h3>
1860 ast.NodeVisitor
1861 <h3>Class Attributes</h3>
1862 <table>
1863 <tr><td>MUTATING_FUNCTIONS</td></tr>
1864 </table>
1865
1866 <h3>Class Methods</h3>
1867 <table>
1868 <tr><td>None</td></tr>
1869 </table>
1870
1871 <h3>Methods</h3>
1872 <table>
1873 <tr>
1874 <td><a href="#M538Checker.__init__">M538Checker</a></td>
1875 <td>Constructor</td>
1876 </tr>
1877 <tr>
1878 <td><a href="#M538Checker.visit">visit</a></td>
1879 <td>Public method to inspect an ast node.</td>
1880 </tr>
1881 <tr>
1882 <td><a href="#M538Checker.visit_Call">visit_Call</a></td>
1883 <td>Public method handling 'Call' nodes.</td>
1884 </tr>
1885 <tr>
1886 <td><a href="#M538Checker.visit_Delete">visit_Delete</a></td>
1887 <td>Public method handling 'Delete' nodes.</td>
1888 </tr>
1889 </table>
1890
1891 <h3>Static Methods</h3>
1892 <table>
1893 <tr><td>None</td></tr>
1894 </table>
1895
1896
1897 <a NAME="M538Checker.__init__" ID="M538Checker.__init__"></a>
1898 <h4>M538Checker (Constructor)</h4>
1899 <b>M538Checker</b>(<i>name, bugbear</i>)
1900 <p>
1901 Constructor
1902 </p>
1903
1904 <dl>
1905
1906 <dt><i>name</i> (str)</dt>
1907 <dd>
1908 name of the iterator
1909 </dd>
1910 <dt><i>bugbear</i> (BugBearVisitor)</dt>
1911 <dd>
1912 reference to the bugbear visitor
1913 </dd>
1914 </dl>
1915 <a NAME="M538Checker.visit" ID="M538Checker.visit"></a>
1916 <h4>M538Checker.visit</h4>
1917 <b>visit</b>(<i>node</i>)
1918 <p>
1919 Public method to inspect an ast node.
1920 </p>
1921 <p>
1922 Like super-visit but supports iteration over lists.
1923 </p>
1924
1925 <dl>
1926
1927 <dt><i>node</i> (TYPE)</dt>
1928 <dd>
1929 AST node to be traversed
1930 </dd>
1931 </dl>
1932 <dl>
1933 <dt>Return:</dt>
1934 <dd>
1935 reference to the last processed node
1936 </dd>
1937 </dl>
1938 <dl>
1939 <dt>Return Type:</dt>
1940 <dd>
1941 ast.Node
1942 </dd>
1943 </dl>
1944 <a NAME="M538Checker.visit_Call" ID="M538Checker.visit_Call"></a>
1945 <h4>M538Checker.visit_Call</h4>
1946 <b>visit_Call</b>(<i>node</i>)
1947 <p>
1948 Public method handling 'Call' nodes.
1949 </p>
1950
1951 <dl>
1952
1953 <dt><i>node</i> (ast.Call)</dt>
1954 <dd>
1955 reference to the node to be processed
1956 </dd>
1957 </dl>
1958 <a NAME="M538Checker.visit_Delete" ID="M538Checker.visit_Delete"></a>
1959 <h4>M538Checker.visit_Delete</h4>
1960 <b>visit_Delete</b>(<i>node</i>)
1961 <p>
1962 Public method handling 'Delete' nodes.
1963 </p>
1964
1965 <dl>
1966
1967 <dt><i>node</i> (ast.Delete)</dt>
1625 <dd> 1968 <dd>
1626 reference to the node to be processed 1969 reference to the node to be processed
1627 </dd> 1970 </dd>
1628 </dl> 1971 </dl>
1629 <div align="right"><a href="#top">Up</a></div> 1972 <div align="right"><a href="#top">Up</a></div>
2240 </p> 2583 </p>
2241 2584
2242 <dl> 2585 <dl>
2243 2586
2244 <dt><i>node</i> (ast.Name)</dt> 2587 <dt><i>node</i> (ast.Name)</dt>
2588 <dd>
2589 reference to the node to be processed
2590 </dd>
2591 </dl>
2592 <div align="right"><a href="#top">Up</a></div>
2593 <hr />
2594 <hr />
2595 <a NAME="NamedExprFinder" ID="NamedExprFinder"></a>
2596 <h2>NamedExprFinder</h2>
2597 <p>
2598 Class to extract names defined through an ast.NamedExpr.
2599 </p>
2600
2601 <h3>Derived from</h3>
2602 ast.NodeVisitor
2603 <h3>Class Attributes</h3>
2604 <table>
2605 <tr><td>None</td></tr>
2606 </table>
2607
2608 <h3>Class Methods</h3>
2609 <table>
2610 <tr><td>None</td></tr>
2611 </table>
2612
2613 <h3>Methods</h3>
2614 <table>
2615 <tr>
2616 <td><a href="#NamedExprFinder.__init__">NamedExprFinder</a></td>
2617 <td>Constructor</td>
2618 </tr>
2619 <tr>
2620 <td><a href="#NamedExprFinder.getNames">getNames</a></td>
2621 <td>Public method to return the extracted names and Name nodes.</td>
2622 </tr>
2623 <tr>
2624 <td><a href="#NamedExprFinder.visit">visit</a></td>
2625 <td>Public method to traverse a given AST node.</td>
2626 </tr>
2627 <tr>
2628 <td><a href="#NamedExprFinder.visit_NamedExpr">visit_NamedExpr</a></td>
2629 <td>Public method handling 'NamedExpr' nodes.</td>
2630 </tr>
2631 </table>
2632
2633 <h3>Static Methods</h3>
2634 <table>
2635 <tr><td>None</td></tr>
2636 </table>
2637
2638
2639 <a NAME="NamedExprFinder.__init__" ID="NamedExprFinder.__init__"></a>
2640 <h4>NamedExprFinder (Constructor)</h4>
2641 <b>NamedExprFinder</b>(<i></i>)
2642 <p>
2643 Constructor
2644 </p>
2645
2646 <a NAME="NamedExprFinder.getNames" ID="NamedExprFinder.getNames"></a>
2647 <h4>NamedExprFinder.getNames</h4>
2648 <b>getNames</b>(<i></i>)
2649 <p>
2650 Public method to return the extracted names and Name nodes.
2651 </p>
2652
2653 <dl>
2654 <dt>Return:</dt>
2655 <dd>
2656 dictionary containing the names as keys and the list of nodes
2657 </dd>
2658 </dl>
2659 <dl>
2660 <dt>Return Type:</dt>
2661 <dd>
2662 dict
2663 </dd>
2664 </dl>
2665 <a NAME="NamedExprFinder.visit" ID="NamedExprFinder.visit"></a>
2666 <h4>NamedExprFinder.visit</h4>
2667 <b>visit</b>(<i>node</i>)
2668 <p>
2669 Public method to traverse a given AST node.
2670 </p>
2671 <p>
2672 Like super-visit but supports iteration over lists.
2673 </p>
2674
2675 <dl>
2676
2677 <dt><i>node</i> (TYPE)</dt>
2678 <dd>
2679 AST node to be traversed
2680 </dd>
2681 </dl>
2682 <dl>
2683 <dt>Return:</dt>
2684 <dd>
2685 reference to the last processed node
2686 </dd>
2687 </dl>
2688 <dl>
2689 <dt>Return Type:</dt>
2690 <dd>
2691 ast.Node
2692 </dd>
2693 </dl>
2694 <a NAME="NamedExprFinder.visit_NamedExpr" ID="NamedExprFinder.visit_NamedExpr"></a>
2695 <h4>NamedExprFinder.visit_NamedExpr</h4>
2696 <b>visit_NamedExpr</b>(<i>node: ast.NamedExpr</i>)
2697 <p>
2698 Public method handling 'NamedExpr' nodes.
2699 </p>
2700
2701 <dl>
2702
2703 <dt><i>node</i> (ast.NamedExpr)</dt>
2245 <dd> 2704 <dd>
2246 reference to the node to be processed 2705 reference to the node to be processed
2247 </dd> 2706 </dd>
2248 </dl> 2707 </dl>
2249 <div align="right"><a href="#top">Up</a></div> 2708 <div align="right"><a href="#top">Up</a></div>

eric ide

mercurial