src/eric7/Documentation/Source/eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyNodeVisitor.html

branch
eric7
changeset 9295
d14096c04126
parent 9209
b99e7fd55fd3
child 10047
cc9ead6d1c46
equal deleted inserted replaced
9294:3c12aacd98d8 9295:d14096c04126
58 <tr> 58 <tr>
59 <td><a href="#SimplifyNodeVisitor.__init__">SimplifyNodeVisitor</a></td> 59 <td><a href="#SimplifyNodeVisitor.__init__">SimplifyNodeVisitor</a></td>
60 <td>Constructor</td> 60 <td>Constructor</td>
61 </tr> 61 </tr>
62 <tr> 62 <tr>
63 <td><a href="#SimplifyNodeVisitor.__bodyContainsContinue">__bodyContainsContinue</a></td>
64 <td>Private method to check, if a list of statements contain a 'continue' statement.</td>
65 </tr>
66 <tr>
63 <td><a href="#SimplifyNodeVisitor.__check101">__check101</a></td> 67 <td><a href="#SimplifyNodeVisitor.__check101">__check101</a></td>
64 <td>Private method to check for duplicate isinstance() calls.</td> 68 <td>Private method to check for duplicate isinstance() calls.</td>
65 </tr> 69 </tr>
66 <tr> 70 <tr>
67 <td><a href="#SimplifyNodeVisitor.__check102">__check102</a></td> 71 <td><a href="#SimplifyNodeVisitor.__check102">__check102</a></td>
138 <tr> 142 <tr>
139 <td><a href="#SimplifyNodeVisitor.__check122">__check122</a></td> 143 <td><a href="#SimplifyNodeVisitor.__check122">__check122</a></td>
140 <td>Private method to check for all if-blocks which only check if a key is in a dictionary.</td> 144 <td>Private method to check for all if-blocks which only check if a key is in a dictionary.</td>
141 </tr> 145 </tr>
142 <tr> 146 <tr>
147 <td><a href="#SimplifyNodeVisitor.__check123">__check123</a></td>
148 <td>Private method to check for complicated dictionary access with default value.</td>
149 </tr>
150 <tr>
143 <td><a href="#SimplifyNodeVisitor.__check181">__check181</a></td> 151 <td><a href="#SimplifyNodeVisitor.__check181">__check181</a></td>
144 <td>Private method to check for assignments that could be converted into an augmented assignment.</td> 152 <td>Private method to check for assignments that could be converted into an augmented assignment.</td>
145 </tr> 153 </tr>
146 <tr> 154 <tr>
147 <td><a href="#SimplifyNodeVisitor.__check182">__check182</a></td> 155 <td><a href="#SimplifyNodeVisitor.__check182">__check182</a></td>
218 <tr> 226 <tr>
219 <td><a href="#SimplifyNodeVisitor.__check402">__check402</a></td> 227 <td><a href="#SimplifyNodeVisitor.__check402">__check402</a></td>
220 <td>Private method to check for bare numeric function arguments.</td> 228 <td>Private method to check for bare numeric function arguments.</td>
221 </tr> 229 </tr>
222 <tr> 230 <tr>
231 <td><a href="#SimplifyNodeVisitor.__check901">__check901</a></td>
232 <td>Private method to check for unnecessary bool conversion.</td>
233 </tr>
234 <tr>
235 <td><a href="#SimplifyNodeVisitor.__check904">__check904</a></td>
236 <td>Private method to check for dictionary initialization.</td>
237 </tr>
238 <tr>
239 <td><a href="#SimplifyNodeVisitor.__check905">__check905</a></td>
240 <td>Private method to check for list initialization by splitting a string.</td>
241 </tr>
242 <tr>
243 <td><a href="#SimplifyNodeVisitor.__check906">__check906</a></td>
244 <td>Private method to check for unnecessary nesting of os.path.join().</td>
245 </tr>
246 <tr>
247 <td><a href="#SimplifyNodeVisitor.__check907">__check907</a></td>
248 <td>Private method to check for Union type annotation with None.</td>
249 </tr>
250 <tr>
251 <td><a href="#SimplifyNodeVisitor.__check909">__check909</a></td>
252 <td>Private method to check for reflexive assignments.</td>
253 </tr>
254 <tr>
255 <td><a href="#SimplifyNodeVisitor.__expressionUsesVariable">__expressionUsesVariable</a></td>
256 <td>Private method to check, if a variable is used by an expression.</td>
257 </tr>
258 <tr>
223 <td><a href="#SimplifyNodeVisitor.__getDuplicatedIsinstanceCall">__getDuplicatedIsinstanceCall</a></td> 259 <td><a href="#SimplifyNodeVisitor.__getDuplicatedIsinstanceCall">__getDuplicatedIsinstanceCall</a></td>
224 <td>Private method to get a list of isinstance arguments which could be combined.</td> 260 <td>Private method to get a list of isinstance arguments which could be combined.</td>
225 </tr> 261 </tr>
226 <tr> 262 <tr>
227 <td><a href="#SimplifyNodeVisitor.__getIfBodyPairs">__getIfBodyPairs</a></td> 263 <td><a href="#SimplifyNodeVisitor.__getIfBodyPairs">__getIfBodyPairs</a></td>
228 <td>Private method to extract a list of pairs of test and body for an If node.</td> 264 <td>Private method to extract a list of pairs of test and body for an If node.</td>
229 </tr> 265 </tr>
230 <tr> 266 <tr>
231 <td><a href="#SimplifyNodeVisitor.__isConstantIncrease">__isConstantIncrease</a></td> 267 <td><a href="#SimplifyNodeVisitor.__isConstantIncrease">__isConstantIncrease</a></td>
232 <td>Private method check the given expression for being a constant increase.</td> 268 <td>Private method to check an expression for being a constant increase.</td>
233 </tr> 269 </tr>
234 <tr> 270 <tr>
235 <td><a href="#SimplifyNodeVisitor.__isExceptionCheck">__isExceptionCheck</a></td> 271 <td><a href="#SimplifyNodeVisitor.__isExceptionCheck">__isExceptionCheck</a></td>
236 <td>Private method to check, if the node is checking an exception.</td> 272 <td>Private method to check, if the node is checking an exception.</td>
237 </tr> 273 </tr>
250 <tr> 286 <tr>
251 <td><a href="#SimplifyNodeVisitor.__negateTest">__negateTest</a></td> 287 <td><a href="#SimplifyNodeVisitor.__negateTest">__negateTest</a></td>
252 <td>Private method negate the given Compare node.</td> 288 <td>Private method negate the given Compare node.</td>
253 </tr> 289 </tr>
254 <tr> 290 <tr>
291 <td><a href="#SimplifyNodeVisitor.getOsPathJoinArgs">getOsPathJoinArgs</a></td>
292 <td></td>
293 </tr>
294 <tr>
255 <td><a href="#SimplifyNodeVisitor.visit_Assign">visit_Assign</a></td> 295 <td><a href="#SimplifyNodeVisitor.visit_Assign">visit_Assign</a></td>
256 <td>Public method to process an Assign node.</td> 296 <td>Public method to process an Assign node.</td>
257 </tr> 297 </tr>
258 <tr> 298 <tr>
259 <td><a href="#SimplifyNodeVisitor.visit_BoolOp">visit_BoolOp</a></td> 299 <td><a href="#SimplifyNodeVisitor.visit_BoolOp">visit_BoolOp</a></td>
284 <td>Public method to process an If node.</td> 324 <td>Public method to process an If node.</td>
285 </tr> 325 </tr>
286 <tr> 326 <tr>
287 <td><a href="#SimplifyNodeVisitor.visit_IfExp">visit_IfExp</a></td> 327 <td><a href="#SimplifyNodeVisitor.visit_IfExp">visit_IfExp</a></td>
288 <td>Public method to process an IfExp node.</td> 328 <td>Public method to process an IfExp node.</td>
329 </tr>
330 <tr>
331 <td><a href="#SimplifyNodeVisitor.visit_Subscript">visit_Subscript</a></td>
332 <td>Public method to process a Subscript node.</td>
289 </tr> 333 </tr>
290 <tr> 334 <tr>
291 <td><a href="#SimplifyNodeVisitor.visit_Try">visit_Try</a></td> 335 <td><a href="#SimplifyNodeVisitor.visit_Try">visit_Try</a></td>
292 <td>Public method to process a Try node.</td> 336 <td>Public method to process a Try node.</td>
293 </tr> 337 </tr>
316 <dl> 360 <dl>
317 361
318 <dt><i>errorCallback</i> (func)</dt> 362 <dt><i>errorCallback</i> (func)</dt>
319 <dd> 363 <dd>
320 callback function to register an error 364 callback function to register an error
365 </dd>
366 </dl>
367 <a NAME="SimplifyNodeVisitor.__bodyContainsContinue" ID="SimplifyNodeVisitor.__bodyContainsContinue"></a>
368 <h4>SimplifyNodeVisitor.__bodyContainsContinue</h4>
369 <b>__bodyContainsContinue</b>(<i>stmts</i>)
370
371 <p>
372 Private method to check, if a list of statements contain a 'continue' statement.
373 </p>
374 <dl>
375
376 <dt><i>stmts</i> (list of ast.stmt)</dt>
377 <dd>
378 list of statements
379 </dd>
380 </dl>
381 <dl>
382 <dt>Return:</dt>
383 <dd>
384 flag indicating a continue statement
385 </dd>
386 </dl>
387 <dl>
388 <dt>Return Type:</dt>
389 <dd>
390 bool
321 </dd> 391 </dd>
322 </dl> 392 </dl>
323 <a NAME="SimplifyNodeVisitor.__check101" ID="SimplifyNodeVisitor.__check101"></a> 393 <a NAME="SimplifyNodeVisitor.__check101" ID="SimplifyNodeVisitor.__check101"></a>
324 <h4>SimplifyNodeVisitor.__check101</h4> 394 <h4>SimplifyNodeVisitor.__check101</h4>
325 <b>__check101</b>(<i>node</i>) 395 <b>__check101</b>(<i>node</i>)
614 <dt><i>node</i> (ast.If)</dt> 684 <dt><i>node</i> (ast.If)</dt>
615 <dd> 685 <dd>
616 reference to the AST node to be checked 686 reference to the AST node to be checked
617 </dd> 687 </dd>
618 </dl> 688 </dl>
689 <a NAME="SimplifyNodeVisitor.__check123" ID="SimplifyNodeVisitor.__check123"></a>
690 <h4>SimplifyNodeVisitor.__check123</h4>
691 <b>__check123</b>(<i>node</i>)
692
693 <p>
694 Private method to check for complicated dictionary access with default value.
695 </p>
696 <dl>
697
698 <dt><i>node</i> (ast.If)</dt>
699 <dd>
700 reference to the AST node to be checked
701 </dd>
702 </dl>
619 <a NAME="SimplifyNodeVisitor.__check181" ID="SimplifyNodeVisitor.__check181"></a> 703 <a NAME="SimplifyNodeVisitor.__check181" ID="SimplifyNodeVisitor.__check181"></a>
620 <h4>SimplifyNodeVisitor.__check181</h4> 704 <h4>SimplifyNodeVisitor.__check181</h4>
621 <b>__check181</b>(<i>node</i>) 705 <b>__check181</b>(<i>node</i>)
622 706
623 <p> 707 <p>
899 <dt><i>node</i> (ast.Call)</dt> 983 <dt><i>node</i> (ast.Call)</dt>
900 <dd> 984 <dd>
901 reference to the AST node to be checked 985 reference to the AST node to be checked
902 </dd> 986 </dd>
903 </dl> 987 </dl>
988 <a NAME="SimplifyNodeVisitor.__check901" ID="SimplifyNodeVisitor.__check901"></a>
989 <h4>SimplifyNodeVisitor.__check901</h4>
990 <b>__check901</b>(<i>node</i>)
991
992 <p>
993 Private method to check for unnecessary bool conversion.
994 </p>
995 <dl>
996
997 <dt><i>node</i> (ast.Call)</dt>
998 <dd>
999 reference to the AST node to be checked
1000 </dd>
1001 </dl>
1002 <a NAME="SimplifyNodeVisitor.__check904" ID="SimplifyNodeVisitor.__check904"></a>
1003 <h4>SimplifyNodeVisitor.__check904</h4>
1004 <b>__check904</b>(<i>node</i>)
1005
1006 <p>
1007 Private method to check for dictionary initialization.
1008 </p>
1009 <dl>
1010
1011 <dt><i>node</i> (ast.Assign)</dt>
1012 <dd>
1013 reference to the AST node to be checked
1014 </dd>
1015 </dl>
1016 <a NAME="SimplifyNodeVisitor.__check905" ID="SimplifyNodeVisitor.__check905"></a>
1017 <h4>SimplifyNodeVisitor.__check905</h4>
1018 <b>__check905</b>(<i>node</i>)
1019
1020 <p>
1021 Private method to check for list initialization by splitting a string.
1022 </p>
1023 <dl>
1024
1025 <dt><i>node</i> (ast.Call)</dt>
1026 <dd>
1027 reference to the AST node to be checked
1028 </dd>
1029 </dl>
1030 <a NAME="SimplifyNodeVisitor.__check906" ID="SimplifyNodeVisitor.__check906"></a>
1031 <h4>SimplifyNodeVisitor.__check906</h4>
1032 <b>__check906</b>(<i>node</i>)
1033
1034 <p>
1035 Private method to check for unnecessary nesting of os.path.join().
1036 </p>
1037 <dl>
1038
1039 <dt><i>node</i> (ast.Call)</dt>
1040 <dd>
1041 reference to the AST node to be checked
1042 </dd>
1043 </dl>
1044 <a NAME="SimplifyNodeVisitor.__check907" ID="SimplifyNodeVisitor.__check907"></a>
1045 <h4>SimplifyNodeVisitor.__check907</h4>
1046 <b>__check907</b>(<i>node</i>)
1047
1048 <p>
1049 Private method to check for Union type annotation with None.
1050 </p>
1051 <dl>
1052
1053 <dt><i>node</i> (ast.Subscript)</dt>
1054 <dd>
1055 reference to the AST node to be checked
1056 </dd>
1057 </dl>
1058 <a NAME="SimplifyNodeVisitor.__check909" ID="SimplifyNodeVisitor.__check909"></a>
1059 <h4>SimplifyNodeVisitor.__check909</h4>
1060 <b>__check909</b>(<i>node</i>)
1061
1062 <p>
1063 Private method to check for reflexive assignments.
1064 </p>
1065 <dl>
1066
1067 <dt><i>node</i> (ast.Assign)</dt>
1068 <dd>
1069 reference to the AST node to be checked
1070 </dd>
1071 </dl>
1072 <a NAME="SimplifyNodeVisitor.__expressionUsesVariable" ID="SimplifyNodeVisitor.__expressionUsesVariable"></a>
1073 <h4>SimplifyNodeVisitor.__expressionUsesVariable</h4>
1074 <b>__expressionUsesVariable</b>(<i>expr, var</i>)
1075
1076 <p>
1077 Private method to check, if a variable is used by an expression.
1078 </p>
1079 <dl>
1080
1081 <dt><i>expr</i> (ast.expr)</dt>
1082 <dd>
1083 expression node to be checked
1084 </dd>
1085 <dt><i>var</i> (str)</dt>
1086 <dd>
1087 variable name to be checked for
1088 </dd>
1089 </dl>
1090 <dl>
1091 <dt>Return:</dt>
1092 <dd>
1093 flag indicating the expression uses the variable
1094 </dd>
1095 </dl>
1096 <dl>
1097 <dt>Return Type:</dt>
1098 <dd>
1099 bool
1100 </dd>
1101 </dl>
904 <a NAME="SimplifyNodeVisitor.__getDuplicatedIsinstanceCall" ID="SimplifyNodeVisitor.__getDuplicatedIsinstanceCall"></a> 1102 <a NAME="SimplifyNodeVisitor.__getDuplicatedIsinstanceCall" ID="SimplifyNodeVisitor.__getDuplicatedIsinstanceCall"></a>
905 <h4>SimplifyNodeVisitor.__getDuplicatedIsinstanceCall</h4> 1103 <h4>SimplifyNodeVisitor.__getDuplicatedIsinstanceCall</h4>
906 <b>__getDuplicatedIsinstanceCall</b>(<i>node</i>) 1104 <b>__getDuplicatedIsinstanceCall</b>(<i>node</i>)
907 1105
908 <p> 1106 <p>
955 list of tuples of (ast.expr, [ast.stmt]) 1153 list of tuples of (ast.expr, [ast.stmt])
956 </dd> 1154 </dd>
957 </dl> 1155 </dl>
958 <a NAME="SimplifyNodeVisitor.__isConstantIncrease" ID="SimplifyNodeVisitor.__isConstantIncrease"></a> 1156 <a NAME="SimplifyNodeVisitor.__isConstantIncrease" ID="SimplifyNodeVisitor.__isConstantIncrease"></a>
959 <h4>SimplifyNodeVisitor.__isConstantIncrease</h4> 1157 <h4>SimplifyNodeVisitor.__isConstantIncrease</h4>
960 <b>__isConstantIncrease</b>(<i>expression</i>) 1158 <b>__isConstantIncrease</b>(<i>expr</i>)
961 1159
962 <p> 1160 <p>
963 Private method check the given expression for being a constant 1161 Private method to check an expression for being a constant increase.
964 increase. 1162 </p>
965 </p> 1163 <dl>
966 <dl> 1164
967 1165 <dt><i>expr</i> (ast.AugAssign)</dt>
968 <dt><i>expression</i> (ast.AugAssign)</dt> 1166 <dd>
969 <dd> 1167 reference to the node to be checked
970 reference to the expression node
971 </dd> 1168 </dd>
972 </dl> 1169 </dl>
973 <dl> 1170 <dl>
974 <dt>Return:</dt> 1171 <dt>Return:</dt>
975 <dd> 1172 <dd>
1122 <dt>Return Type:</dt> 1319 <dt>Return Type:</dt>
1123 <dd> 1320 <dd>
1124 ast.Compare 1321 ast.Compare
1125 </dd> 1322 </dd>
1126 </dl> 1323 </dl>
1324 <a NAME="SimplifyNodeVisitor.getOsPathJoinArgs" ID="SimplifyNodeVisitor.getOsPathJoinArgs"></a>
1325 <h4>SimplifyNodeVisitor.getOsPathJoinArgs</h4>
1326 <b>getOsPathJoinArgs</b>(<i></i>)
1327
1127 <a NAME="SimplifyNodeVisitor.visit_Assign" ID="SimplifyNodeVisitor.visit_Assign"></a> 1328 <a NAME="SimplifyNodeVisitor.visit_Assign" ID="SimplifyNodeVisitor.visit_Assign"></a>
1128 <h4>SimplifyNodeVisitor.visit_Assign</h4> 1329 <h4>SimplifyNodeVisitor.visit_Assign</h4>
1129 <b>visit_Assign</b>(<i>node</i>) 1330 <b>visit_Assign</b>(<i>node</i>)
1130 1331
1131 <p> 1332 <p>
1248 <dt><i>node</i> (ast.IfExp)</dt> 1449 <dt><i>node</i> (ast.IfExp)</dt>
1249 <dd> 1450 <dd>
1250 reference to the IfExp node 1451 reference to the IfExp node
1251 </dd> 1452 </dd>
1252 </dl> 1453 </dl>
1454 <a NAME="SimplifyNodeVisitor.visit_Subscript" ID="SimplifyNodeVisitor.visit_Subscript"></a>
1455 <h4>SimplifyNodeVisitor.visit_Subscript</h4>
1456 <b>visit_Subscript</b>(<i>node</i>)
1457
1458 <p>
1459 Public method to process a Subscript node.
1460 </p>
1461 <dl>
1462
1463 <dt><i>node</i> (ast.Subscript)</dt>
1464 <dd>
1465 reference to the Subscript node
1466 </dd>
1467 </dl>
1253 <a NAME="SimplifyNodeVisitor.visit_Try" ID="SimplifyNodeVisitor.visit_Try"></a> 1468 <a NAME="SimplifyNodeVisitor.visit_Try" ID="SimplifyNodeVisitor.visit_Try"></a>
1254 <h4>SimplifyNodeVisitor.visit_Try</h4> 1469 <h4>SimplifyNodeVisitor.visit_Try</h4>
1255 <b>visit_Try</b>(<i>node</i>) 1470 <b>visit_Try</b>(<i>node</i>)
1256 1471
1257 <p> 1472 <p>

eric ide

mercurial