|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyNodeVisitor</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyNodeVisitor</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a node visitor checking for code that could be simplified. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>AST_CONST_TYPES</td></tr><tr><td>BOOL_CONST_TYPES</td></tr><tr><td>STR_TYPES</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#SimplifyNodeVisitor">SimplifyNodeVisitor</a></td> |
|
25 <td>Class to traverse the AST node tree and check for code that can be simplified.</td> |
|
26 </tr> |
|
27 </table> |
|
28 <h3>Functions</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <hr /> |
|
34 <hr /> |
|
35 <a NAME="SimplifyNodeVisitor" ID="SimplifyNodeVisitor"></a> |
|
36 <h2>SimplifyNodeVisitor</h2> |
|
37 |
|
38 <p> |
|
39 Class to traverse the AST node tree and check for code that can be |
|
40 simplified. |
|
41 </p> |
|
42 <h3>Derived from</h3> |
|
43 ast.NodeVisitor |
|
44 <h3>Class Attributes</h3> |
|
45 |
|
46 <table> |
|
47 <tr><td>None</td></tr> |
|
48 </table> |
|
49 <h3>Class Methods</h3> |
|
50 |
|
51 <table> |
|
52 <tr><td>None</td></tr> |
|
53 </table> |
|
54 <h3>Methods</h3> |
|
55 |
|
56 <table> |
|
57 |
|
58 <tr> |
|
59 <td><a href="#SimplifyNodeVisitor.__init__">SimplifyNodeVisitor</a></td> |
|
60 <td>Constructor</td> |
|
61 </tr> |
|
62 <tr> |
|
63 <td><a href="#SimplifyNodeVisitor.__check101">__check101</a></td> |
|
64 <td>Private method to check for duplicate isinstance() calls.</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#SimplifyNodeVisitor.__check102">__check102</a></td> |
|
68 <td>Private method to check for nested if statements without else blocks.</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#SimplifyNodeVisitor.__check103">__check103</a></td> |
|
72 <td>Private method to check for calls that wrap a condition to return a bool.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#SimplifyNodeVisitor.__check104">__check104</a></td> |
|
76 <td>Private method to check for "iterate and yield" patterns.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#SimplifyNodeVisitor.__check105">__check105</a></td> |
|
80 <td>Private method to check for "try-except-pass" patterns.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#SimplifyNodeVisitor.__check106">__check106</a></td> |
|
84 <td>Private method to check for calls where an exception is raised in else.</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#SimplifyNodeVisitor.__check107">__check107</a></td> |
|
88 <td>Private method to check for calls where try/except and finally have 'return'.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#SimplifyNodeVisitor.__check108">__check108</a></td> |
|
92 <td>Private method to check for if-elses which could be a ternary operator assignment.</td> |
|
93 </tr> |
|
94 <tr> |
|
95 <td><a href="#SimplifyNodeVisitor.__check109">__check109</a></td> |
|
96 <td>Private method to check for multiple equalities with the same value are combined via "or".</td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td><a href="#SimplifyNodeVisitor.__check110_111">__check110_111</a></td> |
|
100 <td>Private method to check if any / all could be used.</td> |
|
101 </tr> |
|
102 <tr> |
|
103 <td><a href="#SimplifyNodeVisitor.__check112">__check112</a></td> |
|
104 <td>Private method to check for non-capitalized calls to environment variables.</td> |
|
105 </tr> |
|
106 <tr> |
|
107 <td><a href="#SimplifyNodeVisitor.__check113">__check113</a></td> |
|
108 <td>Private method to check for loops in which "enumerate" should be used.</td> |
|
109 </tr> |
|
110 <tr> |
|
111 <td><a href="#SimplifyNodeVisitor.__check114">__check114</a></td> |
|
112 <td>Private method to check for alternative if clauses with identical bodies.</td> |
|
113 </tr> |
|
114 <tr> |
|
115 <td><a href="#SimplifyNodeVisitor.__check115">__check115</a></td> |
|
116 <td>Private method to to check for places where open() is called without a context handler.</td> |
|
117 </tr> |
|
118 <tr> |
|
119 <td><a href="#SimplifyNodeVisitor.__check116">__check116</a></td> |
|
120 <td>Private method to check for places with 3 or more consecutive if-statements with direct returns.</td> |
|
121 </tr> |
|
122 <tr> |
|
123 <td><a href="#SimplifyNodeVisitor.__check117">__check117</a></td> |
|
124 <td>Private method to check for multiple with-statements with same scope.</td> |
|
125 </tr> |
|
126 <tr> |
|
127 <td><a href="#SimplifyNodeVisitor.__check118">__check118</a></td> |
|
128 <td>Private method to check for usages of "key in dict.keys()".</td> |
|
129 </tr> |
|
130 <tr> |
|
131 <td><a href="#SimplifyNodeVisitor.__check119">__check119</a></td> |
|
132 <td>Private method to check for classes that should be "dataclasses".</td> |
|
133 </tr> |
|
134 <tr> |
|
135 <td><a href="#SimplifyNodeVisitor.__check120_121">__check120_121</a></td> |
|
136 <td>Private method to check for classes that inherit from object.</td> |
|
137 </tr> |
|
138 <tr> |
|
139 <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> |
|
141 </tr> |
|
142 <tr> |
|
143 <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> |
|
145 </tr> |
|
146 <tr> |
|
147 <td><a href="#SimplifyNodeVisitor.__check182">__check182</a></td> |
|
148 <td>Private method to check for calls of type 'super()' that could be shortened to 'super()'.</td> |
|
149 </tr> |
|
150 <tr> |
|
151 <td><a href="#SimplifyNodeVisitor.__check201">__check201</a></td> |
|
152 <td>Private method to check for calls where an unary 'not' is used for an unequality.</td> |
|
153 </tr> |
|
154 <tr> |
|
155 <td><a href="#SimplifyNodeVisitor.__check202">__check202</a></td> |
|
156 <td>Private method to check for calls where an unary 'not' is used for an equality.</td> |
|
157 </tr> |
|
158 <tr> |
|
159 <td><a href="#SimplifyNodeVisitor.__check203">__check203</a></td> |
|
160 <td>Private method to check for calls where an unary 'not' is used for an in-check.</td> |
|
161 </tr> |
|
162 <tr> |
|
163 <td><a href="#SimplifyNodeVisitor.__check204">__check204</a></td> |
|
164 <td>Private method to check for calls of the type "not (a < b)".</td> |
|
165 </tr> |
|
166 <tr> |
|
167 <td><a href="#SimplifyNodeVisitor.__check205">__check205</a></td> |
|
168 <td>Private method to check for calls of the type "not (a <= b)".</td> |
|
169 </tr> |
|
170 <tr> |
|
171 <td><a href="#SimplifyNodeVisitor.__check206">__check206</a></td> |
|
172 <td>Private method to check for calls of the type "not (a > b)".</td> |
|
173 </tr> |
|
174 <tr> |
|
175 <td><a href="#SimplifyNodeVisitor.__check207">__check207</a></td> |
|
176 <td>Private method to check for calls of the type "not (a >= b)".</td> |
|
177 </tr> |
|
178 <tr> |
|
179 <td><a href="#SimplifyNodeVisitor.__check208">__check208</a></td> |
|
180 <td>Private method to check for calls of the type "not (not a)".</td> |
|
181 </tr> |
|
182 <tr> |
|
183 <td><a href="#SimplifyNodeVisitor.__check211">__check211</a></td> |
|
184 <td>Private method to check for calls of the type "True if a else False".</td> |
|
185 </tr> |
|
186 <tr> |
|
187 <td><a href="#SimplifyNodeVisitor.__check212">__check212</a></td> |
|
188 <td>Private method to check for calls of the type "False if a else True".</td> |
|
189 </tr> |
|
190 <tr> |
|
191 <td><a href="#SimplifyNodeVisitor.__check213">__check213</a></td> |
|
192 <td>Private method to check for calls of the type "b if not a else a".</td> |
|
193 </tr> |
|
194 <tr> |
|
195 <td><a href="#SimplifyNodeVisitor.__check221">__check221</a></td> |
|
196 <td>Private method to check for calls of the type "a and not a".</td> |
|
197 </tr> |
|
198 <tr> |
|
199 <td><a href="#SimplifyNodeVisitor.__check222">__check222</a></td> |
|
200 <td>Private method to check for calls of the type "a or not a".</td> |
|
201 </tr> |
|
202 <tr> |
|
203 <td><a href="#SimplifyNodeVisitor.__check223">__check223</a></td> |
|
204 <td>Private method to check for calls of the type "...</td> |
|
205 </tr> |
|
206 <tr> |
|
207 <td><a href="#SimplifyNodeVisitor.__check224">__check224</a></td> |
|
208 <td>Private method to check for calls of the type "...</td> |
|
209 </tr> |
|
210 <tr> |
|
211 <td><a href="#SimplifyNodeVisitor.__check301">__check301</a></td> |
|
212 <td>Private method to check for Yoda conditions.</td> |
|
213 </tr> |
|
214 <tr> |
|
215 <td><a href="#SimplifyNodeVisitor.__check401">__check401</a></td> |
|
216 <td>Private method to check for bare boolean function arguments.</td> |
|
217 </tr> |
|
218 <tr> |
|
219 <td><a href="#SimplifyNodeVisitor.__check402">__check402</a></td> |
|
220 <td>Private method to check for bare numeric function arguments.</td> |
|
221 </tr> |
|
222 <tr> |
|
223 <td><a href="#SimplifyNodeVisitor.__getDuplicatedIsinstanceCall">__getDuplicatedIsinstanceCall</a></td> |
|
224 <td>Private method to get a list of isinstance arguments which could be combined.</td> |
|
225 </tr> |
|
226 <tr> |
|
227 <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> |
|
229 </tr> |
|
230 <tr> |
|
231 <td><a href="#SimplifyNodeVisitor.__isConstantIncrease">__isConstantIncrease</a></td> |
|
232 <td>Private method check the given expression for being a constant increase.</td> |
|
233 </tr> |
|
234 <tr> |
|
235 <td><a href="#SimplifyNodeVisitor.__isExceptionCheck">__isExceptionCheck</a></td> |
|
236 <td>Private method to check, if the node is checking an exception.</td> |
|
237 </tr> |
|
238 <tr> |
|
239 <td><a href="#SimplifyNodeVisitor.__isSameBody">__isSameBody</a></td> |
|
240 <td>Private method check, if the given bodies are equivalent.</td> |
|
241 </tr> |
|
242 <tr> |
|
243 <td><a href="#SimplifyNodeVisitor.__isSameExpression">__isSameExpression</a></td> |
|
244 <td>Private method to check, if two expressions are equal.</td> |
|
245 </tr> |
|
246 <tr> |
|
247 <td><a href="#SimplifyNodeVisitor.__isStatementEqual">__isStatementEqual</a></td> |
|
248 <td>Private method to check, if two statements are equal.</td> |
|
249 </tr> |
|
250 <tr> |
|
251 <td><a href="#SimplifyNodeVisitor.__negateTest">__negateTest</a></td> |
|
252 <td>Private method negate the given Compare node.</td> |
|
253 </tr> |
|
254 <tr> |
|
255 <td><a href="#SimplifyNodeVisitor.visit_Assign">visit_Assign</a></td> |
|
256 <td>Public method to process an Assign node.</td> |
|
257 </tr> |
|
258 <tr> |
|
259 <td><a href="#SimplifyNodeVisitor.visit_BoolOp">visit_BoolOp</a></td> |
|
260 <td>Public method to process a BoolOp node.</td> |
|
261 </tr> |
|
262 <tr> |
|
263 <td><a href="#SimplifyNodeVisitor.visit_Call">visit_Call</a></td> |
|
264 <td>Public method to process a Call node.</td> |
|
265 </tr> |
|
266 <tr> |
|
267 <td><a href="#SimplifyNodeVisitor.visit_ClassDef">visit_ClassDef</a></td> |
|
268 <td>Public method to process a ClassDef node.</td> |
|
269 </tr> |
|
270 <tr> |
|
271 <td><a href="#SimplifyNodeVisitor.visit_Compare">visit_Compare</a></td> |
|
272 <td>Public method to process a Compare node.</td> |
|
273 </tr> |
|
274 <tr> |
|
275 <td><a href="#SimplifyNodeVisitor.visit_Expr">visit_Expr</a></td> |
|
276 <td>Public method to process an Expr node.</td> |
|
277 </tr> |
|
278 <tr> |
|
279 <td><a href="#SimplifyNodeVisitor.visit_For">visit_For</a></td> |
|
280 <td>Public method to process a For node.</td> |
|
281 </tr> |
|
282 <tr> |
|
283 <td><a href="#SimplifyNodeVisitor.visit_If">visit_If</a></td> |
|
284 <td>Public method to process an If node.</td> |
|
285 </tr> |
|
286 <tr> |
|
287 <td><a href="#SimplifyNodeVisitor.visit_IfExp">visit_IfExp</a></td> |
|
288 <td>Public method to process an IfExp node.</td> |
|
289 </tr> |
|
290 <tr> |
|
291 <td><a href="#SimplifyNodeVisitor.visit_Try">visit_Try</a></td> |
|
292 <td>Public method to process a Try node.</td> |
|
293 </tr> |
|
294 <tr> |
|
295 <td><a href="#SimplifyNodeVisitor.visit_UnaryOp">visit_UnaryOp</a></td> |
|
296 <td>Public method to process a UnaryOp node.</td> |
|
297 </tr> |
|
298 <tr> |
|
299 <td><a href="#SimplifyNodeVisitor.visit_With">visit_With</a></td> |
|
300 <td>Public method to process a With node.</td> |
|
301 </tr> |
|
302 </table> |
|
303 <h3>Static Methods</h3> |
|
304 |
|
305 <table> |
|
306 <tr><td>None</td></tr> |
|
307 </table> |
|
308 |
|
309 <a NAME="SimplifyNodeVisitor.__init__" ID="SimplifyNodeVisitor.__init__"></a> |
|
310 <h4>SimplifyNodeVisitor (Constructor)</h4> |
|
311 <b>SimplifyNodeVisitor</b>(<i>errorCallback</i>) |
|
312 |
|
313 <p> |
|
314 Constructor |
|
315 </p> |
|
316 <dl> |
|
317 |
|
318 <dt><i>errorCallback</i> (func)</dt> |
|
319 <dd> |
|
320 callback function to register an error |
|
321 </dd> |
|
322 </dl> |
|
323 <a NAME="SimplifyNodeVisitor.__check101" ID="SimplifyNodeVisitor.__check101"></a> |
|
324 <h4>SimplifyNodeVisitor.__check101</h4> |
|
325 <b>__check101</b>(<i>node</i>) |
|
326 |
|
327 <p> |
|
328 Private method to check for duplicate isinstance() calls. |
|
329 </p> |
|
330 <dl> |
|
331 |
|
332 <dt><i>node</i> (ast.BoolOp)</dt> |
|
333 <dd> |
|
334 reference to the AST node to be checked |
|
335 </dd> |
|
336 </dl> |
|
337 <a NAME="SimplifyNodeVisitor.__check102" ID="SimplifyNodeVisitor.__check102"></a> |
|
338 <h4>SimplifyNodeVisitor.__check102</h4> |
|
339 <b>__check102</b>(<i>node</i>) |
|
340 |
|
341 <p> |
|
342 Private method to check for nested if statements without else blocks. |
|
343 </p> |
|
344 <dl> |
|
345 |
|
346 <dt><i>node</i> (ast.If)</dt> |
|
347 <dd> |
|
348 reference to the AST node to be checked |
|
349 </dd> |
|
350 </dl> |
|
351 <a NAME="SimplifyNodeVisitor.__check103" ID="SimplifyNodeVisitor.__check103"></a> |
|
352 <h4>SimplifyNodeVisitor.__check103</h4> |
|
353 <b>__check103</b>(<i>node</i>) |
|
354 |
|
355 <p> |
|
356 Private method to check for calls that wrap a condition to return |
|
357 a bool. |
|
358 </p> |
|
359 <dl> |
|
360 |
|
361 <dt><i>node</i> (ast.If)</dt> |
|
362 <dd> |
|
363 reference to the AST node to be checked |
|
364 </dd> |
|
365 </dl> |
|
366 <a NAME="SimplifyNodeVisitor.__check104" ID="SimplifyNodeVisitor.__check104"></a> |
|
367 <h4>SimplifyNodeVisitor.__check104</h4> |
|
368 <b>__check104</b>(<i>node</i>) |
|
369 |
|
370 <p> |
|
371 Private method to check for "iterate and yield" patterns. |
|
372 </p> |
|
373 <dl> |
|
374 |
|
375 <dt><i>node</i> (ast.For)</dt> |
|
376 <dd> |
|
377 reference to the AST node to be checked |
|
378 </dd> |
|
379 </dl> |
|
380 <a NAME="SimplifyNodeVisitor.__check105" ID="SimplifyNodeVisitor.__check105"></a> |
|
381 <h4>SimplifyNodeVisitor.__check105</h4> |
|
382 <b>__check105</b>(<i>node</i>) |
|
383 |
|
384 <p> |
|
385 Private method to check for "try-except-pass" patterns. |
|
386 </p> |
|
387 <dl> |
|
388 |
|
389 <dt><i>node</i> (ast.Try)</dt> |
|
390 <dd> |
|
391 reference to the AST node to be checked |
|
392 </dd> |
|
393 </dl> |
|
394 <a NAME="SimplifyNodeVisitor.__check106" ID="SimplifyNodeVisitor.__check106"></a> |
|
395 <h4>SimplifyNodeVisitor.__check106</h4> |
|
396 <b>__check106</b>(<i>node</i>) |
|
397 |
|
398 <p> |
|
399 Private method to check for calls where an exception is raised in else. |
|
400 </p> |
|
401 <dl> |
|
402 |
|
403 <dt><i>node</i> (ast.If)</dt> |
|
404 <dd> |
|
405 reference to the AST node to be checked |
|
406 </dd> |
|
407 </dl> |
|
408 <a NAME="SimplifyNodeVisitor.__check107" ID="SimplifyNodeVisitor.__check107"></a> |
|
409 <h4>SimplifyNodeVisitor.__check107</h4> |
|
410 <b>__check107</b>(<i>node</i>) |
|
411 |
|
412 <p> |
|
413 Private method to check for calls where try/except and finally have |
|
414 'return'. |
|
415 </p> |
|
416 <dl> |
|
417 |
|
418 <dt><i>node</i> (ast.Try)</dt> |
|
419 <dd> |
|
420 reference to the AST node to be checked |
|
421 </dd> |
|
422 </dl> |
|
423 <a NAME="SimplifyNodeVisitor.__check108" ID="SimplifyNodeVisitor.__check108"></a> |
|
424 <h4>SimplifyNodeVisitor.__check108</h4> |
|
425 <b>__check108</b>(<i>node</i>) |
|
426 |
|
427 <p> |
|
428 Private method to check for if-elses which could be a ternary |
|
429 operator assignment. |
|
430 </p> |
|
431 <dl> |
|
432 |
|
433 <dt><i>node</i> (ast.If)</dt> |
|
434 <dd> |
|
435 reference to the AST node to be checked |
|
436 </dd> |
|
437 </dl> |
|
438 <a NAME="SimplifyNodeVisitor.__check109" ID="SimplifyNodeVisitor.__check109"></a> |
|
439 <h4>SimplifyNodeVisitor.__check109</h4> |
|
440 <b>__check109</b>(<i>node</i>) |
|
441 |
|
442 <p> |
|
443 Private method to check for multiple equalities with the same value |
|
444 are combined via "or". |
|
445 </p> |
|
446 <dl> |
|
447 |
|
448 <dt><i>node</i> (ast.BoolOp)</dt> |
|
449 <dd> |
|
450 reference to the AST node to be checked |
|
451 </dd> |
|
452 </dl> |
|
453 <a NAME="SimplifyNodeVisitor.__check110_111" ID="SimplifyNodeVisitor.__check110_111"></a> |
|
454 <h4>SimplifyNodeVisitor.__check110_111</h4> |
|
455 <b>__check110_111</b>(<i>node</i>) |
|
456 |
|
457 <p> |
|
458 Private method to check if any / all could be used. |
|
459 </p> |
|
460 <dl> |
|
461 |
|
462 <dt><i>node</i> (ast.For)</dt> |
|
463 <dd> |
|
464 reference to the AST node to be checked |
|
465 </dd> |
|
466 </dl> |
|
467 <a NAME="SimplifyNodeVisitor.__check112" ID="SimplifyNodeVisitor.__check112"></a> |
|
468 <h4>SimplifyNodeVisitor.__check112</h4> |
|
469 <b>__check112</b>(<i>node</i>) |
|
470 |
|
471 <p> |
|
472 Private method to check for non-capitalized calls to environment |
|
473 variables. |
|
474 </p> |
|
475 <dl> |
|
476 |
|
477 <dt><i>node</i> (ast.Expr)</dt> |
|
478 <dd> |
|
479 reference to the AST node to be checked |
|
480 </dd> |
|
481 </dl> |
|
482 <a NAME="SimplifyNodeVisitor.__check113" ID="SimplifyNodeVisitor.__check113"></a> |
|
483 <h4>SimplifyNodeVisitor.__check113</h4> |
|
484 <b>__check113</b>(<i>node</i>) |
|
485 |
|
486 <p> |
|
487 Private method to check for loops in which "enumerate" should be |
|
488 used. |
|
489 </p> |
|
490 <dl> |
|
491 |
|
492 <dt><i>node</i> (ast.For)</dt> |
|
493 <dd> |
|
494 reference to the AST node to be checked |
|
495 </dd> |
|
496 </dl> |
|
497 <a NAME="SimplifyNodeVisitor.__check114" ID="SimplifyNodeVisitor.__check114"></a> |
|
498 <h4>SimplifyNodeVisitor.__check114</h4> |
|
499 <b>__check114</b>(<i>node</i>) |
|
500 |
|
501 <p> |
|
502 Private method to check for alternative if clauses with identical |
|
503 bodies. |
|
504 </p> |
|
505 <dl> |
|
506 |
|
507 <dt><i>node</i> (ast.If)</dt> |
|
508 <dd> |
|
509 reference to the AST node to be checked |
|
510 </dd> |
|
511 </dl> |
|
512 <a NAME="SimplifyNodeVisitor.__check115" ID="SimplifyNodeVisitor.__check115"></a> |
|
513 <h4>SimplifyNodeVisitor.__check115</h4> |
|
514 <b>__check115</b>(<i>node</i>) |
|
515 |
|
516 <p> |
|
517 Private method to to check for places where open() is called without |
|
518 a context handler. |
|
519 </p> |
|
520 <dl> |
|
521 |
|
522 <dt><i>node</i> (ast.Call)</dt> |
|
523 <dd> |
|
524 reference to the AST node to be checked |
|
525 </dd> |
|
526 </dl> |
|
527 <a NAME="SimplifyNodeVisitor.__check116" ID="SimplifyNodeVisitor.__check116"></a> |
|
528 <h4>SimplifyNodeVisitor.__check116</h4> |
|
529 <b>__check116</b>(<i>node</i>) |
|
530 |
|
531 <p> |
|
532 Private method to check for places with 3 or more consecutive |
|
533 if-statements with direct returns. |
|
534 </p> |
|
535 <p> |
|
536 * Each if-statement must be a check for equality with the |
|
537 same variable |
|
538 * Each if-statement must just have a "return" |
|
539 * Else must also just have a return |
|
540 </p> |
|
541 <dl> |
|
542 |
|
543 <dt><i>node</i> (ast.If)</dt> |
|
544 <dd> |
|
545 reference to the AST node to be checked |
|
546 </dd> |
|
547 </dl> |
|
548 <a NAME="SimplifyNodeVisitor.__check117" ID="SimplifyNodeVisitor.__check117"></a> |
|
549 <h4>SimplifyNodeVisitor.__check117</h4> |
|
550 <b>__check117</b>(<i>node</i>) |
|
551 |
|
552 <p> |
|
553 Private method to check for multiple with-statements with same scope. |
|
554 </p> |
|
555 <dl> |
|
556 |
|
557 <dt><i>node</i> (ast.With)</dt> |
|
558 <dd> |
|
559 reference to the AST node to be checked |
|
560 </dd> |
|
561 </dl> |
|
562 <a NAME="SimplifyNodeVisitor.__check118" ID="SimplifyNodeVisitor.__check118"></a> |
|
563 <h4>SimplifyNodeVisitor.__check118</h4> |
|
564 <b>__check118</b>(<i>node</i>) |
|
565 |
|
566 <p> |
|
567 Private method to check for usages of "key in dict.keys()". |
|
568 </p> |
|
569 <dl> |
|
570 |
|
571 <dt><i>node</i> (ast.Compare or ast.For)</dt> |
|
572 <dd> |
|
573 reference to the AST node to be checked |
|
574 </dd> |
|
575 </dl> |
|
576 <a NAME="SimplifyNodeVisitor.__check119" ID="SimplifyNodeVisitor.__check119"></a> |
|
577 <h4>SimplifyNodeVisitor.__check119</h4> |
|
578 <b>__check119</b>(<i>node</i>) |
|
579 |
|
580 <p> |
|
581 Private method to check for classes that should be "dataclasses". |
|
582 </p> |
|
583 <dl> |
|
584 |
|
585 <dt><i>node</i> (ast.ClassDef)</dt> |
|
586 <dd> |
|
587 reference to the AST node to be checked |
|
588 </dd> |
|
589 </dl> |
|
590 <a NAME="SimplifyNodeVisitor.__check120_121" ID="SimplifyNodeVisitor.__check120_121"></a> |
|
591 <h4>SimplifyNodeVisitor.__check120_121</h4> |
|
592 <b>__check120_121</b>(<i>node</i>) |
|
593 |
|
594 <p> |
|
595 Private method to check for classes that inherit from object. |
|
596 </p> |
|
597 <dl> |
|
598 |
|
599 <dt><i>node</i> (ast.ClassDef)</dt> |
|
600 <dd> |
|
601 reference to the AST node to be checked |
|
602 </dd> |
|
603 </dl> |
|
604 <a NAME="SimplifyNodeVisitor.__check122" ID="SimplifyNodeVisitor.__check122"></a> |
|
605 <h4>SimplifyNodeVisitor.__check122</h4> |
|
606 <b>__check122</b>(<i>node</i>) |
|
607 |
|
608 <p> |
|
609 Private method to check for all if-blocks which only check if a key |
|
610 is in a dictionary. |
|
611 </p> |
|
612 <dl> |
|
613 |
|
614 <dt><i>node</i> (ast.If)</dt> |
|
615 <dd> |
|
616 reference to the AST node to be checked |
|
617 </dd> |
|
618 </dl> |
|
619 <a NAME="SimplifyNodeVisitor.__check181" ID="SimplifyNodeVisitor.__check181"></a> |
|
620 <h4>SimplifyNodeVisitor.__check181</h4> |
|
621 <b>__check181</b>(<i>node</i>) |
|
622 |
|
623 <p> |
|
624 Private method to check for assignments that could be converted into |
|
625 an augmented assignment. |
|
626 </p> |
|
627 <dl> |
|
628 |
|
629 <dt><i>node</i> (ast.Assign)</dt> |
|
630 <dd> |
|
631 reference to the AST node to be checked |
|
632 </dd> |
|
633 </dl> |
|
634 <a NAME="SimplifyNodeVisitor.__check182" ID="SimplifyNodeVisitor.__check182"></a> |
|
635 <h4>SimplifyNodeVisitor.__check182</h4> |
|
636 <b>__check182</b>(<i>node</i>) |
|
637 |
|
638 <p> |
|
639 Private method to check for calls of type 'super()' that could |
|
640 be shortened to 'super()'. |
|
641 </p> |
|
642 <dl> |
|
643 |
|
644 <dt><i>node</i> (ast.Call)</dt> |
|
645 <dd> |
|
646 reference to the AST node to be checked |
|
647 </dd> |
|
648 </dl> |
|
649 <a NAME="SimplifyNodeVisitor.__check201" ID="SimplifyNodeVisitor.__check201"></a> |
|
650 <h4>SimplifyNodeVisitor.__check201</h4> |
|
651 <b>__check201</b>(<i>node</i>) |
|
652 |
|
653 <p> |
|
654 Private method to check for calls where an unary 'not' is used for |
|
655 an unequality. |
|
656 </p> |
|
657 <dl> |
|
658 |
|
659 <dt><i>node</i> (ast.UnaryOp)</dt> |
|
660 <dd> |
|
661 reference to the UnaryOp node |
|
662 </dd> |
|
663 </dl> |
|
664 <a NAME="SimplifyNodeVisitor.__check202" ID="SimplifyNodeVisitor.__check202"></a> |
|
665 <h4>SimplifyNodeVisitor.__check202</h4> |
|
666 <b>__check202</b>(<i>node</i>) |
|
667 |
|
668 <p> |
|
669 Private method to check for calls where an unary 'not' is used for |
|
670 an equality. |
|
671 </p> |
|
672 <dl> |
|
673 |
|
674 <dt><i>node</i> (ast.UnaryOp)</dt> |
|
675 <dd> |
|
676 reference to the UnaryOp node |
|
677 </dd> |
|
678 </dl> |
|
679 <a NAME="SimplifyNodeVisitor.__check203" ID="SimplifyNodeVisitor.__check203"></a> |
|
680 <h4>SimplifyNodeVisitor.__check203</h4> |
|
681 <b>__check203</b>(<i>node</i>) |
|
682 |
|
683 <p> |
|
684 Private method to check for calls where an unary 'not' is used for |
|
685 an in-check. |
|
686 </p> |
|
687 <dl> |
|
688 |
|
689 <dt><i>node</i> (ast.UnaryOp)</dt> |
|
690 <dd> |
|
691 reference to the UnaryOp node |
|
692 </dd> |
|
693 </dl> |
|
694 <a NAME="SimplifyNodeVisitor.__check204" ID="SimplifyNodeVisitor.__check204"></a> |
|
695 <h4>SimplifyNodeVisitor.__check204</h4> |
|
696 <b>__check204</b>(<i>node</i>) |
|
697 |
|
698 <p> |
|
699 Private method to check for calls of the type "not (a < b)". |
|
700 </p> |
|
701 <dl> |
|
702 |
|
703 <dt><i>node</i> (ast.UnaryOp)</dt> |
|
704 <dd> |
|
705 reference to the UnaryOp node |
|
706 </dd> |
|
707 </dl> |
|
708 <a NAME="SimplifyNodeVisitor.__check205" ID="SimplifyNodeVisitor.__check205"></a> |
|
709 <h4>SimplifyNodeVisitor.__check205</h4> |
|
710 <b>__check205</b>(<i>node</i>) |
|
711 |
|
712 <p> |
|
713 Private method to check for calls of the type "not (a <= b)". |
|
714 </p> |
|
715 <dl> |
|
716 |
|
717 <dt><i>node</i> (ast.UnaryOp)</dt> |
|
718 <dd> |
|
719 reference to the UnaryOp node |
|
720 </dd> |
|
721 </dl> |
|
722 <a NAME="SimplifyNodeVisitor.__check206" ID="SimplifyNodeVisitor.__check206"></a> |
|
723 <h4>SimplifyNodeVisitor.__check206</h4> |
|
724 <b>__check206</b>(<i>node</i>) |
|
725 |
|
726 <p> |
|
727 Private method to check for calls of the type "not (a > b)". |
|
728 </p> |
|
729 <dl> |
|
730 |
|
731 <dt><i>node</i> (ast.UnaryOp)</dt> |
|
732 <dd> |
|
733 reference to the UnaryOp node |
|
734 </dd> |
|
735 </dl> |
|
736 <a NAME="SimplifyNodeVisitor.__check207" ID="SimplifyNodeVisitor.__check207"></a> |
|
737 <h4>SimplifyNodeVisitor.__check207</h4> |
|
738 <b>__check207</b>(<i>node</i>) |
|
739 |
|
740 <p> |
|
741 Private method to check for calls of the type "not (a >= b)". |
|
742 </p> |
|
743 <dl> |
|
744 |
|
745 <dt><i>node</i> (ast.UnaryOp)</dt> |
|
746 <dd> |
|
747 reference to the UnaryOp node |
|
748 </dd> |
|
749 </dl> |
|
750 <a NAME="SimplifyNodeVisitor.__check208" ID="SimplifyNodeVisitor.__check208"></a> |
|
751 <h4>SimplifyNodeVisitor.__check208</h4> |
|
752 <b>__check208</b>(<i>node</i>) |
|
753 |
|
754 <p> |
|
755 Private method to check for calls of the type "not (not a)". |
|
756 </p> |
|
757 <dl> |
|
758 |
|
759 <dt><i>node</i> (ast.UnaryOp)</dt> |
|
760 <dd> |
|
761 reference to the UnaryOp node |
|
762 </dd> |
|
763 </dl> |
|
764 <a NAME="SimplifyNodeVisitor.__check211" ID="SimplifyNodeVisitor.__check211"></a> |
|
765 <h4>SimplifyNodeVisitor.__check211</h4> |
|
766 <b>__check211</b>(<i>node</i>) |
|
767 |
|
768 <p> |
|
769 Private method to check for calls of the type "True if a else False". |
|
770 </p> |
|
771 <dl> |
|
772 |
|
773 <dt><i>node</i> (ast.IfExp)</dt> |
|
774 <dd> |
|
775 reference to the AST node to be checked |
|
776 </dd> |
|
777 </dl> |
|
778 <a NAME="SimplifyNodeVisitor.__check212" ID="SimplifyNodeVisitor.__check212"></a> |
|
779 <h4>SimplifyNodeVisitor.__check212</h4> |
|
780 <b>__check212</b>(<i>node</i>) |
|
781 |
|
782 <p> |
|
783 Private method to check for calls of the type "False if a else True". |
|
784 </p> |
|
785 <dl> |
|
786 |
|
787 <dt><i>node</i> (ast.IfExp)</dt> |
|
788 <dd> |
|
789 reference to the AST node to be checked |
|
790 </dd> |
|
791 </dl> |
|
792 <a NAME="SimplifyNodeVisitor.__check213" ID="SimplifyNodeVisitor.__check213"></a> |
|
793 <h4>SimplifyNodeVisitor.__check213</h4> |
|
794 <b>__check213</b>(<i>node</i>) |
|
795 |
|
796 <p> |
|
797 Private method to check for calls of the type "b if not a else a". |
|
798 </p> |
|
799 <dl> |
|
800 |
|
801 <dt><i>node</i> (ast.IfExp)</dt> |
|
802 <dd> |
|
803 reference to the AST node to be checked |
|
804 </dd> |
|
805 </dl> |
|
806 <a NAME="SimplifyNodeVisitor.__check221" ID="SimplifyNodeVisitor.__check221"></a> |
|
807 <h4>SimplifyNodeVisitor.__check221</h4> |
|
808 <b>__check221</b>(<i>node</i>) |
|
809 |
|
810 <p> |
|
811 Private method to check for calls of the type "a and not a". |
|
812 </p> |
|
813 <dl> |
|
814 |
|
815 <dt><i>node</i> (ast.BoolOp)</dt> |
|
816 <dd> |
|
817 reference to the AST node to be checked |
|
818 </dd> |
|
819 </dl> |
|
820 <a NAME="SimplifyNodeVisitor.__check222" ID="SimplifyNodeVisitor.__check222"></a> |
|
821 <h4>SimplifyNodeVisitor.__check222</h4> |
|
822 <b>__check222</b>(<i>node</i>) |
|
823 |
|
824 <p> |
|
825 Private method to check for calls of the type "a or not a". |
|
826 </p> |
|
827 <dl> |
|
828 |
|
829 <dt><i>node</i> (ast.BoolOp)</dt> |
|
830 <dd> |
|
831 reference to the AST node to be checked |
|
832 </dd> |
|
833 </dl> |
|
834 <a NAME="SimplifyNodeVisitor.__check223" ID="SimplifyNodeVisitor.__check223"></a> |
|
835 <h4>SimplifyNodeVisitor.__check223</h4> |
|
836 <b>__check223</b>(<i>node</i>) |
|
837 |
|
838 <p> |
|
839 Private method to check for calls of the type "... or True". |
|
840 </p> |
|
841 <dl> |
|
842 |
|
843 <dt><i>node</i> (ast.BoolOp)</dt> |
|
844 <dd> |
|
845 reference to the AST node to be checked |
|
846 </dd> |
|
847 </dl> |
|
848 <a NAME="SimplifyNodeVisitor.__check224" ID="SimplifyNodeVisitor.__check224"></a> |
|
849 <h4>SimplifyNodeVisitor.__check224</h4> |
|
850 <b>__check224</b>(<i>node</i>) |
|
851 |
|
852 <p> |
|
853 Private method to check for calls of the type "... and False". |
|
854 </p> |
|
855 <dl> |
|
856 |
|
857 <dt><i>node</i> (ast.BoolOp)</dt> |
|
858 <dd> |
|
859 reference to the AST node to be checked |
|
860 </dd> |
|
861 </dl> |
|
862 <a NAME="SimplifyNodeVisitor.__check301" ID="SimplifyNodeVisitor.__check301"></a> |
|
863 <h4>SimplifyNodeVisitor.__check301</h4> |
|
864 <b>__check301</b>(<i>node</i>) |
|
865 |
|
866 <p> |
|
867 Private method to check for Yoda conditions. |
|
868 </p> |
|
869 <dl> |
|
870 |
|
871 <dt><i>node</i> (ast.Compare)</dt> |
|
872 <dd> |
|
873 reference to the AST node to be checked |
|
874 </dd> |
|
875 </dl> |
|
876 <a NAME="SimplifyNodeVisitor.__check401" ID="SimplifyNodeVisitor.__check401"></a> |
|
877 <h4>SimplifyNodeVisitor.__check401</h4> |
|
878 <b>__check401</b>(<i>node</i>) |
|
879 |
|
880 <p> |
|
881 Private method to check for bare boolean function arguments. |
|
882 </p> |
|
883 <dl> |
|
884 |
|
885 <dt><i>node</i> (ast.Call)</dt> |
|
886 <dd> |
|
887 reference to the AST node to be checked |
|
888 </dd> |
|
889 </dl> |
|
890 <a NAME="SimplifyNodeVisitor.__check402" ID="SimplifyNodeVisitor.__check402"></a> |
|
891 <h4>SimplifyNodeVisitor.__check402</h4> |
|
892 <b>__check402</b>(<i>node</i>) |
|
893 |
|
894 <p> |
|
895 Private method to check for bare numeric function arguments. |
|
896 </p> |
|
897 <dl> |
|
898 |
|
899 <dt><i>node</i> (ast.Call)</dt> |
|
900 <dd> |
|
901 reference to the AST node to be checked |
|
902 </dd> |
|
903 </dl> |
|
904 <a NAME="SimplifyNodeVisitor.__getDuplicatedIsinstanceCall" ID="SimplifyNodeVisitor.__getDuplicatedIsinstanceCall"></a> |
|
905 <h4>SimplifyNodeVisitor.__getDuplicatedIsinstanceCall</h4> |
|
906 <b>__getDuplicatedIsinstanceCall</b>(<i>node</i>) |
|
907 |
|
908 <p> |
|
909 Private method to get a list of isinstance arguments which could |
|
910 be combined. |
|
911 </p> |
|
912 <dl> |
|
913 |
|
914 <dt><i>node</i> (ast.BoolOp)</dt> |
|
915 <dd> |
|
916 reference to the AST node to be inspected |
|
917 </dd> |
|
918 </dl> |
|
919 <dl> |
|
920 <dt>Return:</dt> |
|
921 <dd> |
|
922 list of variable names of duplicated isinstance calls |
|
923 </dd> |
|
924 </dl> |
|
925 <dl> |
|
926 <dt>Return Type:</dt> |
|
927 <dd> |
|
928 list of str |
|
929 </dd> |
|
930 </dl> |
|
931 <a NAME="SimplifyNodeVisitor.__getIfBodyPairs" ID="SimplifyNodeVisitor.__getIfBodyPairs"></a> |
|
932 <h4>SimplifyNodeVisitor.__getIfBodyPairs</h4> |
|
933 <b>__getIfBodyPairs</b>(<i>node</i>) |
|
934 |
|
935 <p> |
|
936 Private method to extract a list of pairs of test and body for an |
|
937 If node. |
|
938 </p> |
|
939 <dl> |
|
940 |
|
941 <dt><i>node</i> (ast.If)</dt> |
|
942 <dd> |
|
943 reference to the If node to be processed |
|
944 </dd> |
|
945 </dl> |
|
946 <dl> |
|
947 <dt>Return:</dt> |
|
948 <dd> |
|
949 list of pairs of test and body |
|
950 </dd> |
|
951 </dl> |
|
952 <dl> |
|
953 <dt>Return Type:</dt> |
|
954 <dd> |
|
955 list of tuples of (ast.expr, [ast.stmt]) |
|
956 </dd> |
|
957 </dl> |
|
958 <a NAME="SimplifyNodeVisitor.__isConstantIncrease" ID="SimplifyNodeVisitor.__isConstantIncrease"></a> |
|
959 <h4>SimplifyNodeVisitor.__isConstantIncrease</h4> |
|
960 <b>__isConstantIncrease</b>(<i>expression</i>) |
|
961 |
|
962 <p> |
|
963 Private method check the given expression for being a constant |
|
964 increase. |
|
965 </p> |
|
966 <dl> |
|
967 |
|
968 <dt><i>expression</i> (ast.AugAssign)</dt> |
|
969 <dd> |
|
970 reference to the expression node |
|
971 </dd> |
|
972 </dl> |
|
973 <dl> |
|
974 <dt>Return:</dt> |
|
975 <dd> |
|
976 flag indicating a constant increase |
|
977 </dd> |
|
978 </dl> |
|
979 <dl> |
|
980 <dt>Return Type:</dt> |
|
981 <dd> |
|
982 bool |
|
983 </dd> |
|
984 </dl> |
|
985 <a NAME="SimplifyNodeVisitor.__isExceptionCheck" ID="SimplifyNodeVisitor.__isExceptionCheck"></a> |
|
986 <h4>SimplifyNodeVisitor.__isExceptionCheck</h4> |
|
987 <b>__isExceptionCheck</b>(<i>node</i>) |
|
988 |
|
989 <p> |
|
990 Private method to check, if the node is checking an exception. |
|
991 </p> |
|
992 <dl> |
|
993 |
|
994 <dt><i>node</i> (ast.If)</dt> |
|
995 <dd> |
|
996 reference to the node to be checked |
|
997 </dd> |
|
998 </dl> |
|
999 <dl> |
|
1000 <dt>Return:</dt> |
|
1001 <dd> |
|
1002 flag indicating an exception check |
|
1003 </dd> |
|
1004 </dl> |
|
1005 <dl> |
|
1006 <dt>Return Type:</dt> |
|
1007 <dd> |
|
1008 bool |
|
1009 </dd> |
|
1010 </dl> |
|
1011 <a NAME="SimplifyNodeVisitor.__isSameBody" ID="SimplifyNodeVisitor.__isSameBody"></a> |
|
1012 <h4>SimplifyNodeVisitor.__isSameBody</h4> |
|
1013 <b>__isSameBody</b>(<i>body1, body2</i>) |
|
1014 |
|
1015 <p> |
|
1016 Private method check, if the given bodies are equivalent. |
|
1017 </p> |
|
1018 <dl> |
|
1019 |
|
1020 <dt><i>body1</i> (list of ast.stmt)</dt> |
|
1021 <dd> |
|
1022 list of statements of the first body |
|
1023 </dd> |
|
1024 <dt><i>body2</i> (list of ast.stmt)</dt> |
|
1025 <dd> |
|
1026 list of statements of the second body |
|
1027 </dd> |
|
1028 </dl> |
|
1029 <dl> |
|
1030 <dt>Return:</dt> |
|
1031 <dd> |
|
1032 flag indicating identical bodies |
|
1033 </dd> |
|
1034 </dl> |
|
1035 <dl> |
|
1036 <dt>Return Type:</dt> |
|
1037 <dd> |
|
1038 bool |
|
1039 </dd> |
|
1040 </dl> |
|
1041 <a NAME="SimplifyNodeVisitor.__isSameExpression" ID="SimplifyNodeVisitor.__isSameExpression"></a> |
|
1042 <h4>SimplifyNodeVisitor.__isSameExpression</h4> |
|
1043 <b>__isSameExpression</b>(<i>a, b</i>) |
|
1044 |
|
1045 <p> |
|
1046 Private method to check, if two expressions are equal. |
|
1047 </p> |
|
1048 <dl> |
|
1049 |
|
1050 <dt><i>a</i> (ast.expr)</dt> |
|
1051 <dd> |
|
1052 first expression to be checked |
|
1053 </dd> |
|
1054 <dt><i>b</i> (ast.expr)</dt> |
|
1055 <dd> |
|
1056 second expression to be checked |
|
1057 </dd> |
|
1058 </dl> |
|
1059 <dl> |
|
1060 <dt>Return:</dt> |
|
1061 <dd> |
|
1062 flag indicating equal expressions |
|
1063 </dd> |
|
1064 </dl> |
|
1065 <dl> |
|
1066 <dt>Return Type:</dt> |
|
1067 <dd> |
|
1068 bool |
|
1069 </dd> |
|
1070 </dl> |
|
1071 <a NAME="SimplifyNodeVisitor.__isStatementEqual" ID="SimplifyNodeVisitor.__isStatementEqual"></a> |
|
1072 <h4>SimplifyNodeVisitor.__isStatementEqual</h4> |
|
1073 <b>__isStatementEqual</b>(<i>a, b</i>) |
|
1074 |
|
1075 <p> |
|
1076 Private method to check, if two statements are equal. |
|
1077 </p> |
|
1078 <dl> |
|
1079 |
|
1080 <dt><i>a</i> (ast.stmt)</dt> |
|
1081 <dd> |
|
1082 reference to the first statement |
|
1083 </dd> |
|
1084 <dt><i>b</i> (ast.stmt)</dt> |
|
1085 <dd> |
|
1086 reference to the second statement |
|
1087 </dd> |
|
1088 </dl> |
|
1089 <dl> |
|
1090 <dt>Return:</dt> |
|
1091 <dd> |
|
1092 flag indicating if the two statements are equal |
|
1093 </dd> |
|
1094 </dl> |
|
1095 <dl> |
|
1096 <dt>Return Type:</dt> |
|
1097 <dd> |
|
1098 bool |
|
1099 </dd> |
|
1100 </dl> |
|
1101 <a NAME="SimplifyNodeVisitor.__negateTest" ID="SimplifyNodeVisitor.__negateTest"></a> |
|
1102 <h4>SimplifyNodeVisitor.__negateTest</h4> |
|
1103 <b>__negateTest</b>(<i>node</i>) |
|
1104 |
|
1105 <p> |
|
1106 Private method negate the given Compare node. |
|
1107 </p> |
|
1108 <dl> |
|
1109 |
|
1110 <dt><i>node</i> (ast.Compare)</dt> |
|
1111 <dd> |
|
1112 reference to the node to be negated |
|
1113 </dd> |
|
1114 </dl> |
|
1115 <dl> |
|
1116 <dt>Return:</dt> |
|
1117 <dd> |
|
1118 node with negated logic |
|
1119 </dd> |
|
1120 </dl> |
|
1121 <dl> |
|
1122 <dt>Return Type:</dt> |
|
1123 <dd> |
|
1124 ast.Compare |
|
1125 </dd> |
|
1126 </dl> |
|
1127 <a NAME="SimplifyNodeVisitor.visit_Assign" ID="SimplifyNodeVisitor.visit_Assign"></a> |
|
1128 <h4>SimplifyNodeVisitor.visit_Assign</h4> |
|
1129 <b>visit_Assign</b>(<i>node</i>) |
|
1130 |
|
1131 <p> |
|
1132 Public method to process an Assign node. |
|
1133 </p> |
|
1134 <dl> |
|
1135 |
|
1136 <dt><i>node</i> (ast.Assign)</dt> |
|
1137 <dd> |
|
1138 reference to the Assign node |
|
1139 </dd> |
|
1140 </dl> |
|
1141 <a NAME="SimplifyNodeVisitor.visit_BoolOp" ID="SimplifyNodeVisitor.visit_BoolOp"></a> |
|
1142 <h4>SimplifyNodeVisitor.visit_BoolOp</h4> |
|
1143 <b>visit_BoolOp</b>(<i>node</i>) |
|
1144 |
|
1145 <p> |
|
1146 Public method to process a BoolOp node. |
|
1147 </p> |
|
1148 <dl> |
|
1149 |
|
1150 <dt><i>node</i> (ast.BoolOp)</dt> |
|
1151 <dd> |
|
1152 reference to the BoolOp node |
|
1153 </dd> |
|
1154 </dl> |
|
1155 <a NAME="SimplifyNodeVisitor.visit_Call" ID="SimplifyNodeVisitor.visit_Call"></a> |
|
1156 <h4>SimplifyNodeVisitor.visit_Call</h4> |
|
1157 <b>visit_Call</b>(<i>node</i>) |
|
1158 |
|
1159 <p> |
|
1160 Public method to process a Call node. |
|
1161 </p> |
|
1162 <dl> |
|
1163 |
|
1164 <dt><i>node</i> (ast.Call)</dt> |
|
1165 <dd> |
|
1166 reference to the Call node |
|
1167 </dd> |
|
1168 </dl> |
|
1169 <a NAME="SimplifyNodeVisitor.visit_ClassDef" ID="SimplifyNodeVisitor.visit_ClassDef"></a> |
|
1170 <h4>SimplifyNodeVisitor.visit_ClassDef</h4> |
|
1171 <b>visit_ClassDef</b>(<i>node</i>) |
|
1172 |
|
1173 <p> |
|
1174 Public method to process a ClassDef node. |
|
1175 </p> |
|
1176 <dl> |
|
1177 |
|
1178 <dt><i>node</i> (ast.ClassDef)</dt> |
|
1179 <dd> |
|
1180 reference to the ClassDef node |
|
1181 </dd> |
|
1182 </dl> |
|
1183 <a NAME="SimplifyNodeVisitor.visit_Compare" ID="SimplifyNodeVisitor.visit_Compare"></a> |
|
1184 <h4>SimplifyNodeVisitor.visit_Compare</h4> |
|
1185 <b>visit_Compare</b>(<i>node</i>) |
|
1186 |
|
1187 <p> |
|
1188 Public method to process a Compare node. |
|
1189 </p> |
|
1190 <dl> |
|
1191 |
|
1192 <dt><i>node</i> (ast.Compare)</dt> |
|
1193 <dd> |
|
1194 reference to the Compare node |
|
1195 </dd> |
|
1196 </dl> |
|
1197 <a NAME="SimplifyNodeVisitor.visit_Expr" ID="SimplifyNodeVisitor.visit_Expr"></a> |
|
1198 <h4>SimplifyNodeVisitor.visit_Expr</h4> |
|
1199 <b>visit_Expr</b>(<i>node</i>) |
|
1200 |
|
1201 <p> |
|
1202 Public method to process an Expr node. |
|
1203 </p> |
|
1204 <dl> |
|
1205 |
|
1206 <dt><i>node</i> (ast.Expr)</dt> |
|
1207 <dd> |
|
1208 reference to the Expr node |
|
1209 </dd> |
|
1210 </dl> |
|
1211 <a NAME="SimplifyNodeVisitor.visit_For" ID="SimplifyNodeVisitor.visit_For"></a> |
|
1212 <h4>SimplifyNodeVisitor.visit_For</h4> |
|
1213 <b>visit_For</b>(<i>node</i>) |
|
1214 |
|
1215 <p> |
|
1216 Public method to process a For node. |
|
1217 </p> |
|
1218 <dl> |
|
1219 |
|
1220 <dt><i>node</i> (ast.For)</dt> |
|
1221 <dd> |
|
1222 reference to the For node |
|
1223 </dd> |
|
1224 </dl> |
|
1225 <a NAME="SimplifyNodeVisitor.visit_If" ID="SimplifyNodeVisitor.visit_If"></a> |
|
1226 <h4>SimplifyNodeVisitor.visit_If</h4> |
|
1227 <b>visit_If</b>(<i>node</i>) |
|
1228 |
|
1229 <p> |
|
1230 Public method to process an If node. |
|
1231 </p> |
|
1232 <dl> |
|
1233 |
|
1234 <dt><i>node</i> (ast.If)</dt> |
|
1235 <dd> |
|
1236 reference to the If node |
|
1237 </dd> |
|
1238 </dl> |
|
1239 <a NAME="SimplifyNodeVisitor.visit_IfExp" ID="SimplifyNodeVisitor.visit_IfExp"></a> |
|
1240 <h4>SimplifyNodeVisitor.visit_IfExp</h4> |
|
1241 <b>visit_IfExp</b>(<i>node</i>) |
|
1242 |
|
1243 <p> |
|
1244 Public method to process an IfExp node. |
|
1245 </p> |
|
1246 <dl> |
|
1247 |
|
1248 <dt><i>node</i> (ast.IfExp)</dt> |
|
1249 <dd> |
|
1250 reference to the IfExp node |
|
1251 </dd> |
|
1252 </dl> |
|
1253 <a NAME="SimplifyNodeVisitor.visit_Try" ID="SimplifyNodeVisitor.visit_Try"></a> |
|
1254 <h4>SimplifyNodeVisitor.visit_Try</h4> |
|
1255 <b>visit_Try</b>(<i>node</i>) |
|
1256 |
|
1257 <p> |
|
1258 Public method to process a Try node. |
|
1259 </p> |
|
1260 <dl> |
|
1261 |
|
1262 <dt><i>node</i> (ast.Try)</dt> |
|
1263 <dd> |
|
1264 reference to the Try node |
|
1265 </dd> |
|
1266 </dl> |
|
1267 <a NAME="SimplifyNodeVisitor.visit_UnaryOp" ID="SimplifyNodeVisitor.visit_UnaryOp"></a> |
|
1268 <h4>SimplifyNodeVisitor.visit_UnaryOp</h4> |
|
1269 <b>visit_UnaryOp</b>(<i>node</i>) |
|
1270 |
|
1271 <p> |
|
1272 Public method to process a UnaryOp node. |
|
1273 </p> |
|
1274 <dl> |
|
1275 |
|
1276 <dt><i>node</i> (ast.UnaryOp)</dt> |
|
1277 <dd> |
|
1278 reference to the UnaryOp node |
|
1279 </dd> |
|
1280 </dl> |
|
1281 <a NAME="SimplifyNodeVisitor.visit_With" ID="SimplifyNodeVisitor.visit_With"></a> |
|
1282 <h4>SimplifyNodeVisitor.visit_With</h4> |
|
1283 <b>visit_With</b>(<i>node</i>) |
|
1284 |
|
1285 <p> |
|
1286 Public method to process a With node. |
|
1287 </p> |
|
1288 <dl> |
|
1289 |
|
1290 <dt><i>node</i> (ast.With)</dt> |
|
1291 <dd> |
|
1292 reference to the With node |
|
1293 </dd> |
|
1294 </dl> |
|
1295 <div align="right"><a href="#top">Up</a></div> |
|
1296 <hr /> |
|
1297 </body></html> |