eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker.html

changeset 7273
391d6b7b1eff
parent 7245
b47179fbb9d8
child 7291
f689a4dcaf62
equal deleted inserted replaced
7272:1779dc278077 7273:391d6b7b1eff
16 16
17 a { color: #BA6D36; } 17 a { color: #BA6D36; }
18 18
19 </style> 19 </style>
20 </head> 20 </head>
21 <body><a NAME="top" ID="top"></a> 21 <body>
22 <a NAME="top" ID="top"></a>
22 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker</h1> 23 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.MiscellaneousChecker</h1>
24
23 <p> 25 <p>
24 Module implementing a checker for miscellaneous checks. 26 Module implementing a checker for miscellaneous checks.
25 </p> 27 </p>
26 <h3>Global Attributes</h3> 28 <h3>Global Attributes</h3>
29
27 <table> 30 <table>
28 <tr><td>None</td></tr> 31 <tr><td>None</td></tr>
29 </table> 32 </table>
30 <h3>Classes</h3> 33 <h3>Classes</h3>
31 <table> 34
35 <table>
36
32 <tr> 37 <tr>
33 <td><a href="#BugBearVisitor">BugBearVisitor</a></td> 38 <td><a href="#BugBearVisitor">BugBearVisitor</a></td>
34 <td>Class implementing a node visitor to check for various topics.</td> 39 <td>Class implementing a node visitor to check for various topics.</td>
35 </tr><tr> 40 </tr>
41 <tr>
36 <td><a href="#DateTimeVisitor">DateTimeVisitor</a></td> 42 <td><a href="#DateTimeVisitor">DateTimeVisitor</a></td>
37 <td>Class implementing a node visitor to check datetime function calls.</td> 43 <td>Class implementing a node visitor to check datetime function calls.</td>
38 </tr><tr> 44 </tr>
45 <tr>
39 <td><a href="#LoggingVisitor">LoggingVisitor</a></td> 46 <td><a href="#LoggingVisitor">LoggingVisitor</a></td>
40 <td>Class implementing a node visitor to check logging statements.</td> 47 <td>Class implementing a node visitor to check logging statements.</td>
41 </tr><tr> 48 </tr>
49 <tr>
42 <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td> 50 <td><a href="#MiscellaneousChecker">MiscellaneousChecker</a></td>
43 <td>Class implementing a checker for miscellaneous checks.</td> 51 <td>Class implementing a checker for miscellaneous checks.</td>
44 </tr><tr> 52 </tr>
53 <tr>
45 <td><a href="#NameFinder">NameFinder</a></td> 54 <td><a href="#NameFinder">NameFinder</a></td>
46 <td>Class to extract a name out of a tree of nodes.</td> 55 <td>Class to extract a name out of a tree of nodes.</td>
47 </tr><tr> 56 </tr>
57 <tr>
48 <td><a href="#ReturnVisitor">ReturnVisitor</a></td> 58 <td><a href="#ReturnVisitor">ReturnVisitor</a></td>
49 <td>Class implementing a node visitor to check return statements.</td> 59 <td>Class implementing a node visitor to check return statements.</td>
50 </tr><tr> 60 </tr>
61 <tr>
51 <td><a href="#SysVersionVisitor">SysVersionVisitor</a></td> 62 <td><a href="#SysVersionVisitor">SysVersionVisitor</a></td>
52 <td>Class implementing a node visitor to check the use of sys.version and sys.version_info.</td> 63 <td>Class implementing a node visitor to check the use of sys.version and sys.version_info.</td>
53 </tr><tr> 64 </tr>
65 <tr>
54 <td><a href="#TextVisitor">TextVisitor</a></td> 66 <td><a href="#TextVisitor">TextVisitor</a></td>
55 <td>Class implementing a node visitor for bytes and str instances.</td> 67 <td>Class implementing a node visitor for bytes and str instances.</td>
56 </tr> 68 </tr>
57 </table> 69 </table>
58 <h3>Functions</h3> 70 <h3>Functions</h3>
59 <table> 71
72 <table>
73
60 <tr> 74 <tr>
61 <td><a href="#composeCallPath">composeCallPath</a></td> 75 <td><a href="#composeCallPath">composeCallPath</a></td>
62 <td>Generator function to assemble the call path of a given node.</td> 76 <td>Generator function to assemble the call path of a given node.</td>
63 </tr> 77 </tr>
64 </table> 78 </table>
65 <hr /><hr /> 79 <hr />
80 <hr />
66 <a NAME="BugBearVisitor" ID="BugBearVisitor"></a> 81 <a NAME="BugBearVisitor" ID="BugBearVisitor"></a>
67 <h2>BugBearVisitor</h2> 82 <h2>BugBearVisitor</h2>
83
68 <p> 84 <p>
69 Class implementing a node visitor to check for various topics. 85 Class implementing a node visitor to check for various topics.
70 </p> 86 </p>
71 <h3>Derived from</h3> 87 <h3>Derived from</h3>
72 ast.NodeVisitor 88 ast.NodeVisitor
73 <h3>Class Attributes</h3> 89 <h3>Class Attributes</h3>
90
74 <table> 91 <table>
75 <tr><td>NodeWindowSize</td></tr> 92 <tr><td>NodeWindowSize</td></tr>
76 </table> 93 </table>
77 <h3>Class Methods</h3> 94 <h3>Class Methods</h3>
95
78 <table> 96 <table>
79 <tr><td>None</td></tr> 97 <tr><td>None</td></tr>
80 </table> 98 </table>
81 <h3>Methods</h3> 99 <h3>Methods</h3>
82 <table> 100
101 <table>
102
83 <tr> 103 <tr>
84 <td><a href="#BugBearVisitor.__init__">BugBearVisitor</a></td> 104 <td><a href="#BugBearVisitor.__init__">BugBearVisitor</a></td>
85 <td>Constructor</td> 105 <td>Constructor</td>
86 </tr><tr> 106 </tr>
107 <tr>
87 <td><a href="#BugBearVisitor.__checkForM502">__checkForM502</a></td> 108 <td><a href="#BugBearVisitor.__checkForM502">__checkForM502</a></td>
88 <td>Private method to check the use of *strip().</td> 109 <td>Private method to check the use of *strip().</td>
89 </tr><tr> 110 </tr>
111 <tr>
90 <td><a href="#BugBearVisitor.__checkForM507">__checkForM507</a></td> 112 <td><a href="#BugBearVisitor.__checkForM507">__checkForM507</a></td>
91 <td>Private method to check for unused loop variables.</td> 113 <td>Private method to check for unused loop variables.</td>
92 </tr><tr> 114 </tr>
115 <tr>
93 <td><a href="#BugBearVisitor.visit">visit</a></td> 116 <td><a href="#BugBearVisitor.visit">visit</a></td>
94 <td>Public method to traverse a given AST node.</td> 117 <td>Public method to traverse a given AST node.</td>
95 </tr><tr> 118 </tr>
119 <tr>
96 <td><a href="#BugBearVisitor.visit_Assert">visit_Assert</a></td> 120 <td><a href="#BugBearVisitor.visit_Assert">visit_Assert</a></td>
97 <td>Public method to handle 'assert' statements.</td> 121 <td>Public method to handle 'assert' statements.</td>
98 </tr><tr> 122 </tr>
123 <tr>
99 <td><a href="#BugBearVisitor.visit_Assign">visit_Assign</a></td> 124 <td><a href="#BugBearVisitor.visit_Assign">visit_Assign</a></td>
100 <td>Public method to handle assignments.</td> 125 <td>Public method to handle assignments.</td>
101 </tr><tr> 126 </tr>
127 <tr>
102 <td><a href="#BugBearVisitor.visit_Attribute">visit_Attribute</a></td> 128 <td><a href="#BugBearVisitor.visit_Attribute">visit_Attribute</a></td>
103 <td>Public method to handle attributes.</td> 129 <td>Public method to handle attributes.</td>
104 </tr><tr> 130 </tr>
131 <tr>
105 <td><a href="#BugBearVisitor.visit_Call">visit_Call</a></td> 132 <td><a href="#BugBearVisitor.visit_Call">visit_Call</a></td>
106 <td>Public method to handle a function call.</td> 133 <td>Public method to handle a function call.</td>
107 </tr><tr> 134 </tr>
135 <tr>
108 <td><a href="#BugBearVisitor.visit_For">visit_For</a></td> 136 <td><a href="#BugBearVisitor.visit_For">visit_For</a></td>
109 <td>Public method to handle 'for' statements.</td> 137 <td>Public method to handle 'for' statements.</td>
110 </tr><tr> 138 </tr>
139 <tr>
111 <td><a href="#BugBearVisitor.visit_JoinedStr">visit_JoinedStr</a></td> 140 <td><a href="#BugBearVisitor.visit_JoinedStr">visit_JoinedStr</a></td>
112 <td>Public method to handle f-string arguments.</td> 141 <td>Public method to handle f-string arguments.</td>
113 </tr><tr> 142 </tr>
143 <tr>
114 <td><a href="#BugBearVisitor.visit_UAdd">visit_UAdd</a></td> 144 <td><a href="#BugBearVisitor.visit_UAdd">visit_UAdd</a></td>
115 <td>Public method to handle unary additions.</td> 145 <td>Public method to handle unary additions.</td>
116 </tr> 146 </tr>
117 </table> 147 </table>
118 <h3>Static Methods</h3> 148 <h3>Static Methods</h3>
149
119 <table> 150 <table>
120 <tr><td>None</td></tr> 151 <tr><td>None</td></tr>
121 </table> 152 </table>
153
122 <a NAME="BugBearVisitor.__init__" ID="BugBearVisitor.__init__"></a> 154 <a NAME="BugBearVisitor.__init__" ID="BugBearVisitor.__init__"></a>
123 <h4>BugBearVisitor (Constructor)</h4> 155 <h4>BugBearVisitor (Constructor)</h4>
124 <b>BugBearVisitor</b>(<i></i>) 156 <b>BugBearVisitor</b>(<i></i>)
157
125 <p> 158 <p>
126 Constructor 159 Constructor
127 </p><a NAME="BugBearVisitor.__checkForM502" ID="BugBearVisitor.__checkForM502"></a> 160 </p>
161 <a NAME="BugBearVisitor.__checkForM502" ID="BugBearVisitor.__checkForM502"></a>
128 <h4>BugBearVisitor.__checkForM502</h4> 162 <h4>BugBearVisitor.__checkForM502</h4>
129 <b>__checkForM502</b>(<i>node</i>) 163 <b>__checkForM502</b>(<i>node</i>)
164
130 <p> 165 <p>
131 Private method to check the use of *strip(). 166 Private method to check the use of *strip().
132 </p><dl> 167 </p>
168 <dl>
169
133 <dt><i>node</i> (ast.Call)</dt> 170 <dt><i>node</i> (ast.Call)</dt>
134 <dd> 171 <dd>
135 reference to the node to be processed 172 reference to the node to be processed
136 </dd> 173 </dd>
137 </dl><a NAME="BugBearVisitor.__checkForM507" ID="BugBearVisitor.__checkForM507"></a> 174 </dl>
175 <a NAME="BugBearVisitor.__checkForM507" ID="BugBearVisitor.__checkForM507"></a>
138 <h4>BugBearVisitor.__checkForM507</h4> 176 <h4>BugBearVisitor.__checkForM507</h4>
139 <b>__checkForM507</b>(<i>node</i>) 177 <b>__checkForM507</b>(<i>node</i>)
178
140 <p> 179 <p>
141 Private method to check for unused loop variables. 180 Private method to check for unused loop variables.
142 </p><dl> 181 </p>
182 <dl>
183
143 <dt><i>node</i> (ast.For)</dt> 184 <dt><i>node</i> (ast.For)</dt>
144 <dd> 185 <dd>
145 reference to the node to be processed 186 reference to the node to be processed
146 </dd> 187 </dd>
147 </dl><a NAME="BugBearVisitor.visit" ID="BugBearVisitor.visit"></a> 188 </dl>
189 <a NAME="BugBearVisitor.visit" ID="BugBearVisitor.visit"></a>
148 <h4>BugBearVisitor.visit</h4> 190 <h4>BugBearVisitor.visit</h4>
149 <b>visit</b>(<i>node</i>) 191 <b>visit</b>(<i>node</i>)
192
150 <p> 193 <p>
151 Public method to traverse a given AST node. 194 Public method to traverse a given AST node.
152 </p><dl> 195 </p>
196 <dl>
197
153 <dt><i>node</i> (ast.Node)</dt> 198 <dt><i>node</i> (ast.Node)</dt>
154 <dd> 199 <dd>
155 AST node to be traversed 200 AST node to be traversed
156 </dd> 201 </dd>
157 </dl><a NAME="BugBearVisitor.visit_Assert" ID="BugBearVisitor.visit_Assert"></a> 202 </dl>
203 <a NAME="BugBearVisitor.visit_Assert" ID="BugBearVisitor.visit_Assert"></a>
158 <h4>BugBearVisitor.visit_Assert</h4> 204 <h4>BugBearVisitor.visit_Assert</h4>
159 <b>visit_Assert</b>(<i>node</i>) 205 <b>visit_Assert</b>(<i>node</i>)
206
160 <p> 207 <p>
161 Public method to handle 'assert' statements. 208 Public method to handle 'assert' statements.
162 </p><dl> 209 </p>
210 <dl>
211
163 <dt><i>node</i> (ast.Assert)</dt> 212 <dt><i>node</i> (ast.Assert)</dt>
164 <dd> 213 <dd>
165 reference to the node to be processed 214 reference to the node to be processed
166 </dd> 215 </dd>
167 </dl><a NAME="BugBearVisitor.visit_Assign" ID="BugBearVisitor.visit_Assign"></a> 216 </dl>
217 <a NAME="BugBearVisitor.visit_Assign" ID="BugBearVisitor.visit_Assign"></a>
168 <h4>BugBearVisitor.visit_Assign</h4> 218 <h4>BugBearVisitor.visit_Assign</h4>
169 <b>visit_Assign</b>(<i>node</i>) 219 <b>visit_Assign</b>(<i>node</i>)
220
170 <p> 221 <p>
171 Public method to handle assignments. 222 Public method to handle assignments.
172 </p><dl> 223 </p>
224 <dl>
225
173 <dt><i>node</i> (ast.Assign)</dt> 226 <dt><i>node</i> (ast.Assign)</dt>
174 <dd> 227 <dd>
175 reference to the node to be processed 228 reference to the node to be processed
176 </dd> 229 </dd>
177 </dl><a NAME="BugBearVisitor.visit_Attribute" ID="BugBearVisitor.visit_Attribute"></a> 230 </dl>
231 <a NAME="BugBearVisitor.visit_Attribute" ID="BugBearVisitor.visit_Attribute"></a>
178 <h4>BugBearVisitor.visit_Attribute</h4> 232 <h4>BugBearVisitor.visit_Attribute</h4>
179 <b>visit_Attribute</b>(<i>node</i>) 233 <b>visit_Attribute</b>(<i>node</i>)
234
180 <p> 235 <p>
181 Public method to handle attributes. 236 Public method to handle attributes.
182 </p><dl> 237 </p>
238 <dl>
239
183 <dt><i>node</i> (ast.Attribute)</dt> 240 <dt><i>node</i> (ast.Attribute)</dt>
184 <dd> 241 <dd>
185 reference to the node to be processed 242 reference to the node to be processed
186 </dd> 243 </dd>
187 </dl><a NAME="BugBearVisitor.visit_Call" ID="BugBearVisitor.visit_Call"></a> 244 </dl>
245 <a NAME="BugBearVisitor.visit_Call" ID="BugBearVisitor.visit_Call"></a>
188 <h4>BugBearVisitor.visit_Call</h4> 246 <h4>BugBearVisitor.visit_Call</h4>
189 <b>visit_Call</b>(<i>node</i>) 247 <b>visit_Call</b>(<i>node</i>)
248
190 <p> 249 <p>
191 Public method to handle a function call. 250 Public method to handle a function call.
192 </p><dl> 251 </p>
252 <dl>
253
193 <dt><i>node</i> (ast.Call)</dt> 254 <dt><i>node</i> (ast.Call)</dt>
194 <dd> 255 <dd>
195 reference to the node to be processed 256 reference to the node to be processed
196 </dd> 257 </dd>
197 </dl><a NAME="BugBearVisitor.visit_For" ID="BugBearVisitor.visit_For"></a> 258 </dl>
259 <a NAME="BugBearVisitor.visit_For" ID="BugBearVisitor.visit_For"></a>
198 <h4>BugBearVisitor.visit_For</h4> 260 <h4>BugBearVisitor.visit_For</h4>
199 <b>visit_For</b>(<i>node</i>) 261 <b>visit_For</b>(<i>node</i>)
262
200 <p> 263 <p>
201 Public method to handle 'for' statements. 264 Public method to handle 'for' statements.
202 </p><dl> 265 </p>
266 <dl>
267
203 <dt><i>node</i> (ast.For)</dt> 268 <dt><i>node</i> (ast.For)</dt>
204 <dd> 269 <dd>
205 reference to the node to be processed 270 reference to the node to be processed
206 </dd> 271 </dd>
207 </dl><a NAME="BugBearVisitor.visit_JoinedStr" ID="BugBearVisitor.visit_JoinedStr"></a> 272 </dl>
273 <a NAME="BugBearVisitor.visit_JoinedStr" ID="BugBearVisitor.visit_JoinedStr"></a>
208 <h4>BugBearVisitor.visit_JoinedStr</h4> 274 <h4>BugBearVisitor.visit_JoinedStr</h4>
209 <b>visit_JoinedStr</b>(<i>node</i>) 275 <b>visit_JoinedStr</b>(<i>node</i>)
276
210 <p> 277 <p>
211 Public method to handle f-string arguments. 278 Public method to handle f-string arguments.
212 </p><dl> 279 </p>
280 <dl>
281
213 <dt><i>node</i> (ast.JoinedStr)</dt> 282 <dt><i>node</i> (ast.JoinedStr)</dt>
214 <dd> 283 <dd>
215 reference to the node to be processed 284 reference to the node to be processed
216 </dd> 285 </dd>
217 </dl><a NAME="BugBearVisitor.visit_UAdd" ID="BugBearVisitor.visit_UAdd"></a> 286 </dl>
287 <a NAME="BugBearVisitor.visit_UAdd" ID="BugBearVisitor.visit_UAdd"></a>
218 <h4>BugBearVisitor.visit_UAdd</h4> 288 <h4>BugBearVisitor.visit_UAdd</h4>
219 <b>visit_UAdd</b>(<i>node</i>) 289 <b>visit_UAdd</b>(<i>node</i>)
290
220 <p> 291 <p>
221 Public method to handle unary additions. 292 Public method to handle unary additions.
222 </p><dl> 293 </p>
294 <dl>
295
223 <dt><i>node</i> (ast.UAdd)</dt> 296 <dt><i>node</i> (ast.UAdd)</dt>
224 <dd> 297 <dd>
225 reference to the node to be processed 298 reference to the node to be processed
226 </dd> 299 </dd>
227 </dl> 300 </dl>
228 <div align="right"><a href="#top">Up</a></div> 301 <div align="right"><a href="#top">Up</a></div>
229 <hr /><hr /> 302 <hr />
303 <hr />
230 <a NAME="DateTimeVisitor" ID="DateTimeVisitor"></a> 304 <a NAME="DateTimeVisitor" ID="DateTimeVisitor"></a>
231 <h2>DateTimeVisitor</h2> 305 <h2>DateTimeVisitor</h2>
306
232 <p> 307 <p>
233 Class implementing a node visitor to check datetime function calls. 308 Class implementing a node visitor to check datetime function calls.
234 </p><p> 309 </p>
310 <p>
235 Note: This class is modelled after flake8_datetimez checker. 311 Note: This class is modelled after flake8_datetimez checker.
236 </p> 312 </p>
237 <h3>Derived from</h3> 313 <h3>Derived from</h3>
238 ast.NodeVisitor 314 ast.NodeVisitor
239 <h3>Class Attributes</h3> 315 <h3>Class Attributes</h3>
316
240 <table> 317 <table>
241 <tr><td>None</td></tr> 318 <tr><td>None</td></tr>
242 </table> 319 </table>
243 <h3>Class Methods</h3> 320 <h3>Class Methods</h3>
321
244 <table> 322 <table>
245 <tr><td>None</td></tr> 323 <tr><td>None</td></tr>
246 </table> 324 </table>
247 <h3>Methods</h3> 325 <h3>Methods</h3>
248 <table> 326
327 <table>
328
249 <tr> 329 <tr>
250 <td><a href="#DateTimeVisitor.__init__">DateTimeVisitor</a></td> 330 <td><a href="#DateTimeVisitor.__init__">DateTimeVisitor</a></td>
251 <td>Constructor</td> 331 <td>Constructor</td>
252 </tr><tr> 332 </tr>
333 <tr>
253 <td><a href="#DateTimeVisitor.__getFromKeywords">__getFromKeywords</a></td> 334 <td><a href="#DateTimeVisitor.__getFromKeywords">__getFromKeywords</a></td>
254 <td>Private method to get a keyword node given its name.</td> 335 <td>Private method to get a keyword node given its name.</td>
255 </tr><tr> 336 </tr>
337 <tr>
256 <td><a href="#DateTimeVisitor.visit_Call">visit_Call</a></td> 338 <td><a href="#DateTimeVisitor.visit_Call">visit_Call</a></td>
257 <td>Public method to handle a function call.</td> 339 <td>Public method to handle a function call.</td>
258 </tr> 340 </tr>
259 </table> 341 </table>
260 <h3>Static Methods</h3> 342 <h3>Static Methods</h3>
343
261 <table> 344 <table>
262 <tr><td>None</td></tr> 345 <tr><td>None</td></tr>
263 </table> 346 </table>
347
264 <a NAME="DateTimeVisitor.__init__" ID="DateTimeVisitor.__init__"></a> 348 <a NAME="DateTimeVisitor.__init__" ID="DateTimeVisitor.__init__"></a>
265 <h4>DateTimeVisitor (Constructor)</h4> 349 <h4>DateTimeVisitor (Constructor)</h4>
266 <b>DateTimeVisitor</b>(<i></i>) 350 <b>DateTimeVisitor</b>(<i></i>)
351
267 <p> 352 <p>
268 Constructor 353 Constructor
269 </p><a NAME="DateTimeVisitor.__getFromKeywords" ID="DateTimeVisitor.__getFromKeywords"></a> 354 </p>
355 <a NAME="DateTimeVisitor.__getFromKeywords" ID="DateTimeVisitor.__getFromKeywords"></a>
270 <h4>DateTimeVisitor.__getFromKeywords</h4> 356 <h4>DateTimeVisitor.__getFromKeywords</h4>
271 <b>__getFromKeywords</b>(<i>keywords, name</i>) 357 <b>__getFromKeywords</b>(<i>keywords, name</i>)
358
272 <p> 359 <p>
273 Private method to get a keyword node given its name. 360 Private method to get a keyword node given its name.
274 </p><dl> 361 </p>
362 <dl>
363
275 <dt><i>keywords</i> (list of ast.AST)</dt> 364 <dt><i>keywords</i> (list of ast.AST)</dt>
276 <dd> 365 <dd>
277 list of keyword argument nodes 366 list of keyword argument nodes
278 </dd><dt><i>name</i> (str)</dt> 367 </dd>
368 <dt><i>name</i> (str)</dt>
279 <dd> 369 <dd>
280 name of the keyword node 370 name of the keyword node
281 </dd> 371 </dd>
282 </dl><dl> 372 </dl>
373 <dl>
283 <dt>Returns:</dt> 374 <dt>Returns:</dt>
284 <dd> 375 <dd>
285 keyword node 376 keyword node
286 </dd> 377 </dd>
287 </dl><dl> 378 </dl>
379 <dl>
288 <dt>Return Type:</dt> 380 <dt>Return Type:</dt>
289 <dd> 381 <dd>
290 ast.AST 382 ast.AST
291 </dd> 383 </dd>
292 </dl><a NAME="DateTimeVisitor.visit_Call" ID="DateTimeVisitor.visit_Call"></a> 384 </dl>
385 <a NAME="DateTimeVisitor.visit_Call" ID="DateTimeVisitor.visit_Call"></a>
293 <h4>DateTimeVisitor.visit_Call</h4> 386 <h4>DateTimeVisitor.visit_Call</h4>
294 <b>visit_Call</b>(<i>node</i>) 387 <b>visit_Call</b>(<i>node</i>)
388
295 <p> 389 <p>
296 Public method to handle a function call. 390 Public method to handle a function call.
297 </p><p> 391 </p>
392 <p>
298 Every datetime related function call is check for use of the naive 393 Every datetime related function call is check for use of the naive
299 variant (i.e. use without TZ info). 394 variant (i.e. use without TZ info).
300 </p><dl> 395 </p>
396 <dl>
397
301 <dt><i>node</i> (ast.Call)</dt> 398 <dt><i>node</i> (ast.Call)</dt>
302 <dd> 399 <dd>
303 reference to the node to be processed 400 reference to the node to be processed
304 </dd> 401 </dd>
305 </dl> 402 </dl>
306 <div align="right"><a href="#top">Up</a></div> 403 <div align="right"><a href="#top">Up</a></div>
307 <hr /><hr /> 404 <hr />
405 <hr />
308 <a NAME="LoggingVisitor" ID="LoggingVisitor"></a> 406 <a NAME="LoggingVisitor" ID="LoggingVisitor"></a>
309 <h2>LoggingVisitor</h2> 407 <h2>LoggingVisitor</h2>
408
310 <p> 409 <p>
311 Class implementing a node visitor to check logging statements. 410 Class implementing a node visitor to check logging statements.
312 </p> 411 </p>
313 <h3>Derived from</h3> 412 <h3>Derived from</h3>
314 ast.NodeVisitor 413 ast.NodeVisitor
315 <h3>Class Attributes</h3> 414 <h3>Class Attributes</h3>
415
316 <table> 416 <table>
317 <tr><td>LoggingLevels</td></tr> 417 <tr><td>LoggingLevels</td></tr>
318 </table> 418 </table>
319 <h3>Class Methods</h3> 419 <h3>Class Methods</h3>
420
320 <table> 421 <table>
321 <tr><td>None</td></tr> 422 <tr><td>None</td></tr>
322 </table> 423 </table>
323 <h3>Methods</h3> 424 <h3>Methods</h3>
324 <table> 425
426 <table>
427
325 <tr> 428 <tr>
326 <td><a href="#LoggingVisitor.__init__">LoggingVisitor</a></td> 429 <td><a href="#LoggingVisitor.__init__">LoggingVisitor</a></td>
327 <td>Constructor</td> 430 <td>Constructor</td>
328 </tr><tr> 431 </tr>
432 <tr>
329 <td><a href="#LoggingVisitor.__detectLoggingLevel">__detectLoggingLevel</a></td> 433 <td><a href="#LoggingVisitor.__detectLoggingLevel">__detectLoggingLevel</a></td>
330 <td>Private method to decide whether an AST Call is a logging call.</td> 434 <td>Private method to decide whether an AST Call is a logging call.</td>
331 </tr><tr> 435 </tr>
436 <tr>
332 <td><a href="#LoggingVisitor.__isFormatCall">__isFormatCall</a></td> 437 <td><a href="#LoggingVisitor.__isFormatCall">__isFormatCall</a></td>
333 <td>Private method to check if a function call uses format.</td> 438 <td>Private method to check if a function call uses format.</td>
334 </tr><tr> 439 </tr>
440 <tr>
335 <td><a href="#LoggingVisitor.__withinExtraKeyword">__withinExtraKeyword</a></td> 441 <td><a href="#LoggingVisitor.__withinExtraKeyword">__withinExtraKeyword</a></td>
336 <td>Private method to check, if we are inside the extra keyword.</td> 442 <td>Private method to check, if we are inside the extra keyword.</td>
337 </tr><tr> 443 </tr>
444 <tr>
338 <td><a href="#LoggingVisitor.__withinLoggingArgument">__withinLoggingArgument</a></td> 445 <td><a href="#LoggingVisitor.__withinLoggingArgument">__withinLoggingArgument</a></td>
339 <td>Private method to check, if we are inside a logging argument.</td> 446 <td>Private method to check, if we are inside a logging argument.</td>
340 </tr><tr> 447 </tr>
448 <tr>
341 <td><a href="#LoggingVisitor.__withinLoggingStatement">__withinLoggingStatement</a></td> 449 <td><a href="#LoggingVisitor.__withinLoggingStatement">__withinLoggingStatement</a></td>
342 <td>Private method to check, if we are inside a logging statement.</td> 450 <td>Private method to check, if we are inside a logging statement.</td>
343 </tr><tr> 451 </tr>
452 <tr>
344 <td><a href="#LoggingVisitor.visit_BinOp">visit_BinOp</a></td> 453 <td><a href="#LoggingVisitor.visit_BinOp">visit_BinOp</a></td>
345 <td>Public method to handle binary operations while processing the first logging argument.</td> 454 <td>Public method to handle binary operations while processing the first logging argument.</td>
346 </tr><tr> 455 </tr>
456 <tr>
347 <td><a href="#LoggingVisitor.visit_Call">visit_Call</a></td> 457 <td><a href="#LoggingVisitor.visit_Call">visit_Call</a></td>
348 <td>Public method to handle a function call.</td> 458 <td>Public method to handle a function call.</td>
349 </tr><tr> 459 </tr>
460 <tr>
350 <td><a href="#LoggingVisitor.visit_JoinedStr">visit_JoinedStr</a></td> 461 <td><a href="#LoggingVisitor.visit_JoinedStr">visit_JoinedStr</a></td>
351 <td>Public method to handle f-string arguments.</td> 462 <td>Public method to handle f-string arguments.</td>
352 </tr> 463 </tr>
353 </table> 464 </table>
354 <h3>Static Methods</h3> 465 <h3>Static Methods</h3>
466
355 <table> 467 <table>
356 <tr><td>None</td></tr> 468 <tr><td>None</td></tr>
357 </table> 469 </table>
470
358 <a NAME="LoggingVisitor.__init__" ID="LoggingVisitor.__init__"></a> 471 <a NAME="LoggingVisitor.__init__" ID="LoggingVisitor.__init__"></a>
359 <h4>LoggingVisitor (Constructor)</h4> 472 <h4>LoggingVisitor (Constructor)</h4>
360 <b>LoggingVisitor</b>(<i></i>) 473 <b>LoggingVisitor</b>(<i></i>)
474
361 <p> 475 <p>
362 Constructor 476 Constructor
363 </p><a NAME="LoggingVisitor.__detectLoggingLevel" ID="LoggingVisitor.__detectLoggingLevel"></a> 477 </p>
478 <a NAME="LoggingVisitor.__detectLoggingLevel" ID="LoggingVisitor.__detectLoggingLevel"></a>
364 <h4>LoggingVisitor.__detectLoggingLevel</h4> 479 <h4>LoggingVisitor.__detectLoggingLevel</h4>
365 <b>__detectLoggingLevel</b>(<i>node</i>) 480 <b>__detectLoggingLevel</b>(<i>node</i>)
481
366 <p> 482 <p>
367 Private method to decide whether an AST Call is a logging call. 483 Private method to decide whether an AST Call is a logging call.
368 </p><dl> 484 </p>
485 <dl>
486
369 <dt><i>node</i> (ast.Call)</dt> 487 <dt><i>node</i> (ast.Call)</dt>
370 <dd> 488 <dd>
371 reference to the node to be processed 489 reference to the node to be processed
372 </dd> 490 </dd>
373 </dl><dl> 491 </dl>
492 <dl>
374 <dt>Returns:</dt> 493 <dt>Returns:</dt>
375 <dd> 494 <dd>
376 logging level 495 logging level
377 </dd> 496 </dd>
378 </dl><dl> 497 </dl>
498 <dl>
379 <dt>Return Type:</dt> 499 <dt>Return Type:</dt>
380 <dd> 500 <dd>
381 str or None 501 str or None
382 </dd> 502 </dd>
383 </dl><a NAME="LoggingVisitor.__isFormatCall" ID="LoggingVisitor.__isFormatCall"></a> 503 </dl>
504 <a NAME="LoggingVisitor.__isFormatCall" ID="LoggingVisitor.__isFormatCall"></a>
384 <h4>LoggingVisitor.__isFormatCall</h4> 505 <h4>LoggingVisitor.__isFormatCall</h4>
385 <b>__isFormatCall</b>(<i>node</i>) 506 <b>__isFormatCall</b>(<i>node</i>)
507
386 <p> 508 <p>
387 Private method to check if a function call uses format. 509 Private method to check if a function call uses format.
388 </p><dl> 510 </p>
511 <dl>
512
389 <dt><i>node</i> (ast.Call)</dt> 513 <dt><i>node</i> (ast.Call)</dt>
390 <dd> 514 <dd>
391 reference to the node to be processed 515 reference to the node to be processed
392 </dd> 516 </dd>
393 </dl><dl> 517 </dl>
518 <dl>
394 <dt>Returns:</dt> 519 <dt>Returns:</dt>
395 <dd> 520 <dd>
396 flag indicating the function call uses format 521 flag indicating the function call uses format
397 </dd> 522 </dd>
398 </dl><dl> 523 </dl>
524 <dl>
399 <dt>Return Type:</dt> 525 <dt>Return Type:</dt>
400 <dd> 526 <dd>
401 bool 527 bool
402 </dd> 528 </dd>
403 </dl><a NAME="LoggingVisitor.__withinExtraKeyword" ID="LoggingVisitor.__withinExtraKeyword"></a> 529 </dl>
530 <a NAME="LoggingVisitor.__withinExtraKeyword" ID="LoggingVisitor.__withinExtraKeyword"></a>
404 <h4>LoggingVisitor.__withinExtraKeyword</h4> 531 <h4>LoggingVisitor.__withinExtraKeyword</h4>
405 <b>__withinExtraKeyword</b>(<i>node</i>) 532 <b>__withinExtraKeyword</b>(<i>node</i>)
533
406 <p> 534 <p>
407 Private method to check, if we are inside the extra keyword. 535 Private method to check, if we are inside the extra keyword.
408 </p><dl> 536 </p>
537 <dl>
538
409 <dt><i>node</i> (ast.keyword)</dt> 539 <dt><i>node</i> (ast.keyword)</dt>
410 <dd> 540 <dd>
411 reference to the node to be checked 541 reference to the node to be checked
412 </dd> 542 </dd>
413 </dl><dl> 543 </dl>
544 <dl>
414 <dt>Returns:</dt> 545 <dt>Returns:</dt>
415 <dd> 546 <dd>
416 flag indicating we are inside the extra keyword 547 flag indicating we are inside the extra keyword
417 </dd> 548 </dd>
418 </dl><dl> 549 </dl>
550 <dl>
419 <dt>Return Type:</dt> 551 <dt>Return Type:</dt>
420 <dd> 552 <dd>
421 bool 553 bool
422 </dd> 554 </dd>
423 </dl><a NAME="LoggingVisitor.__withinLoggingArgument" ID="LoggingVisitor.__withinLoggingArgument"></a> 555 </dl>
556 <a NAME="LoggingVisitor.__withinLoggingArgument" ID="LoggingVisitor.__withinLoggingArgument"></a>
424 <h4>LoggingVisitor.__withinLoggingArgument</h4> 557 <h4>LoggingVisitor.__withinLoggingArgument</h4>
425 <b>__withinLoggingArgument</b>(<i></i>) 558 <b>__withinLoggingArgument</b>(<i></i>)
559
426 <p> 560 <p>
427 Private method to check, if we are inside a logging argument. 561 Private method to check, if we are inside a logging argument.
428 </p><dl> 562 </p>
563 <dl>
429 <dt>Returns:</dt> 564 <dt>Returns:</dt>
430 <dd> 565 <dd>
431 flag indicating we are inside a logging argument 566 flag indicating we are inside a logging argument
432 </dd> 567 </dd>
433 </dl><dl> 568 </dl>
569 <dl>
434 <dt>Return Type:</dt> 570 <dt>Return Type:</dt>
435 <dd> 571 <dd>
436 bool 572 bool
437 </dd> 573 </dd>
438 </dl><a NAME="LoggingVisitor.__withinLoggingStatement" ID="LoggingVisitor.__withinLoggingStatement"></a> 574 </dl>
575 <a NAME="LoggingVisitor.__withinLoggingStatement" ID="LoggingVisitor.__withinLoggingStatement"></a>
439 <h4>LoggingVisitor.__withinLoggingStatement</h4> 576 <h4>LoggingVisitor.__withinLoggingStatement</h4>
440 <b>__withinLoggingStatement</b>(<i></i>) 577 <b>__withinLoggingStatement</b>(<i></i>)
578
441 <p> 579 <p>
442 Private method to check, if we are inside a logging statement. 580 Private method to check, if we are inside a logging statement.
443 </p><dl> 581 </p>
582 <dl>
444 <dt>Returns:</dt> 583 <dt>Returns:</dt>
445 <dd> 584 <dd>
446 flag indicating we are inside a logging statement 585 flag indicating we are inside a logging statement
447 </dd> 586 </dd>
448 </dl><dl> 587 </dl>
588 <dl>
449 <dt>Return Type:</dt> 589 <dt>Return Type:</dt>
450 <dd> 590 <dd>
451 bool 591 bool
452 </dd> 592 </dd>
453 </dl><a NAME="LoggingVisitor.visit_BinOp" ID="LoggingVisitor.visit_BinOp"></a> 593 </dl>
594 <a NAME="LoggingVisitor.visit_BinOp" ID="LoggingVisitor.visit_BinOp"></a>
454 <h4>LoggingVisitor.visit_BinOp</h4> 595 <h4>LoggingVisitor.visit_BinOp</h4>
455 <b>visit_BinOp</b>(<i>node</i>) 596 <b>visit_BinOp</b>(<i>node</i>)
597
456 <p> 598 <p>
457 Public method to handle binary operations while processing the first 599 Public method to handle binary operations while processing the first
458 logging argument. 600 logging argument.
459 </p><dl> 601 </p>
602 <dl>
603
460 <dt><i>node</i> (ast.BinOp)</dt> 604 <dt><i>node</i> (ast.BinOp)</dt>
461 <dd> 605 <dd>
462 reference to the node to be processed 606 reference to the node to be processed
463 </dd> 607 </dd>
464 </dl><a NAME="LoggingVisitor.visit_Call" ID="LoggingVisitor.visit_Call"></a> 608 </dl>
609 <a NAME="LoggingVisitor.visit_Call" ID="LoggingVisitor.visit_Call"></a>
465 <h4>LoggingVisitor.visit_Call</h4> 610 <h4>LoggingVisitor.visit_Call</h4>
466 <b>visit_Call</b>(<i>node</i>) 611 <b>visit_Call</b>(<i>node</i>)
612
467 <p> 613 <p>
468 Public method to handle a function call. 614 Public method to handle a function call.
469 </p><p> 615 </p>
616 <p>
470 Every logging statement and string format is expected to be a function 617 Every logging statement and string format is expected to be a function
471 call. 618 call.
472 </p><dl> 619 </p>
620 <dl>
621
473 <dt><i>node</i> (ast.Call)</dt> 622 <dt><i>node</i> (ast.Call)</dt>
474 <dd> 623 <dd>
475 reference to the node to be processed 624 reference to the node to be processed
476 </dd> 625 </dd>
477 </dl><a NAME="LoggingVisitor.visit_JoinedStr" ID="LoggingVisitor.visit_JoinedStr"></a> 626 </dl>
627 <a NAME="LoggingVisitor.visit_JoinedStr" ID="LoggingVisitor.visit_JoinedStr"></a>
478 <h4>LoggingVisitor.visit_JoinedStr</h4> 628 <h4>LoggingVisitor.visit_JoinedStr</h4>
479 <b>visit_JoinedStr</b>(<i>node</i>) 629 <b>visit_JoinedStr</b>(<i>node</i>)
630
480 <p> 631 <p>
481 Public method to handle f-string arguments. 632 Public method to handle f-string arguments.
482 </p><dl> 633 </p>
634 <dl>
635
483 <dt><i>node</i> (ast.JoinedStr)</dt> 636 <dt><i>node</i> (ast.JoinedStr)</dt>
484 <dd> 637 <dd>
485 reference to the node to be processed 638 reference to the node to be processed
486 </dd> 639 </dd>
487 </dl> 640 </dl>
488 <div align="right"><a href="#top">Up</a></div> 641 <div align="right"><a href="#top">Up</a></div>
489 <hr /><hr /> 642 <hr />
643 <hr />
490 <a NAME="MiscellaneousChecker" ID="MiscellaneousChecker"></a> 644 <a NAME="MiscellaneousChecker" ID="MiscellaneousChecker"></a>
491 <h2>MiscellaneousChecker</h2> 645 <h2>MiscellaneousChecker</h2>
646
492 <p> 647 <p>
493 Class implementing a checker for miscellaneous checks. 648 Class implementing a checker for miscellaneous checks.
494 </p> 649 </p>
495 <h3>Derived from</h3> 650 <h3>Derived from</h3>
496 object 651 object
497 <h3>Class Attributes</h3> 652 <h3>Class Attributes</h3>
653
498 <table> 654 <table>
499 <tr><td>BuiltinsWhiteList</td></tr><tr><td>Codes</td></tr><tr><td>FormatFieldRegex</td></tr><tr><td>Formatter</td></tr> 655 <tr><td>BuiltinsWhiteList</td></tr><tr><td>Codes</td></tr><tr><td>FormatFieldRegex</td></tr><tr><td>Formatter</td></tr>
500 </table> 656 </table>
501 <h3>Class Methods</h3> 657 <h3>Class Methods</h3>
658
502 <table> 659 <table>
503 <tr><td>None</td></tr> 660 <tr><td>None</td></tr>
504 </table> 661 </table>
505 <h3>Methods</h3> 662 <h3>Methods</h3>
506 <table> 663
664 <table>
665
507 <tr> 666 <tr>
508 <td><a href="#MiscellaneousChecker.__init__">MiscellaneousChecker</a></td> 667 <td><a href="#MiscellaneousChecker.__init__">MiscellaneousChecker</a></td>
509 <td>Constructor</td> 668 <td>Constructor</td>
510 </tr><tr> 669 </tr>
670 <tr>
511 <td><a href="#MiscellaneousChecker.__checkBugBear">__checkBugBear</a></td> 671 <td><a href="#MiscellaneousChecker.__checkBugBear">__checkBugBear</a></td>
512 <td>Private method for bugbear checks.</td> 672 <td>Private method for bugbear checks.</td>
513 </tr><tr> 673 </tr>
674 <tr>
514 <td><a href="#MiscellaneousChecker.__checkBuiltins">__checkBuiltins</a></td> 675 <td><a href="#MiscellaneousChecker.__checkBuiltins">__checkBuiltins</a></td>
515 <td>Private method to check, if built-ins are shadowed.</td> 676 <td>Private method to check, if built-ins are shadowed.</td>
516 </tr><tr> 677 </tr>
678 <tr>
517 <td><a href="#MiscellaneousChecker.__checkCoding">__checkCoding</a></td> 679 <td><a href="#MiscellaneousChecker.__checkCoding">__checkCoding</a></td>
518 <td>Private method to check the presence of a coding line and valid encodings.</td> 680 <td>Private method to check the presence of a coding line and valid encodings.</td>
519 </tr><tr> 681 </tr>
682 <tr>
520 <td><a href="#MiscellaneousChecker.__checkCommentedCode">__checkCommentedCode</a></td> 683 <td><a href="#MiscellaneousChecker.__checkCommentedCode">__checkCommentedCode</a></td>
521 <td>Private method to check for commented code.</td> 684 <td>Private method to check for commented code.</td>
522 </tr><tr> 685 </tr>
686 <tr>
523 <td><a href="#MiscellaneousChecker.__checkComprehensions">__checkComprehensions</a></td> 687 <td><a href="#MiscellaneousChecker.__checkComprehensions">__checkComprehensions</a></td>
524 <td>Private method to check some comprehension related things.</td> 688 <td>Private method to check some comprehension related things.</td>
525 </tr><tr> 689 </tr>
690 <tr>
526 <td><a href="#MiscellaneousChecker.__checkCopyright">__checkCopyright</a></td> 691 <td><a href="#MiscellaneousChecker.__checkCopyright">__checkCopyright</a></td>
527 <td>Private method to check the presence of a copyright statement.</td> 692 <td>Private method to check the presence of a copyright statement.</td>
528 </tr><tr> 693 </tr>
694 <tr>
529 <td><a href="#MiscellaneousChecker.__checkDateTime">__checkDateTime</a></td> 695 <td><a href="#MiscellaneousChecker.__checkDateTime">__checkDateTime</a></td>
530 <td>Private method to check use of naive datetime functions.</td> 696 <td>Private method to check use of naive datetime functions.</td>
531 </tr><tr> 697 </tr>
698 <tr>
532 <td><a href="#MiscellaneousChecker.__checkDictWithSortedKeys">__checkDictWithSortedKeys</a></td> 699 <td><a href="#MiscellaneousChecker.__checkDictWithSortedKeys">__checkDictWithSortedKeys</a></td>
533 <td>Private method to check, if dictionary keys appear in sorted order.</td> 700 <td>Private method to check, if dictionary keys appear in sorted order.</td>
534 </tr><tr> 701 </tr>
702 <tr>
535 <td><a href="#MiscellaneousChecker.__checkFormatString">__checkFormatString</a></td> 703 <td><a href="#MiscellaneousChecker.__checkFormatString">__checkFormatString</a></td>
536 <td>Private method to check string format strings.</td> 704 <td>Private method to check string format strings.</td>
537 </tr><tr> 705 </tr>
706 <tr>
538 <td><a href="#MiscellaneousChecker.__checkFuture">__checkFuture</a></td> 707 <td><a href="#MiscellaneousChecker.__checkFuture">__checkFuture</a></td>
539 <td>Private method to check the __future__ imports.</td> 708 <td>Private method to check the __future__ imports.</td>
540 </tr><tr> 709 </tr>
710 <tr>
541 <td><a href="#MiscellaneousChecker.__checkGettext">__checkGettext</a></td> 711 <td><a href="#MiscellaneousChecker.__checkGettext">__checkGettext</a></td>
542 <td>Private method to check the 'gettext' import statement.</td> 712 <td>Private method to check the 'gettext' import statement.</td>
543 </tr><tr> 713 </tr>
714 <tr>
544 <td><a href="#MiscellaneousChecker.__checkLineContinuation">__checkLineContinuation</a></td> 715 <td><a href="#MiscellaneousChecker.__checkLineContinuation">__checkLineContinuation</a></td>
545 <td>Private method to check line continuation using backslash.</td> 716 <td>Private method to check line continuation using backslash.</td>
546 </tr><tr> 717 </tr>
718 <tr>
547 <td><a href="#MiscellaneousChecker.__checkLogging">__checkLogging</a></td> 719 <td><a href="#MiscellaneousChecker.__checkLogging">__checkLogging</a></td>
548 <td>Private method to check logging statements.</td> 720 <td>Private method to check logging statements.</td>
549 </tr><tr> 721 </tr>
722 <tr>
550 <td><a href="#MiscellaneousChecker.__checkMutableDefault">__checkMutableDefault</a></td> 723 <td><a href="#MiscellaneousChecker.__checkMutableDefault">__checkMutableDefault</a></td>
551 <td>Private method to check for use of mutable types as default arguments.</td> 724 <td>Private method to check for use of mutable types as default arguments.</td>
552 </tr><tr> 725 </tr>
726 <tr>
553 <td><a href="#MiscellaneousChecker.__checkPep3101">__checkPep3101</a></td> 727 <td><a href="#MiscellaneousChecker.__checkPep3101">__checkPep3101</a></td>
554 <td>Private method to check for old style string formatting.</td> 728 <td>Private method to check for old style string formatting.</td>
555 </tr><tr> 729 </tr>
730 <tr>
556 <td><a href="#MiscellaneousChecker.__checkPrintStatements">__checkPrintStatements</a></td> 731 <td><a href="#MiscellaneousChecker.__checkPrintStatements">__checkPrintStatements</a></td>
557 <td>Private method to check for print statements.</td> 732 <td>Private method to check for print statements.</td>
558 </tr><tr> 733 </tr>
734 <tr>
559 <td><a href="#MiscellaneousChecker.__checkReturn">__checkReturn</a></td> 735 <td><a href="#MiscellaneousChecker.__checkReturn">__checkReturn</a></td>
560 <td>Private method to check return statements.</td> 736 <td>Private method to check return statements.</td>
561 </tr><tr> 737 </tr>
738 <tr>
562 <td><a href="#MiscellaneousChecker.__checkSysVersion">__checkSysVersion</a></td> 739 <td><a href="#MiscellaneousChecker.__checkSysVersion">__checkSysVersion</a></td>
563 <td>Private method to check the use of sys.version and sys.version_info.</td> 740 <td>Private method to check the use of sys.version and sys.version_info.</td>
564 </tr><tr> 741 </tr>
742 <tr>
565 <td><a href="#MiscellaneousChecker.__checkTuple">__checkTuple</a></td> 743 <td><a href="#MiscellaneousChecker.__checkTuple">__checkTuple</a></td>
566 <td>Private method to check for one element tuples.</td> 744 <td>Private method to check for one element tuples.</td>
567 </tr><tr> 745 </tr>
746 <tr>
568 <td><a href="#MiscellaneousChecker.__dictShouldBeChecked">__dictShouldBeChecked</a></td> 747 <td><a href="#MiscellaneousChecker.__dictShouldBeChecked">__dictShouldBeChecked</a></td>
569 <td>Private function to test, if the node should be checked.</td> 748 <td>Private function to test, if the node should be checked.</td>
570 </tr><tr> 749 </tr>
750 <tr>
571 <td><a href="#MiscellaneousChecker.__error">__error</a></td> 751 <td><a href="#MiscellaneousChecker.__error">__error</a></td>
572 <td>Private method to record an issue.</td> 752 <td>Private method to record an issue.</td>
573 </tr><tr> 753 </tr>
754 <tr>
574 <td><a href="#MiscellaneousChecker.__generateTree">__generateTree</a></td> 755 <td><a href="#MiscellaneousChecker.__generateTree">__generateTree</a></td>
575 <td>Private method to generate an AST for our source.</td> 756 <td>Private method to generate an AST for our source.</td>
576 </tr><tr> 757 </tr>
758 <tr>
577 <td><a href="#MiscellaneousChecker.__getCoding">__getCoding</a></td> 759 <td><a href="#MiscellaneousChecker.__getCoding">__getCoding</a></td>
578 <td>Private method to get the defined coding of the source.</td> 760 <td>Private method to get the defined coding of the source.</td>
579 </tr><tr> 761 </tr>
762 <tr>
580 <td><a href="#MiscellaneousChecker.__getFields">__getFields</a></td> 763 <td><a href="#MiscellaneousChecker.__getFields">__getFields</a></td>
581 <td>Private method to extract the format field information.</td> 764 <td>Private method to extract the format field information.</td>
582 </tr><tr> 765 </tr>
766 <tr>
583 <td><a href="#MiscellaneousChecker.__ignoreCode">__ignoreCode</a></td> 767 <td><a href="#MiscellaneousChecker.__ignoreCode">__ignoreCode</a></td>
584 <td>Private method to check if the message code should be ignored.</td> 768 <td>Private method to check if the message code should be ignored.</td>
585 </tr><tr> 769 </tr>
770 <tr>
586 <td><a href="#MiscellaneousChecker.__reportInvalidSyntax">__reportInvalidSyntax</a></td> 771 <td><a href="#MiscellaneousChecker.__reportInvalidSyntax">__reportInvalidSyntax</a></td>
587 <td>Private method to report a syntax error.</td> 772 <td>Private method to report a syntax error.</td>
588 </tr><tr> 773 </tr>
774 <tr>
589 <td><a href="#MiscellaneousChecker.run">run</a></td> 775 <td><a href="#MiscellaneousChecker.run">run</a></td>
590 <td>Public method to check the given source against miscellaneous conditions.</td> 776 <td>Public method to check the given source against miscellaneous conditions.</td>
591 </tr> 777 </tr>
592 </table> 778 </table>
593 <h3>Static Methods</h3> 779 <h3>Static Methods</h3>
780
594 <table> 781 <table>
595 <tr><td>None</td></tr> 782 <tr><td>None</td></tr>
596 </table> 783 </table>
784
597 <a NAME="MiscellaneousChecker.__init__" ID="MiscellaneousChecker.__init__"></a> 785 <a NAME="MiscellaneousChecker.__init__" ID="MiscellaneousChecker.__init__"></a>
598 <h4>MiscellaneousChecker (Constructor)</h4> 786 <h4>MiscellaneousChecker (Constructor)</h4>
599 <b>MiscellaneousChecker</b>(<i>source, filename, select, ignore, expected, repeat, args</i>) 787 <b>MiscellaneousChecker</b>(<i>source, filename, select, ignore, expected, repeat, args</i>)
788
600 <p> 789 <p>
601 Constructor 790 Constructor
602 </p><dl> 791 </p>
792 <dl>
793
603 <dt><i>source</i> (list of str)</dt> 794 <dt><i>source</i> (list of str)</dt>
604 <dd> 795 <dd>
605 source code to be checked 796 source code to be checked
606 </dd><dt><i>filename</i> (str)</dt> 797 </dd>
798 <dt><i>filename</i> (str)</dt>
607 <dd> 799 <dd>
608 name of the source file 800 name of the source file
609 </dd><dt><i>select</i> (list of str)</dt> 801 </dd>
802 <dt><i>select</i> (list of str)</dt>
610 <dd> 803 <dd>
611 list of selected codes 804 list of selected codes
612 </dd><dt><i>ignore</i> (list of str)</dt> 805 </dd>
806 <dt><i>ignore</i> (list of str)</dt>
613 <dd> 807 <dd>
614 list of codes to be ignored 808 list of codes to be ignored
615 </dd><dt><i>expected</i> (list of str)</dt> 809 </dd>
810 <dt><i>expected</i> (list of str)</dt>
616 <dd> 811 <dd>
617 list of expected codes 812 list of expected codes
618 </dd><dt><i>repeat</i> (bool)</dt> 813 </dd>
814 <dt><i>repeat</i> (bool)</dt>
619 <dd> 815 <dd>
620 flag indicating to report each occurrence of a code 816 flag indicating to report each occurrence of a code
621 </dd><dt><i>args</i> (dict)</dt> 817 </dd>
818 <dt><i>args</i> (dict)</dt>
622 <dd> 819 <dd>
623 dictionary of arguments for the miscellaneous checks 820 dictionary of arguments for the miscellaneous checks
624 </dd> 821 </dd>
625 </dl><a NAME="MiscellaneousChecker.__checkBugBear" ID="MiscellaneousChecker.__checkBugBear"></a> 822 </dl>
823 <a NAME="MiscellaneousChecker.__checkBugBear" ID="MiscellaneousChecker.__checkBugBear"></a>
626 <h4>MiscellaneousChecker.__checkBugBear</h4> 824 <h4>MiscellaneousChecker.__checkBugBear</h4>
627 <b>__checkBugBear</b>(<i></i>) 825 <b>__checkBugBear</b>(<i></i>)
826
628 <p> 827 <p>
629 Private method for bugbear checks. 828 Private method for bugbear checks.
630 </p><a NAME="MiscellaneousChecker.__checkBuiltins" ID="MiscellaneousChecker.__checkBuiltins"></a> 829 </p>
830 <a NAME="MiscellaneousChecker.__checkBuiltins" ID="MiscellaneousChecker.__checkBuiltins"></a>
631 <h4>MiscellaneousChecker.__checkBuiltins</h4> 831 <h4>MiscellaneousChecker.__checkBuiltins</h4>
632 <b>__checkBuiltins</b>(<i></i>) 832 <b>__checkBuiltins</b>(<i></i>)
833
633 <p> 834 <p>
634 Private method to check, if built-ins are shadowed. 835 Private method to check, if built-ins are shadowed.
635 </p><a NAME="MiscellaneousChecker.__checkCoding" ID="MiscellaneousChecker.__checkCoding"></a> 836 </p>
837 <a NAME="MiscellaneousChecker.__checkCoding" ID="MiscellaneousChecker.__checkCoding"></a>
636 <h4>MiscellaneousChecker.__checkCoding</h4> 838 <h4>MiscellaneousChecker.__checkCoding</h4>
637 <b>__checkCoding</b>(<i></i>) 839 <b>__checkCoding</b>(<i></i>)
840
638 <p> 841 <p>
639 Private method to check the presence of a coding line and valid 842 Private method to check the presence of a coding line and valid
640 encodings. 843 encodings.
641 </p><a NAME="MiscellaneousChecker.__checkCommentedCode" ID="MiscellaneousChecker.__checkCommentedCode"></a> 844 </p>
845 <a NAME="MiscellaneousChecker.__checkCommentedCode" ID="MiscellaneousChecker.__checkCommentedCode"></a>
642 <h4>MiscellaneousChecker.__checkCommentedCode</h4> 846 <h4>MiscellaneousChecker.__checkCommentedCode</h4>
643 <b>__checkCommentedCode</b>(<i></i>) 847 <b>__checkCommentedCode</b>(<i></i>)
848
644 <p> 849 <p>
645 Private method to check for commented code. 850 Private method to check for commented code.
646 </p><a NAME="MiscellaneousChecker.__checkComprehensions" ID="MiscellaneousChecker.__checkComprehensions"></a> 851 </p>
852 <a NAME="MiscellaneousChecker.__checkComprehensions" ID="MiscellaneousChecker.__checkComprehensions"></a>
647 <h4>MiscellaneousChecker.__checkComprehensions</h4> 853 <h4>MiscellaneousChecker.__checkComprehensions</h4>
648 <b>__checkComprehensions</b>(<i></i>) 854 <b>__checkComprehensions</b>(<i></i>)
855
649 <p> 856 <p>
650 Private method to check some comprehension related things. 857 Private method to check some comprehension related things.
651 </p><a NAME="MiscellaneousChecker.__checkCopyright" ID="MiscellaneousChecker.__checkCopyright"></a> 858 </p>
859 <a NAME="MiscellaneousChecker.__checkCopyright" ID="MiscellaneousChecker.__checkCopyright"></a>
652 <h4>MiscellaneousChecker.__checkCopyright</h4> 860 <h4>MiscellaneousChecker.__checkCopyright</h4>
653 <b>__checkCopyright</b>(<i></i>) 861 <b>__checkCopyright</b>(<i></i>)
862
654 <p> 863 <p>
655 Private method to check the presence of a copyright statement. 864 Private method to check the presence of a copyright statement.
656 </p><a NAME="MiscellaneousChecker.__checkDateTime" ID="MiscellaneousChecker.__checkDateTime"></a> 865 </p>
866 <a NAME="MiscellaneousChecker.__checkDateTime" ID="MiscellaneousChecker.__checkDateTime"></a>
657 <h4>MiscellaneousChecker.__checkDateTime</h4> 867 <h4>MiscellaneousChecker.__checkDateTime</h4>
658 <b>__checkDateTime</b>(<i></i>) 868 <b>__checkDateTime</b>(<i></i>)
869
659 <p> 870 <p>
660 Private method to check use of naive datetime functions. 871 Private method to check use of naive datetime functions.
661 </p><a NAME="MiscellaneousChecker.__checkDictWithSortedKeys" ID="MiscellaneousChecker.__checkDictWithSortedKeys"></a> 872 </p>
873 <a NAME="MiscellaneousChecker.__checkDictWithSortedKeys" ID="MiscellaneousChecker.__checkDictWithSortedKeys"></a>
662 <h4>MiscellaneousChecker.__checkDictWithSortedKeys</h4> 874 <h4>MiscellaneousChecker.__checkDictWithSortedKeys</h4>
663 <b>__checkDictWithSortedKeys</b>(<i></i>) 875 <b>__checkDictWithSortedKeys</b>(<i></i>)
876
664 <p> 877 <p>
665 Private method to check, if dictionary keys appear in sorted order. 878 Private method to check, if dictionary keys appear in sorted order.
666 </p><a NAME="MiscellaneousChecker.__checkFormatString" ID="MiscellaneousChecker.__checkFormatString"></a> 879 </p>
880 <a NAME="MiscellaneousChecker.__checkFormatString" ID="MiscellaneousChecker.__checkFormatString"></a>
667 <h4>MiscellaneousChecker.__checkFormatString</h4> 881 <h4>MiscellaneousChecker.__checkFormatString</h4>
668 <b>__checkFormatString</b>(<i></i>) 882 <b>__checkFormatString</b>(<i></i>)
883
669 <p> 884 <p>
670 Private method to check string format strings. 885 Private method to check string format strings.
671 </p><a NAME="MiscellaneousChecker.__checkFuture" ID="MiscellaneousChecker.__checkFuture"></a> 886 </p>
887 <a NAME="MiscellaneousChecker.__checkFuture" ID="MiscellaneousChecker.__checkFuture"></a>
672 <h4>MiscellaneousChecker.__checkFuture</h4> 888 <h4>MiscellaneousChecker.__checkFuture</h4>
673 <b>__checkFuture</b>(<i></i>) 889 <b>__checkFuture</b>(<i></i>)
890
674 <p> 891 <p>
675 Private method to check the __future__ imports. 892 Private method to check the __future__ imports.
676 </p><a NAME="MiscellaneousChecker.__checkGettext" ID="MiscellaneousChecker.__checkGettext"></a> 893 </p>
894 <a NAME="MiscellaneousChecker.__checkGettext" ID="MiscellaneousChecker.__checkGettext"></a>
677 <h4>MiscellaneousChecker.__checkGettext</h4> 895 <h4>MiscellaneousChecker.__checkGettext</h4>
678 <b>__checkGettext</b>(<i></i>) 896 <b>__checkGettext</b>(<i></i>)
897
679 <p> 898 <p>
680 Private method to check the 'gettext' import statement. 899 Private method to check the 'gettext' import statement.
681 </p><a NAME="MiscellaneousChecker.__checkLineContinuation" ID="MiscellaneousChecker.__checkLineContinuation"></a> 900 </p>
901 <a NAME="MiscellaneousChecker.__checkLineContinuation" ID="MiscellaneousChecker.__checkLineContinuation"></a>
682 <h4>MiscellaneousChecker.__checkLineContinuation</h4> 902 <h4>MiscellaneousChecker.__checkLineContinuation</h4>
683 <b>__checkLineContinuation</b>(<i></i>) 903 <b>__checkLineContinuation</b>(<i></i>)
904
684 <p> 905 <p>
685 Private method to check line continuation using backslash. 906 Private method to check line continuation using backslash.
686 </p><a NAME="MiscellaneousChecker.__checkLogging" ID="MiscellaneousChecker.__checkLogging"></a> 907 </p>
908 <a NAME="MiscellaneousChecker.__checkLogging" ID="MiscellaneousChecker.__checkLogging"></a>
687 <h4>MiscellaneousChecker.__checkLogging</h4> 909 <h4>MiscellaneousChecker.__checkLogging</h4>
688 <b>__checkLogging</b>(<i></i>) 910 <b>__checkLogging</b>(<i></i>)
911
689 <p> 912 <p>
690 Private method to check logging statements. 913 Private method to check logging statements.
691 </p><a NAME="MiscellaneousChecker.__checkMutableDefault" ID="MiscellaneousChecker.__checkMutableDefault"></a> 914 </p>
915 <a NAME="MiscellaneousChecker.__checkMutableDefault" ID="MiscellaneousChecker.__checkMutableDefault"></a>
692 <h4>MiscellaneousChecker.__checkMutableDefault</h4> 916 <h4>MiscellaneousChecker.__checkMutableDefault</h4>
693 <b>__checkMutableDefault</b>(<i></i>) 917 <b>__checkMutableDefault</b>(<i></i>)
918
694 <p> 919 <p>
695 Private method to check for use of mutable types as default arguments. 920 Private method to check for use of mutable types as default arguments.
696 </p><a NAME="MiscellaneousChecker.__checkPep3101" ID="MiscellaneousChecker.__checkPep3101"></a> 921 </p>
922 <a NAME="MiscellaneousChecker.__checkPep3101" ID="MiscellaneousChecker.__checkPep3101"></a>
697 <h4>MiscellaneousChecker.__checkPep3101</h4> 923 <h4>MiscellaneousChecker.__checkPep3101</h4>
698 <b>__checkPep3101</b>(<i></i>) 924 <b>__checkPep3101</b>(<i></i>)
925
699 <p> 926 <p>
700 Private method to check for old style string formatting. 927 Private method to check for old style string formatting.
701 </p><a NAME="MiscellaneousChecker.__checkPrintStatements" ID="MiscellaneousChecker.__checkPrintStatements"></a> 928 </p>
929 <a NAME="MiscellaneousChecker.__checkPrintStatements" ID="MiscellaneousChecker.__checkPrintStatements"></a>
702 <h4>MiscellaneousChecker.__checkPrintStatements</h4> 930 <h4>MiscellaneousChecker.__checkPrintStatements</h4>
703 <b>__checkPrintStatements</b>(<i></i>) 931 <b>__checkPrintStatements</b>(<i></i>)
932
704 <p> 933 <p>
705 Private method to check for print statements. 934 Private method to check for print statements.
706 </p><a NAME="MiscellaneousChecker.__checkReturn" ID="MiscellaneousChecker.__checkReturn"></a> 935 </p>
936 <a NAME="MiscellaneousChecker.__checkReturn" ID="MiscellaneousChecker.__checkReturn"></a>
707 <h4>MiscellaneousChecker.__checkReturn</h4> 937 <h4>MiscellaneousChecker.__checkReturn</h4>
708 <b>__checkReturn</b>(<i></i>) 938 <b>__checkReturn</b>(<i></i>)
939
709 <p> 940 <p>
710 Private method to check return statements. 941 Private method to check return statements.
711 </p><a NAME="MiscellaneousChecker.__checkSysVersion" ID="MiscellaneousChecker.__checkSysVersion"></a> 942 </p>
943 <a NAME="MiscellaneousChecker.__checkSysVersion" ID="MiscellaneousChecker.__checkSysVersion"></a>
712 <h4>MiscellaneousChecker.__checkSysVersion</h4> 944 <h4>MiscellaneousChecker.__checkSysVersion</h4>
713 <b>__checkSysVersion</b>(<i></i>) 945 <b>__checkSysVersion</b>(<i></i>)
946
714 <p> 947 <p>
715 Private method to check the use of sys.version and sys.version_info. 948 Private method to check the use of sys.version and sys.version_info.
716 </p><a NAME="MiscellaneousChecker.__checkTuple" ID="MiscellaneousChecker.__checkTuple"></a> 949 </p>
950 <a NAME="MiscellaneousChecker.__checkTuple" ID="MiscellaneousChecker.__checkTuple"></a>
717 <h4>MiscellaneousChecker.__checkTuple</h4> 951 <h4>MiscellaneousChecker.__checkTuple</h4>
718 <b>__checkTuple</b>(<i></i>) 952 <b>__checkTuple</b>(<i></i>)
953
719 <p> 954 <p>
720 Private method to check for one element tuples. 955 Private method to check for one element tuples.
721 </p><a NAME="MiscellaneousChecker.__dictShouldBeChecked" ID="MiscellaneousChecker.__dictShouldBeChecked"></a> 956 </p>
957 <a NAME="MiscellaneousChecker.__dictShouldBeChecked" ID="MiscellaneousChecker.__dictShouldBeChecked"></a>
722 <h4>MiscellaneousChecker.__dictShouldBeChecked</h4> 958 <h4>MiscellaneousChecker.__dictShouldBeChecked</h4>
723 <b>__dictShouldBeChecked</b>(<i>node</i>) 959 <b>__dictShouldBeChecked</b>(<i>node</i>)
960
724 <p> 961 <p>
725 Private function to test, if the node should be checked. 962 Private function to test, if the node should be checked.
726 </p><dl> 963 </p>
964 <dl>
965
727 <dt><i>node</i></dt> 966 <dt><i>node</i></dt>
728 <dd> 967 <dd>
729 reference to the AST node 968 reference to the AST node
730 </dd> 969 </dd>
731 </dl><dl> 970 </dl>
971 <dl>
732 <dt>Returns:</dt> 972 <dt>Returns:</dt>
733 <dd> 973 <dd>
734 flag indicating to check the node 974 flag indicating to check the node
735 </dd> 975 </dd>
736 </dl><dl> 976 </dl>
977 <dl>
737 <dt>Return Type:</dt> 978 <dt>Return Type:</dt>
738 <dd> 979 <dd>
739 bool 980 bool
740 </dd> 981 </dd>
741 </dl><a NAME="MiscellaneousChecker.__error" ID="MiscellaneousChecker.__error"></a> 982 </dl>
983 <a NAME="MiscellaneousChecker.__error" ID="MiscellaneousChecker.__error"></a>
742 <h4>MiscellaneousChecker.__error</h4> 984 <h4>MiscellaneousChecker.__error</h4>
743 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) 985 <b>__error</b>(<i>lineNumber, offset, code, *args</i>)
986
744 <p> 987 <p>
745 Private method to record an issue. 988 Private method to record an issue.
746 </p><dl> 989 </p>
990 <dl>
991
747 <dt><i>lineNumber</i> (int)</dt> 992 <dt><i>lineNumber</i> (int)</dt>
748 <dd> 993 <dd>
749 line number of the issue 994 line number of the issue
750 </dd><dt><i>offset</i> (int)</dt> 995 </dd>
996 <dt><i>offset</i> (int)</dt>
751 <dd> 997 <dd>
752 position within line of the issue 998 position within line of the issue
753 </dd><dt><i>code</i> (str)</dt> 999 </dd>
1000 <dt><i>code</i> (str)</dt>
754 <dd> 1001 <dd>
755 message code 1002 message code
756 </dd><dt><i>args</i> (list)</dt> 1003 </dd>
1004 <dt><i>args</i> (list)</dt>
757 <dd> 1005 <dd>
758 arguments for the message 1006 arguments for the message
759 </dd> 1007 </dd>
760 </dl><a NAME="MiscellaneousChecker.__generateTree" ID="MiscellaneousChecker.__generateTree"></a> 1008 </dl>
1009 <a NAME="MiscellaneousChecker.__generateTree" ID="MiscellaneousChecker.__generateTree"></a>
761 <h4>MiscellaneousChecker.__generateTree</h4> 1010 <h4>MiscellaneousChecker.__generateTree</h4>
762 <b>__generateTree</b>(<i></i>) 1011 <b>__generateTree</b>(<i></i>)
1012
763 <p> 1013 <p>
764 Private method to generate an AST for our source. 1014 Private method to generate an AST for our source.
765 </p><dl> 1015 </p>
1016 <dl>
766 <dt>Returns:</dt> 1017 <dt>Returns:</dt>
767 <dd> 1018 <dd>
768 generated AST 1019 generated AST
769 </dd> 1020 </dd>
770 </dl><dl> 1021 </dl>
1022 <dl>
771 <dt>Return Type:</dt> 1023 <dt>Return Type:</dt>
772 <dd> 1024 <dd>
773 ast.AST 1025 ast.AST
774 </dd> 1026 </dd>
775 </dl><a NAME="MiscellaneousChecker.__getCoding" ID="MiscellaneousChecker.__getCoding"></a> 1027 </dl>
1028 <a NAME="MiscellaneousChecker.__getCoding" ID="MiscellaneousChecker.__getCoding"></a>
776 <h4>MiscellaneousChecker.__getCoding</h4> 1029 <h4>MiscellaneousChecker.__getCoding</h4>
777 <b>__getCoding</b>(<i></i>) 1030 <b>__getCoding</b>(<i></i>)
1031
778 <p> 1032 <p>
779 Private method to get the defined coding of the source. 1033 Private method to get the defined coding of the source.
780 </p><dl> 1034 </p>
1035 <dl>
781 <dt>Returns:</dt> 1036 <dt>Returns:</dt>
782 <dd> 1037 <dd>
783 tuple containing the line number and the coding 1038 tuple containing the line number and the coding
784 </dd> 1039 </dd>
785 </dl><dl> 1040 </dl>
1041 <dl>
786 <dt>Return Type:</dt> 1042 <dt>Return Type:</dt>
787 <dd> 1043 <dd>
788 tuple of int and str 1044 tuple of int and str
789 </dd> 1045 </dd>
790 </dl><a NAME="MiscellaneousChecker.__getFields" ID="MiscellaneousChecker.__getFields"></a> 1046 </dl>
1047 <a NAME="MiscellaneousChecker.__getFields" ID="MiscellaneousChecker.__getFields"></a>
791 <h4>MiscellaneousChecker.__getFields</h4> 1048 <h4>MiscellaneousChecker.__getFields</h4>
792 <b>__getFields</b>(<i>string</i>) 1049 <b>__getFields</b>(<i>string</i>)
1050
793 <p> 1051 <p>
794 Private method to extract the format field information. 1052 Private method to extract the format field information.
795 </p><dl> 1053 </p>
1054 <dl>
1055
796 <dt><i>string</i> (str)</dt> 1056 <dt><i>string</i> (str)</dt>
797 <dd> 1057 <dd>
798 format string to be parsed 1058 format string to be parsed
799 </dd> 1059 </dd>
800 </dl><dl> 1060 </dl>
1061 <dl>
801 <dt>Returns:</dt> 1062 <dt>Returns:</dt>
802 <dd> 1063 <dd>
803 format field information as a tuple with fields, implicit 1064 format field information as a tuple with fields, implicit
804 field definitions present and explicit field definitions present 1065 field definitions present and explicit field definitions present
805 </dd> 1066 </dd>
806 </dl><dl> 1067 </dl>
1068 <dl>
807 <dt>Return Type:</dt> 1069 <dt>Return Type:</dt>
808 <dd> 1070 <dd>
809 tuple of set of str, bool, bool 1071 tuple of set of str, bool, bool
810 </dd> 1072 </dd>
811 </dl><a NAME="MiscellaneousChecker.__ignoreCode" ID="MiscellaneousChecker.__ignoreCode"></a> 1073 </dl>
1074 <a NAME="MiscellaneousChecker.__ignoreCode" ID="MiscellaneousChecker.__ignoreCode"></a>
812 <h4>MiscellaneousChecker.__ignoreCode</h4> 1075 <h4>MiscellaneousChecker.__ignoreCode</h4>
813 <b>__ignoreCode</b>(<i>code</i>) 1076 <b>__ignoreCode</b>(<i>code</i>)
1077
814 <p> 1078 <p>
815 Private method to check if the message code should be ignored. 1079 Private method to check if the message code should be ignored.
816 </p><dl> 1080 </p>
1081 <dl>
1082
817 <dt><i>code</i> (str)</dt> 1083 <dt><i>code</i> (str)</dt>
818 <dd> 1084 <dd>
819 message code to check for 1085 message code to check for
820 </dd> 1086 </dd>
821 </dl><dl> 1087 </dl>
1088 <dl>
822 <dt>Returns:</dt> 1089 <dt>Returns:</dt>
823 <dd> 1090 <dd>
824 flag indicating to ignore the given code 1091 flag indicating to ignore the given code
825 </dd> 1092 </dd>
826 </dl><dl> 1093 </dl>
1094 <dl>
827 <dt>Return Type:</dt> 1095 <dt>Return Type:</dt>
828 <dd> 1096 <dd>
829 bool 1097 bool
830 </dd> 1098 </dd>
831 </dl><a NAME="MiscellaneousChecker.__reportInvalidSyntax" ID="MiscellaneousChecker.__reportInvalidSyntax"></a> 1099 </dl>
1100 <a NAME="MiscellaneousChecker.__reportInvalidSyntax" ID="MiscellaneousChecker.__reportInvalidSyntax"></a>
832 <h4>MiscellaneousChecker.__reportInvalidSyntax</h4> 1101 <h4>MiscellaneousChecker.__reportInvalidSyntax</h4>
833 <b>__reportInvalidSyntax</b>(<i></i>) 1102 <b>__reportInvalidSyntax</b>(<i></i>)
1103
834 <p> 1104 <p>
835 Private method to report a syntax error. 1105 Private method to report a syntax error.
836 </p><a NAME="MiscellaneousChecker.run" ID="MiscellaneousChecker.run"></a> 1106 </p>
1107 <a NAME="MiscellaneousChecker.run" ID="MiscellaneousChecker.run"></a>
837 <h4>MiscellaneousChecker.run</h4> 1108 <h4>MiscellaneousChecker.run</h4>
838 <b>run</b>(<i></i>) 1109 <b>run</b>(<i></i>)
1110
839 <p> 1111 <p>
840 Public method to check the given source against miscellaneous 1112 Public method to check the given source against miscellaneous
841 conditions. 1113 conditions.
842 </p> 1114 </p>
843 <div align="right"><a href="#top">Up</a></div> 1115 <div align="right"><a href="#top">Up</a></div>
844 <hr /><hr /> 1116 <hr />
1117 <hr />
845 <a NAME="NameFinder" ID="NameFinder"></a> 1118 <a NAME="NameFinder" ID="NameFinder"></a>
846 <h2>NameFinder</h2> 1119 <h2>NameFinder</h2>
1120
847 <p> 1121 <p>
848 Class to extract a name out of a tree of nodes. 1122 Class to extract a name out of a tree of nodes.
849 </p> 1123 </p>
850 <h3>Derived from</h3> 1124 <h3>Derived from</h3>
851 ast.NodeVisitor 1125 ast.NodeVisitor
852 <h3>Class Attributes</h3> 1126 <h3>Class Attributes</h3>
1127
853 <table> 1128 <table>
854 <tr><td>None</td></tr> 1129 <tr><td>None</td></tr>
855 </table> 1130 </table>
856 <h3>Class Methods</h3> 1131 <h3>Class Methods</h3>
1132
857 <table> 1133 <table>
858 <tr><td>None</td></tr> 1134 <tr><td>None</td></tr>
859 </table> 1135 </table>
860 <h3>Methods</h3> 1136 <h3>Methods</h3>
861 <table> 1137
1138 <table>
1139
862 <tr> 1140 <tr>
863 <td><a href="#NameFinder.__init__">NameFinder</a></td> 1141 <td><a href="#NameFinder.__init__">NameFinder</a></td>
864 <td>Constructor</td> 1142 <td>Constructor</td>
865 </tr><tr> 1143 </tr>
1144 <tr>
866 <td><a href="#NameFinder.getNames">getNames</a></td> 1145 <td><a href="#NameFinder.getNames">getNames</a></td>
867 <td>Public method to return the extracted names and Name nodes.</td> 1146 <td>Public method to return the extracted names and Name nodes.</td>
868 </tr><tr> 1147 </tr>
1148 <tr>
869 <td><a href="#NameFinder.visit">visit</a></td> 1149 <td><a href="#NameFinder.visit">visit</a></td>
870 <td>Public method to traverse a given AST node.</td> 1150 <td>Public method to traverse a given AST node.</td>
871 </tr><tr> 1151 </tr>
1152 <tr>
872 <td><a href="#NameFinder.visit_Name">visit_Name</a></td> 1153 <td><a href="#NameFinder.visit_Name">visit_Name</a></td>
873 <td>Public method to handle 'Name' nodes.</td> 1154 <td>Public method to handle 'Name' nodes.</td>
874 </tr> 1155 </tr>
875 </table> 1156 </table>
876 <h3>Static Methods</h3> 1157 <h3>Static Methods</h3>
1158
877 <table> 1159 <table>
878 <tr><td>None</td></tr> 1160 <tr><td>None</td></tr>
879 </table> 1161 </table>
1162
880 <a NAME="NameFinder.__init__" ID="NameFinder.__init__"></a> 1163 <a NAME="NameFinder.__init__" ID="NameFinder.__init__"></a>
881 <h4>NameFinder (Constructor)</h4> 1164 <h4>NameFinder (Constructor)</h4>
882 <b>NameFinder</b>(<i></i>) 1165 <b>NameFinder</b>(<i></i>)
1166
883 <p> 1167 <p>
884 Constructor 1168 Constructor
885 </p><a NAME="NameFinder.getNames" ID="NameFinder.getNames"></a> 1169 </p>
1170 <a NAME="NameFinder.getNames" ID="NameFinder.getNames"></a>
886 <h4>NameFinder.getNames</h4> 1171 <h4>NameFinder.getNames</h4>
887 <b>getNames</b>(<i></i>) 1172 <b>getNames</b>(<i></i>)
1173
888 <p> 1174 <p>
889 Public method to return the extracted names and Name nodes. 1175 Public method to return the extracted names and Name nodes.
890 </p><dl> 1176 </p>
1177 <dl>
891 <dt>Returns:</dt> 1178 <dt>Returns:</dt>
892 <dd> 1179 <dd>
893 dictionary containing the names as keys and the list of nodes 1180 dictionary containing the names as keys and the list of nodes
894 </dd> 1181 </dd>
895 </dl><dl> 1182 </dl>
1183 <dl>
896 <dt>Return Type:</dt> 1184 <dt>Return Type:</dt>
897 <dd> 1185 <dd>
898 dict 1186 dict
899 </dd> 1187 </dd>
900 </dl><a NAME="NameFinder.visit" ID="NameFinder.visit"></a> 1188 </dl>
1189 <a NAME="NameFinder.visit" ID="NameFinder.visit"></a>
901 <h4>NameFinder.visit</h4> 1190 <h4>NameFinder.visit</h4>
902 <b>visit</b>(<i>node</i>) 1191 <b>visit</b>(<i>node</i>)
1192
903 <p> 1193 <p>
904 Public method to traverse a given AST node. 1194 Public method to traverse a given AST node.
905 </p><dl> 1195 </p>
1196 <dl>
1197
906 <dt><i>node</i> (ast.Node)</dt> 1198 <dt><i>node</i> (ast.Node)</dt>
907 <dd> 1199 <dd>
908 AST node to be traversed 1200 AST node to be traversed
909 </dd> 1201 </dd>
910 </dl><a NAME="NameFinder.visit_Name" ID="NameFinder.visit_Name"></a> 1202 </dl>
1203 <a NAME="NameFinder.visit_Name" ID="NameFinder.visit_Name"></a>
911 <h4>NameFinder.visit_Name</h4> 1204 <h4>NameFinder.visit_Name</h4>
912 <b>visit_Name</b>(<i>node</i>) 1205 <b>visit_Name</b>(<i>node</i>)
1206
913 <p> 1207 <p>
914 Public method to handle 'Name' nodes. 1208 Public method to handle 'Name' nodes.
915 </p><dl> 1209 </p>
1210 <dl>
1211
916 <dt><i>node</i> (ast.Name)</dt> 1212 <dt><i>node</i> (ast.Name)</dt>
917 <dd> 1213 <dd>
918 reference to the node to be processed 1214 reference to the node to be processed
919 </dd> 1215 </dd>
920 </dl> 1216 </dl>
921 <div align="right"><a href="#top">Up</a></div> 1217 <div align="right"><a href="#top">Up</a></div>
922 <hr /><hr /> 1218 <hr />
1219 <hr />
923 <a NAME="ReturnVisitor" ID="ReturnVisitor"></a> 1220 <a NAME="ReturnVisitor" ID="ReturnVisitor"></a>
924 <h2>ReturnVisitor</h2> 1221 <h2>ReturnVisitor</h2>
1222
925 <p> 1223 <p>
926 Class implementing a node visitor to check return statements. 1224 Class implementing a node visitor to check return statements.
927 </p> 1225 </p>
928 <h3>Derived from</h3> 1226 <h3>Derived from</h3>
929 ast.NodeVisitor 1227 ast.NodeVisitor
930 <h3>Class Attributes</h3> 1228 <h3>Class Attributes</h3>
1229
931 <table> 1230 <table>
932 <tr><td>Assigns</td></tr><tr><td>Refs</td></tr><tr><td>Returns</td></tr> 1231 <tr><td>Assigns</td></tr><tr><td>Refs</td></tr><tr><td>Returns</td></tr>
933 </table> 1232 </table>
934 <h3>Class Methods</h3> 1233 <h3>Class Methods</h3>
1234
935 <table> 1235 <table>
936 <tr><td>None</td></tr> 1236 <tr><td>None</td></tr>
937 </table> 1237 </table>
938 <h3>Methods</h3> 1238 <h3>Methods</h3>
939 <table> 1239
1240 <table>
1241
940 <tr> 1242 <tr>
941 <td><a href="#ReturnVisitor.__init__">ReturnVisitor</a></td> 1243 <td><a href="#ReturnVisitor.__init__">ReturnVisitor</a></td>
942 <td>Constructor</td> 1244 <td>Constructor</td>
943 </tr><tr> 1245 </tr>
1246 <tr>
944 <td><a href="#ReturnVisitor.__checkFunction">__checkFunction</a></td> 1247 <td><a href="#ReturnVisitor.__checkFunction">__checkFunction</a></td>
945 <td>Private method to check a function definition node.</td> 1248 <td>Private method to check a function definition node.</td>
946 </tr><tr> 1249 </tr>
1250 <tr>
947 <td><a href="#ReturnVisitor.__checkImplicitReturn">__checkImplicitReturn</a></td> 1251 <td><a href="#ReturnVisitor.__checkImplicitReturn">__checkImplicitReturn</a></td>
948 <td>Private method to check for an implicit return statement.</td> 1252 <td>Private method to check for an implicit return statement.</td>
949 </tr><tr> 1253 </tr>
1254 <tr>
950 <td><a href="#ReturnVisitor.__checkImplicitReturnValue">__checkImplicitReturnValue</a></td> 1255 <td><a href="#ReturnVisitor.__checkImplicitReturnValue">__checkImplicitReturnValue</a></td>
951 <td>Private method to check for implicit return values.</td> 1256 <td>Private method to check for implicit return values.</td>
952 </tr><tr> 1257 </tr>
1258 <tr>
953 <td><a href="#ReturnVisitor.__checkUnnecessaryAssign">__checkUnnecessaryAssign</a></td> 1259 <td><a href="#ReturnVisitor.__checkUnnecessaryAssign">__checkUnnecessaryAssign</a></td>
954 <td>Private method to check for an unnecessary assign statement.</td> 1260 <td>Private method to check for an unnecessary assign statement.</td>
955 </tr><tr> 1261 </tr>
1262 <tr>
956 <td><a href="#ReturnVisitor.__checkUnnecessaryReturnNone">__checkUnnecessaryReturnNone</a></td> 1263 <td><a href="#ReturnVisitor.__checkUnnecessaryReturnNone">__checkUnnecessaryReturnNone</a></td>
957 <td>Private method to check for an unnecessary 'return None' statement.</td> 1264 <td>Private method to check for an unnecessary 'return None' statement.</td>
958 </tr><tr> 1265 </tr>
1266 <tr>
959 <td><a href="#ReturnVisitor.__hasRefsBeforeNextAssign">__hasRefsBeforeNextAssign</a></td> 1267 <td><a href="#ReturnVisitor.__hasRefsBeforeNextAssign">__hasRefsBeforeNextAssign</a></td>
960 <td>Private method to check for references before a following assign statement.</td> 1268 <td>Private method to check for references before a following assign statement.</td>
961 </tr><tr> 1269 </tr>
1270 <tr>
962 <td><a href="#ReturnVisitor.__isNone">__isNone</a></td> 1271 <td><a href="#ReturnVisitor.__isNone">__isNone</a></td>
963 <td>Private method to check, if a node value is None.</td> 1272 <td>Private method to check, if a node value is None.</td>
964 </tr><tr> 1273 </tr>
1274 <tr>
965 <td><a href="#ReturnVisitor.__resultExists">__resultExists</a></td> 1275 <td><a href="#ReturnVisitor.__resultExists">__resultExists</a></td>
966 <td>Private method to check the existance of a return result.</td> 1276 <td>Private method to check the existance of a return result.</td>
967 </tr><tr> 1277 </tr>
1278 <tr>
968 <td><a href="#ReturnVisitor.__visitAssignTarget">__visitAssignTarget</a></td> 1279 <td><a href="#ReturnVisitor.__visitAssignTarget">__visitAssignTarget</a></td>
969 <td>Private method to handle an assign target node.</td> 1280 <td>Private method to handle an assign target node.</td>
970 </tr><tr> 1281 </tr>
1282 <tr>
971 <td><a href="#ReturnVisitor.__visitWithStack">__visitWithStack</a></td> 1283 <td><a href="#ReturnVisitor.__visitWithStack">__visitWithStack</a></td>
972 <td>Private method to traverse a given function node using a stack.</td> 1284 <td>Private method to traverse a given function node using a stack.</td>
973 </tr><tr> 1285 </tr>
1286 <tr>
974 <td><a href="#ReturnVisitor.assigns">assigns</a></td> 1287 <td><a href="#ReturnVisitor.assigns">assigns</a></td>
975 <td>Public method to get the Assign nodes.</td> 1288 <td>Public method to get the Assign nodes.</td>
976 </tr><tr> 1289 </tr>
1290 <tr>
977 <td><a href="#ReturnVisitor.refs">refs</a></td> 1291 <td><a href="#ReturnVisitor.refs">refs</a></td>
978 <td>Public method to get the References nodes.</td> 1292 <td>Public method to get the References nodes.</td>
979 </tr><tr> 1293 </tr>
1294 <tr>
980 <td><a href="#ReturnVisitor.returns">returns</a></td> 1295 <td><a href="#ReturnVisitor.returns">returns</a></td>
981 <td>Public method to get the Return nodes.</td> 1296 <td>Public method to get the Return nodes.</td>
982 </tr><tr> 1297 </tr>
1298 <tr>
983 <td><a href="#ReturnVisitor.visit_Assign">visit_Assign</a></td> 1299 <td><a href="#ReturnVisitor.visit_Assign">visit_Assign</a></td>
984 <td>Public method to handle an assign node.</td> 1300 <td>Public method to handle an assign node.</td>
985 </tr><tr> 1301 </tr>
1302 <tr>
986 <td><a href="#ReturnVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> 1303 <td><a href="#ReturnVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td>
987 <td>Public method to handle a function definition.</td> 1304 <td>Public method to handle a function definition.</td>
988 </tr><tr> 1305 </tr>
1306 <tr>
989 <td><a href="#ReturnVisitor.visit_FunctionDef">visit_FunctionDef</a></td> 1307 <td><a href="#ReturnVisitor.visit_FunctionDef">visit_FunctionDef</a></td>
990 <td>Public method to handle a function definition.</td> 1308 <td>Public method to handle a function definition.</td>
991 </tr><tr> 1309 </tr>
1310 <tr>
992 <td><a href="#ReturnVisitor.visit_Name">visit_Name</a></td> 1311 <td><a href="#ReturnVisitor.visit_Name">visit_Name</a></td>
993 <td>Public method to handle a name node.</td> 1312 <td>Public method to handle a name node.</td>
994 </tr><tr> 1313 </tr>
1314 <tr>
995 <td><a href="#ReturnVisitor.visit_Return">visit_Return</a></td> 1315 <td><a href="#ReturnVisitor.visit_Return">visit_Return</a></td>
996 <td>Public method to handle a return node.</td> 1316 <td>Public method to handle a return node.</td>
997 </tr> 1317 </tr>
998 </table> 1318 </table>
999 <h3>Static Methods</h3> 1319 <h3>Static Methods</h3>
1320
1000 <table> 1321 <table>
1001 <tr><td>None</td></tr> 1322 <tr><td>None</td></tr>
1002 </table> 1323 </table>
1324
1003 <a NAME="ReturnVisitor.__init__" ID="ReturnVisitor.__init__"></a> 1325 <a NAME="ReturnVisitor.__init__" ID="ReturnVisitor.__init__"></a>
1004 <h4>ReturnVisitor (Constructor)</h4> 1326 <h4>ReturnVisitor (Constructor)</h4>
1005 <b>ReturnVisitor</b>(<i></i>) 1327 <b>ReturnVisitor</b>(<i></i>)
1328
1006 <p> 1329 <p>
1007 Constructor 1330 Constructor
1008 </p><a NAME="ReturnVisitor.__checkFunction" ID="ReturnVisitor.__checkFunction"></a> 1331 </p>
1332 <a NAME="ReturnVisitor.__checkFunction" ID="ReturnVisitor.__checkFunction"></a>
1009 <h4>ReturnVisitor.__checkFunction</h4> 1333 <h4>ReturnVisitor.__checkFunction</h4>
1010 <b>__checkFunction</b>(<i>node</i>) 1334 <b>__checkFunction</b>(<i>node</i>)
1335
1011 <p> 1336 <p>
1012 Private method to check a function definition node. 1337 Private method to check a function definition node.
1013 </p><dl> 1338 </p>
1339 <dl>
1340
1014 <dt><i>node</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt> 1341 <dt><i>node</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt>
1015 <dd> 1342 <dd>
1016 reference to the node to check 1343 reference to the node to check
1017 </dd> 1344 </dd>
1018 </dl><a NAME="ReturnVisitor.__checkImplicitReturn" ID="ReturnVisitor.__checkImplicitReturn"></a> 1345 </dl>
1346 <a NAME="ReturnVisitor.__checkImplicitReturn" ID="ReturnVisitor.__checkImplicitReturn"></a>
1019 <h4>ReturnVisitor.__checkImplicitReturn</h4> 1347 <h4>ReturnVisitor.__checkImplicitReturn</h4>
1020 <b>__checkImplicitReturn</b>(<i>node</i>) 1348 <b>__checkImplicitReturn</b>(<i>node</i>)
1349
1021 <p> 1350 <p>
1022 Private method to check for an implicit return statement. 1351 Private method to check for an implicit return statement.
1023 </p><dl> 1352 </p>
1353 <dl>
1354
1024 <dt><i>node</i> (ast.AST)</dt> 1355 <dt><i>node</i> (ast.AST)</dt>
1025 <dd> 1356 <dd>
1026 reference to the node to check 1357 reference to the node to check
1027 </dd> 1358 </dd>
1028 </dl><a NAME="ReturnVisitor.__checkImplicitReturnValue" ID="ReturnVisitor.__checkImplicitReturnValue"></a> 1359 </dl>
1360 <a NAME="ReturnVisitor.__checkImplicitReturnValue" ID="ReturnVisitor.__checkImplicitReturnValue"></a>
1029 <h4>ReturnVisitor.__checkImplicitReturnValue</h4> 1361 <h4>ReturnVisitor.__checkImplicitReturnValue</h4>
1030 <b>__checkImplicitReturnValue</b>(<i></i>) 1362 <b>__checkImplicitReturnValue</b>(<i></i>)
1363
1031 <p> 1364 <p>
1032 Private method to check for implicit return values. 1365 Private method to check for implicit return values.
1033 </p><a NAME="ReturnVisitor.__checkUnnecessaryAssign" ID="ReturnVisitor.__checkUnnecessaryAssign"></a> 1366 </p>
1367 <a NAME="ReturnVisitor.__checkUnnecessaryAssign" ID="ReturnVisitor.__checkUnnecessaryAssign"></a>
1034 <h4>ReturnVisitor.__checkUnnecessaryAssign</h4> 1368 <h4>ReturnVisitor.__checkUnnecessaryAssign</h4>
1035 <b>__checkUnnecessaryAssign</b>(<i>node</i>) 1369 <b>__checkUnnecessaryAssign</b>(<i>node</i>)
1370
1036 <p> 1371 <p>
1037 Private method to check for an unnecessary assign statement. 1372 Private method to check for an unnecessary assign statement.
1038 </p><dl> 1373 </p>
1374 <dl>
1375
1039 <dt><i>node</i> (ast.AST)</dt> 1376 <dt><i>node</i> (ast.AST)</dt>
1040 <dd> 1377 <dd>
1041 reference to the node to check 1378 reference to the node to check
1042 </dd> 1379 </dd>
1043 </dl><a NAME="ReturnVisitor.__checkUnnecessaryReturnNone" ID="ReturnVisitor.__checkUnnecessaryReturnNone"></a> 1380 </dl>
1381 <a NAME="ReturnVisitor.__checkUnnecessaryReturnNone" ID="ReturnVisitor.__checkUnnecessaryReturnNone"></a>
1044 <h4>ReturnVisitor.__checkUnnecessaryReturnNone</h4> 1382 <h4>ReturnVisitor.__checkUnnecessaryReturnNone</h4>
1045 <b>__checkUnnecessaryReturnNone</b>(<i></i>) 1383 <b>__checkUnnecessaryReturnNone</b>(<i></i>)
1384
1046 <p> 1385 <p>
1047 Private method to check for an unnecessary 'return None' statement. 1386 Private method to check for an unnecessary 'return None' statement.
1048 </p><a NAME="ReturnVisitor.__hasRefsBeforeNextAssign" ID="ReturnVisitor.__hasRefsBeforeNextAssign"></a> 1387 </p>
1388 <a NAME="ReturnVisitor.__hasRefsBeforeNextAssign" ID="ReturnVisitor.__hasRefsBeforeNextAssign"></a>
1049 <h4>ReturnVisitor.__hasRefsBeforeNextAssign</h4> 1389 <h4>ReturnVisitor.__hasRefsBeforeNextAssign</h4>
1050 <b>__hasRefsBeforeNextAssign</b>(<i>varname, returnLineno</i>) 1390 <b>__hasRefsBeforeNextAssign</b>(<i>varname, returnLineno</i>)
1391
1051 <p> 1392 <p>
1052 Private method to check for references before a following assign 1393 Private method to check for references before a following assign
1053 statement. 1394 statement.
1054 </p><dl> 1395 </p>
1396 <dl>
1397
1055 <dt><i>varname</i> (str)</dt> 1398 <dt><i>varname</i> (str)</dt>
1056 <dd> 1399 <dd>
1057 variable name to check for 1400 variable name to check for
1058 </dd><dt><i>returnLineno</i> (int)</dt> 1401 </dd>
1402 <dt><i>returnLineno</i> (int)</dt>
1059 <dd> 1403 <dd>
1060 line number of the return statement 1404 line number of the return statement
1061 </dd> 1405 </dd>
1062 </dl><dl> 1406 </dl>
1407 <dl>
1063 <dt>Returns:</dt> 1408 <dt>Returns:</dt>
1064 <dd> 1409 <dd>
1065 flag indicating the existence of references 1410 flag indicating the existence of references
1066 </dd> 1411 </dd>
1067 </dl><dl> 1412 </dl>
1413 <dl>
1068 <dt>Return Type:</dt> 1414 <dt>Return Type:</dt>
1069 <dd> 1415 <dd>
1070 bool 1416 bool
1071 </dd> 1417 </dd>
1072 </dl><a NAME="ReturnVisitor.__isNone" ID="ReturnVisitor.__isNone"></a> 1418 </dl>
1419 <a NAME="ReturnVisitor.__isNone" ID="ReturnVisitor.__isNone"></a>
1073 <h4>ReturnVisitor.__isNone</h4> 1420 <h4>ReturnVisitor.__isNone</h4>
1074 <b>__isNone</b>(<i>node</i>) 1421 <b>__isNone</b>(<i>node</i>)
1422
1075 <p> 1423 <p>
1076 Private method to check, if a node value is None. 1424 Private method to check, if a node value is None.
1077 </p><dl> 1425 </p>
1426 <dl>
1427
1078 <dt><i>node</i> (ast.AST)</dt> 1428 <dt><i>node</i> (ast.AST)</dt>
1079 <dd> 1429 <dd>
1080 reference to the node to check 1430 reference to the node to check
1081 </dd> 1431 </dd>
1082 </dl><dl> 1432 </dl>
1433 <dl>
1083 <dt>Returns:</dt> 1434 <dt>Returns:</dt>
1084 <dd> 1435 <dd>
1085 flag indicating the node contains a None value 1436 flag indicating the node contains a None value
1086 </dd> 1437 </dd>
1087 </dl><a NAME="ReturnVisitor.__resultExists" ID="ReturnVisitor.__resultExists"></a> 1438 </dl>
1439 <a NAME="ReturnVisitor.__resultExists" ID="ReturnVisitor.__resultExists"></a>
1088 <h4>ReturnVisitor.__resultExists</h4> 1440 <h4>ReturnVisitor.__resultExists</h4>
1089 <b>__resultExists</b>(<i></i>) 1441 <b>__resultExists</b>(<i></i>)
1442
1090 <p> 1443 <p>
1091 Private method to check the existance of a return result. 1444 Private method to check the existance of a return result.
1092 </p><dl> 1445 </p>
1446 <dl>
1093 <dt>Returns:</dt> 1447 <dt>Returns:</dt>
1094 <dd> 1448 <dd>
1095 flag indicating the existence of a return result 1449 flag indicating the existence of a return result
1096 </dd> 1450 </dd>
1097 </dl><dl> 1451 </dl>
1452 <dl>
1098 <dt>Return Type:</dt> 1453 <dt>Return Type:</dt>
1099 <dd> 1454 <dd>
1100 bool 1455 bool
1101 </dd> 1456 </dd>
1102 </dl><a NAME="ReturnVisitor.__visitAssignTarget" ID="ReturnVisitor.__visitAssignTarget"></a> 1457 </dl>
1458 <a NAME="ReturnVisitor.__visitAssignTarget" ID="ReturnVisitor.__visitAssignTarget"></a>
1103 <h4>ReturnVisitor.__visitAssignTarget</h4> 1459 <h4>ReturnVisitor.__visitAssignTarget</h4>
1104 <b>__visitAssignTarget</b>(<i>node</i>) 1460 <b>__visitAssignTarget</b>(<i>node</i>)
1461
1105 <p> 1462 <p>
1106 Private method to handle an assign target node. 1463 Private method to handle an assign target node.
1107 </p><dl> 1464 </p>
1465 <dl>
1466
1108 <dt><i>node</i> (ast.AST)</dt> 1467 <dt><i>node</i> (ast.AST)</dt>
1109 <dd> 1468 <dd>
1110 reference to the node to handle 1469 reference to the node to handle
1111 </dd> 1470 </dd>
1112 </dl><a NAME="ReturnVisitor.__visitWithStack" ID="ReturnVisitor.__visitWithStack"></a> 1471 </dl>
1472 <a NAME="ReturnVisitor.__visitWithStack" ID="ReturnVisitor.__visitWithStack"></a>
1113 <h4>ReturnVisitor.__visitWithStack</h4> 1473 <h4>ReturnVisitor.__visitWithStack</h4>
1114 <b>__visitWithStack</b>(<i>node</i>) 1474 <b>__visitWithStack</b>(<i>node</i>)
1475
1115 <p> 1476 <p>
1116 Private method to traverse a given function node using a stack. 1477 Private method to traverse a given function node using a stack.
1117 </p><dl> 1478 </p>
1479 <dl>
1480
1118 <dt><i>node</i> (ast.FunctionDef or ast.AsyncFunctionDef)</dt> 1481 <dt><i>node</i> (ast.FunctionDef or ast.AsyncFunctionDef)</dt>
1119 <dd> 1482 <dd>
1120 AST node to be traversed 1483 AST node to be traversed
1121 </dd> 1484 </dd>
1122 </dl><a NAME="ReturnVisitor.assigns" ID="ReturnVisitor.assigns"></a> 1485 </dl>
1486 <a NAME="ReturnVisitor.assigns" ID="ReturnVisitor.assigns"></a>
1123 <h4>ReturnVisitor.assigns</h4> 1487 <h4>ReturnVisitor.assigns</h4>
1124 <b>assigns</b>(<i></i>) 1488 <b>assigns</b>(<i></i>)
1489
1125 <p> 1490 <p>
1126 Public method to get the Assign nodes. 1491 Public method to get the Assign nodes.
1127 </p><dl> 1492 </p>
1493 <dl>
1128 <dt>Returns:</dt> 1494 <dt>Returns:</dt>
1129 <dd> 1495 <dd>
1130 dictionary containing the node name as key and line number 1496 dictionary containing the node name as key and line number
1131 as value 1497 as value
1132 </dd> 1498 </dd>
1133 </dl><dl> 1499 </dl>
1500 <dl>
1134 <dt>Return Type:</dt> 1501 <dt>Return Type:</dt>
1135 <dd> 1502 <dd>
1136 dict 1503 dict
1137 </dd> 1504 </dd>
1138 </dl><a NAME="ReturnVisitor.refs" ID="ReturnVisitor.refs"></a> 1505 </dl>
1506 <a NAME="ReturnVisitor.refs" ID="ReturnVisitor.refs"></a>
1139 <h4>ReturnVisitor.refs</h4> 1507 <h4>ReturnVisitor.refs</h4>
1140 <b>refs</b>(<i></i>) 1508 <b>refs</b>(<i></i>)
1509
1141 <p> 1510 <p>
1142 Public method to get the References nodes. 1511 Public method to get the References nodes.
1143 </p><dl> 1512 </p>
1513 <dl>
1144 <dt>Returns:</dt> 1514 <dt>Returns:</dt>
1145 <dd> 1515 <dd>
1146 dictionary containing the node name as key and line number 1516 dictionary containing the node name as key and line number
1147 as value 1517 as value
1148 </dd> 1518 </dd>
1149 </dl><dl> 1519 </dl>
1520 <dl>
1150 <dt>Return Type:</dt> 1521 <dt>Return Type:</dt>
1151 <dd> 1522 <dd>
1152 dict 1523 dict
1153 </dd> 1524 </dd>
1154 </dl><a NAME="ReturnVisitor.returns" ID="ReturnVisitor.returns"></a> 1525 </dl>
1526 <a NAME="ReturnVisitor.returns" ID="ReturnVisitor.returns"></a>
1155 <h4>ReturnVisitor.returns</h4> 1527 <h4>ReturnVisitor.returns</h4>
1156 <b>returns</b>(<i></i>) 1528 <b>returns</b>(<i></i>)
1529
1157 <p> 1530 <p>
1158 Public method to get the Return nodes. 1531 Public method to get the Return nodes.
1159 </p><dl> 1532 </p>
1533 <dl>
1160 <dt>Returns:</dt> 1534 <dt>Returns:</dt>
1161 <dd> 1535 <dd>
1162 dictionary containing the node name as key and line number 1536 dictionary containing the node name as key and line number
1163 as value 1537 as value
1164 </dd> 1538 </dd>
1165 </dl><dl> 1539 </dl>
1540 <dl>
1166 <dt>Return Type:</dt> 1541 <dt>Return Type:</dt>
1167 <dd> 1542 <dd>
1168 dict 1543 dict
1169 </dd> 1544 </dd>
1170 </dl><a NAME="ReturnVisitor.visit_Assign" ID="ReturnVisitor.visit_Assign"></a> 1545 </dl>
1546 <a NAME="ReturnVisitor.visit_Assign" ID="ReturnVisitor.visit_Assign"></a>
1171 <h4>ReturnVisitor.visit_Assign</h4> 1547 <h4>ReturnVisitor.visit_Assign</h4>
1172 <b>visit_Assign</b>(<i>node</i>) 1548 <b>visit_Assign</b>(<i>node</i>)
1549
1173 <p> 1550 <p>
1174 Public method to handle an assign node. 1551 Public method to handle an assign node.
1175 </p><dl> 1552 </p>
1553 <dl>
1554
1176 <dt><i>node</i> (ast.Assign)</dt> 1555 <dt><i>node</i> (ast.Assign)</dt>
1177 <dd> 1556 <dd>
1178 reference to the node to handle 1557 reference to the node to handle
1179 </dd> 1558 </dd>
1180 </dl><a NAME="ReturnVisitor.visit_AsyncFunctionDef" ID="ReturnVisitor.visit_AsyncFunctionDef"></a> 1559 </dl>
1560 <a NAME="ReturnVisitor.visit_AsyncFunctionDef" ID="ReturnVisitor.visit_AsyncFunctionDef"></a>
1181 <h4>ReturnVisitor.visit_AsyncFunctionDef</h4> 1561 <h4>ReturnVisitor.visit_AsyncFunctionDef</h4>
1182 <b>visit_AsyncFunctionDef</b>(<i>node</i>) 1562 <b>visit_AsyncFunctionDef</b>(<i>node</i>)
1563
1183 <p> 1564 <p>
1184 Public method to handle a function definition. 1565 Public method to handle a function definition.
1185 </p><dl> 1566 </p>
1567 <dl>
1568
1186 <dt><i>node</i> (ast.AsyncFunctionDef)</dt> 1569 <dt><i>node</i> (ast.AsyncFunctionDef)</dt>
1187 <dd> 1570 <dd>
1188 reference to the node to handle 1571 reference to the node to handle
1189 </dd> 1572 </dd>
1190 </dl><a NAME="ReturnVisitor.visit_FunctionDef" ID="ReturnVisitor.visit_FunctionDef"></a> 1573 </dl>
1574 <a NAME="ReturnVisitor.visit_FunctionDef" ID="ReturnVisitor.visit_FunctionDef"></a>
1191 <h4>ReturnVisitor.visit_FunctionDef</h4> 1575 <h4>ReturnVisitor.visit_FunctionDef</h4>
1192 <b>visit_FunctionDef</b>(<i>node</i>) 1576 <b>visit_FunctionDef</b>(<i>node</i>)
1577
1193 <p> 1578 <p>
1194 Public method to handle a function definition. 1579 Public method to handle a function definition.
1195 </p><dl> 1580 </p>
1581 <dl>
1582
1196 <dt><i>node</i> (ast.FunctionDef)</dt> 1583 <dt><i>node</i> (ast.FunctionDef)</dt>
1197 <dd> 1584 <dd>
1198 reference to the node to handle 1585 reference to the node to handle
1199 </dd> 1586 </dd>
1200 </dl><a NAME="ReturnVisitor.visit_Name" ID="ReturnVisitor.visit_Name"></a> 1587 </dl>
1588 <a NAME="ReturnVisitor.visit_Name" ID="ReturnVisitor.visit_Name"></a>
1201 <h4>ReturnVisitor.visit_Name</h4> 1589 <h4>ReturnVisitor.visit_Name</h4>
1202 <b>visit_Name</b>(<i>node</i>) 1590 <b>visit_Name</b>(<i>node</i>)
1591
1203 <p> 1592 <p>
1204 Public method to handle a name node. 1593 Public method to handle a name node.
1205 </p><dl> 1594 </p>
1595 <dl>
1596
1206 <dt><i>node</i> (ast.Name)</dt> 1597 <dt><i>node</i> (ast.Name)</dt>
1207 <dd> 1598 <dd>
1208 reference to the node to handle 1599 reference to the node to handle
1209 </dd> 1600 </dd>
1210 </dl><a NAME="ReturnVisitor.visit_Return" ID="ReturnVisitor.visit_Return"></a> 1601 </dl>
1602 <a NAME="ReturnVisitor.visit_Return" ID="ReturnVisitor.visit_Return"></a>
1211 <h4>ReturnVisitor.visit_Return</h4> 1603 <h4>ReturnVisitor.visit_Return</h4>
1212 <b>visit_Return</b>(<i>node</i>) 1604 <b>visit_Return</b>(<i>node</i>)
1605
1213 <p> 1606 <p>
1214 Public method to handle a return node. 1607 Public method to handle a return node.
1215 </p><dl> 1608 </p>
1609 <dl>
1610
1216 <dt><i>node</i> (ast.Return)</dt> 1611 <dt><i>node</i> (ast.Return)</dt>
1217 <dd> 1612 <dd>
1218 reference to the node to handle 1613 reference to the node to handle
1219 </dd> 1614 </dd>
1220 </dl> 1615 </dl>
1221 <div align="right"><a href="#top">Up</a></div> 1616 <div align="right"><a href="#top">Up</a></div>
1222 <hr /><hr /> 1617 <hr />
1618 <hr />
1223 <a NAME="SysVersionVisitor" ID="SysVersionVisitor"></a> 1619 <a NAME="SysVersionVisitor" ID="SysVersionVisitor"></a>
1224 <h2>SysVersionVisitor</h2> 1620 <h2>SysVersionVisitor</h2>
1621
1225 <p> 1622 <p>
1226 Class implementing a node visitor to check the use of sys.version and 1623 Class implementing a node visitor to check the use of sys.version and
1227 sys.version_info. 1624 sys.version_info.
1228 </p><p> 1625 </p>
1626 <p>
1229 Note: This class is modelled after flake8-2020 checker. 1627 Note: This class is modelled after flake8-2020 checker.
1230 </p> 1628 </p>
1231 <h3>Derived from</h3> 1629 <h3>Derived from</h3>
1232 ast.NodeVisitor 1630 ast.NodeVisitor
1233 <h3>Class Attributes</h3> 1631 <h3>Class Attributes</h3>
1632
1234 <table> 1633 <table>
1235 <tr><td>None</td></tr> 1634 <tr><td>None</td></tr>
1236 </table> 1635 </table>
1237 <h3>Class Methods</h3> 1636 <h3>Class Methods</h3>
1637
1238 <table> 1638 <table>
1239 <tr><td>None</td></tr> 1639 <tr><td>None</td></tr>
1240 </table> 1640 </table>
1241 <h3>Methods</h3> 1641 <h3>Methods</h3>
1242 <table> 1642
1643 <table>
1644
1243 <tr> 1645 <tr>
1244 <td><a href="#SysVersionVisitor.__init__">SysVersionVisitor</a></td> 1646 <td><a href="#SysVersionVisitor.__init__">SysVersionVisitor</a></td>
1245 <td>Constructor</td> 1647 <td>Constructor</td>
1246 </tr><tr> 1648 </tr>
1649 <tr>
1247 <td><a href="#SysVersionVisitor.__isSys">__isSys</a></td> 1650 <td><a href="#SysVersionVisitor.__isSys">__isSys</a></td>
1248 <td>Private method to check for a reference to sys attribute.</td> 1651 <td>Private method to check for a reference to sys attribute.</td>
1249 </tr><tr> 1652 </tr>
1653 <tr>
1250 <td><a href="#SysVersionVisitor.__isSysVersionUpperSlice">__isSysVersionUpperSlice</a></td> 1654 <td><a href="#SysVersionVisitor.__isSysVersionUpperSlice">__isSysVersionUpperSlice</a></td>
1251 <td>Private method to check the upper slice of sys.version.</td> 1655 <td>Private method to check the upper slice of sys.version.</td>
1252 </tr><tr> 1656 </tr>
1657 <tr>
1253 <td><a href="#SysVersionVisitor.visit_Attribute">visit_Attribute</a></td> 1658 <td><a href="#SysVersionVisitor.visit_Attribute">visit_Attribute</a></td>
1254 <td>Public method to handle an attribute.</td> 1659 <td>Public method to handle an attribute.</td>
1255 </tr><tr> 1660 </tr>
1661 <tr>
1256 <td><a href="#SysVersionVisitor.visit_Compare">visit_Compare</a></td> 1662 <td><a href="#SysVersionVisitor.visit_Compare">visit_Compare</a></td>
1257 <td>Public method to handle a comparison.</td> 1663 <td>Public method to handle a comparison.</td>
1258 </tr><tr> 1664 </tr>
1665 <tr>
1259 <td><a href="#SysVersionVisitor.visit_ImportFrom">visit_ImportFrom</a></td> 1666 <td><a href="#SysVersionVisitor.visit_ImportFrom">visit_ImportFrom</a></td>
1260 <td>Public method to handle a from ...</td> 1667 <td>Public method to handle a from ...</td>
1261 </tr><tr> 1668 </tr>
1669 <tr>
1262 <td><a href="#SysVersionVisitor.visit_Name">visit_Name</a></td> 1670 <td><a href="#SysVersionVisitor.visit_Name">visit_Name</a></td>
1263 <td>Public method to handle an name.</td> 1671 <td>Public method to handle an name.</td>
1264 </tr><tr> 1672 </tr>
1673 <tr>
1265 <td><a href="#SysVersionVisitor.visit_Subscript">visit_Subscript</a></td> 1674 <td><a href="#SysVersionVisitor.visit_Subscript">visit_Subscript</a></td>
1266 <td>Public method to handle a subscript.</td> 1675 <td>Public method to handle a subscript.</td>
1267 </tr> 1676 </tr>
1268 </table> 1677 </table>
1269 <h3>Static Methods</h3> 1678 <h3>Static Methods</h3>
1679
1270 <table> 1680 <table>
1271 <tr><td>None</td></tr> 1681 <tr><td>None</td></tr>
1272 </table> 1682 </table>
1683
1273 <a NAME="SysVersionVisitor.__init__" ID="SysVersionVisitor.__init__"></a> 1684 <a NAME="SysVersionVisitor.__init__" ID="SysVersionVisitor.__init__"></a>
1274 <h4>SysVersionVisitor (Constructor)</h4> 1685 <h4>SysVersionVisitor (Constructor)</h4>
1275 <b>SysVersionVisitor</b>(<i></i>) 1686 <b>SysVersionVisitor</b>(<i></i>)
1687
1276 <p> 1688 <p>
1277 Constructor 1689 Constructor
1278 </p><a NAME="SysVersionVisitor.__isSys" ID="SysVersionVisitor.__isSys"></a> 1690 </p>
1691 <a NAME="SysVersionVisitor.__isSys" ID="SysVersionVisitor.__isSys"></a>
1279 <h4>SysVersionVisitor.__isSys</h4> 1692 <h4>SysVersionVisitor.__isSys</h4>
1280 <b>__isSys</b>(<i>attr, node</i>) 1693 <b>__isSys</b>(<i>attr, node</i>)
1694
1281 <p> 1695 <p>
1282 Private method to check for a reference to sys attribute. 1696 Private method to check for a reference to sys attribute.
1283 </p><dl> 1697 </p>
1698 <dl>
1699
1284 <dt><i>attr</i> (str)</dt> 1700 <dt><i>attr</i> (str)</dt>
1285 <dd> 1701 <dd>
1286 attribute name 1702 attribute name
1287 </dd><dt><i>node</i> (ast.Node)</dt> 1703 </dd>
1704 <dt><i>node</i> (ast.Node)</dt>
1288 <dd> 1705 <dd>
1289 reference to the node to be checked 1706 reference to the node to be checked
1290 </dd> 1707 </dd>
1291 </dl><dl> 1708 </dl>
1709 <dl>
1292 <dt>Returns:</dt> 1710 <dt>Returns:</dt>
1293 <dd> 1711 <dd>
1294 flag indicating a match 1712 flag indicating a match
1295 </dd> 1713 </dd>
1296 </dl><dl> 1714 </dl>
1715 <dl>
1297 <dt>Return Type:</dt> 1716 <dt>Return Type:</dt>
1298 <dd> 1717 <dd>
1299 bool 1718 bool
1300 </dd> 1719 </dd>
1301 </dl><a NAME="SysVersionVisitor.__isSysVersionUpperSlice" ID="SysVersionVisitor.__isSysVersionUpperSlice"></a> 1720 </dl>
1721 <a NAME="SysVersionVisitor.__isSysVersionUpperSlice" ID="SysVersionVisitor.__isSysVersionUpperSlice"></a>
1302 <h4>SysVersionVisitor.__isSysVersionUpperSlice</h4> 1722 <h4>SysVersionVisitor.__isSysVersionUpperSlice</h4>
1303 <b>__isSysVersionUpperSlice</b>(<i>node, n</i>) 1723 <b>__isSysVersionUpperSlice</b>(<i>node, n</i>)
1724
1304 <p> 1725 <p>
1305 Private method to check the upper slice of sys.version. 1726 Private method to check the upper slice of sys.version.
1306 </p><dl> 1727 </p>
1728 <dl>
1729
1307 <dt><i>node</i> (ast.Node)</dt> 1730 <dt><i>node</i> (ast.Node)</dt>
1308 <dd> 1731 <dd>
1309 reference to the node to be checked 1732 reference to the node to be checked
1310 </dd><dt><i>n</i> (int)</dt> 1733 </dd>
1734 <dt><i>n</i> (int)</dt>
1311 <dd> 1735 <dd>
1312 slice value to check against 1736 slice value to check against
1313 </dd> 1737 </dd>
1314 </dl><dl> 1738 </dl>
1739 <dl>
1315 <dt>Returns:</dt> 1740 <dt>Returns:</dt>
1316 <dd> 1741 <dd>
1317 flag indicating a match 1742 flag indicating a match
1318 </dd> 1743 </dd>
1319 </dl><dl> 1744 </dl>
1745 <dl>
1320 <dt>Return Type:</dt> 1746 <dt>Return Type:</dt>
1321 <dd> 1747 <dd>
1322 bool 1748 bool
1323 </dd> 1749 </dd>
1324 </dl><a NAME="SysVersionVisitor.visit_Attribute" ID="SysVersionVisitor.visit_Attribute"></a> 1750 </dl>
1751 <a NAME="SysVersionVisitor.visit_Attribute" ID="SysVersionVisitor.visit_Attribute"></a>
1325 <h4>SysVersionVisitor.visit_Attribute</h4> 1752 <h4>SysVersionVisitor.visit_Attribute</h4>
1326 <b>visit_Attribute</b>(<i>node</i>) 1753 <b>visit_Attribute</b>(<i>node</i>)
1754
1327 <p> 1755 <p>
1328 Public method to handle an attribute. 1756 Public method to handle an attribute.
1329 </p><dl> 1757 </p>
1758 <dl>
1759
1330 <dt><i>node</i> (ast.Attribute)</dt> 1760 <dt><i>node</i> (ast.Attribute)</dt>
1331 <dd> 1761 <dd>
1332 reference to the node to be processed 1762 reference to the node to be processed
1333 </dd> 1763 </dd>
1334 </dl><a NAME="SysVersionVisitor.visit_Compare" ID="SysVersionVisitor.visit_Compare"></a> 1764 </dl>
1765 <a NAME="SysVersionVisitor.visit_Compare" ID="SysVersionVisitor.visit_Compare"></a>
1335 <h4>SysVersionVisitor.visit_Compare</h4> 1766 <h4>SysVersionVisitor.visit_Compare</h4>
1336 <b>visit_Compare</b>(<i>node</i>) 1767 <b>visit_Compare</b>(<i>node</i>)
1768
1337 <p> 1769 <p>
1338 Public method to handle a comparison. 1770 Public method to handle a comparison.
1339 </p><dl> 1771 </p>
1772 <dl>
1773
1340 <dt><i>node</i> (ast.Compare)</dt> 1774 <dt><i>node</i> (ast.Compare)</dt>
1341 <dd> 1775 <dd>
1342 reference to the node to be processed 1776 reference to the node to be processed
1343 </dd> 1777 </dd>
1344 </dl><a NAME="SysVersionVisitor.visit_ImportFrom" ID="SysVersionVisitor.visit_ImportFrom"></a> 1778 </dl>
1779 <a NAME="SysVersionVisitor.visit_ImportFrom" ID="SysVersionVisitor.visit_ImportFrom"></a>
1345 <h4>SysVersionVisitor.visit_ImportFrom</h4> 1780 <h4>SysVersionVisitor.visit_ImportFrom</h4>
1346 <b>visit_ImportFrom</b>(<i>node</i>) 1781 <b>visit_ImportFrom</b>(<i>node</i>)
1782
1347 <p> 1783 <p>
1348 Public method to handle a from ... import ... statement. 1784 Public method to handle a from ... import ... statement.
1349 </p><dl> 1785 </p>
1786 <dl>
1787
1350 <dt><i>node</i> (ast.ImportFrom)</dt> 1788 <dt><i>node</i> (ast.ImportFrom)</dt>
1351 <dd> 1789 <dd>
1352 reference to the node to be processed 1790 reference to the node to be processed
1353 </dd> 1791 </dd>
1354 </dl><a NAME="SysVersionVisitor.visit_Name" ID="SysVersionVisitor.visit_Name"></a> 1792 </dl>
1793 <a NAME="SysVersionVisitor.visit_Name" ID="SysVersionVisitor.visit_Name"></a>
1355 <h4>SysVersionVisitor.visit_Name</h4> 1794 <h4>SysVersionVisitor.visit_Name</h4>
1356 <b>visit_Name</b>(<i>node</i>) 1795 <b>visit_Name</b>(<i>node</i>)
1796
1357 <p> 1797 <p>
1358 Public method to handle an name. 1798 Public method to handle an name.
1359 </p><dl> 1799 </p>
1800 <dl>
1801
1360 <dt><i>node</i> (ast.Name)</dt> 1802 <dt><i>node</i> (ast.Name)</dt>
1361 <dd> 1803 <dd>
1362 reference to the node to be processed 1804 reference to the node to be processed
1363 </dd> 1805 </dd>
1364 </dl><a NAME="SysVersionVisitor.visit_Subscript" ID="SysVersionVisitor.visit_Subscript"></a> 1806 </dl>
1807 <a NAME="SysVersionVisitor.visit_Subscript" ID="SysVersionVisitor.visit_Subscript"></a>
1365 <h4>SysVersionVisitor.visit_Subscript</h4> 1808 <h4>SysVersionVisitor.visit_Subscript</h4>
1366 <b>visit_Subscript</b>(<i>node</i>) 1809 <b>visit_Subscript</b>(<i>node</i>)
1810
1367 <p> 1811 <p>
1368 Public method to handle a subscript. 1812 Public method to handle a subscript.
1369 </p><dl> 1813 </p>
1814 <dl>
1815
1370 <dt><i>node</i> (ast.Subscript)</dt> 1816 <dt><i>node</i> (ast.Subscript)</dt>
1371 <dd> 1817 <dd>
1372 reference to the node to be processed 1818 reference to the node to be processed
1373 </dd> 1819 </dd>
1374 </dl> 1820 </dl>
1375 <div align="right"><a href="#top">Up</a></div> 1821 <div align="right"><a href="#top">Up</a></div>
1376 <hr /><hr /> 1822 <hr />
1823 <hr />
1377 <a NAME="TextVisitor" ID="TextVisitor"></a> 1824 <a NAME="TextVisitor" ID="TextVisitor"></a>
1378 <h2>TextVisitor</h2> 1825 <h2>TextVisitor</h2>
1826
1379 <p> 1827 <p>
1380 Class implementing a node visitor for bytes and str instances. 1828 Class implementing a node visitor for bytes and str instances.
1381 </p><p> 1829 </p>
1830 <p>
1382 It tries to detect docstrings as string of the first expression of each 1831 It tries to detect docstrings as string of the first expression of each
1383 module, class or function. 1832 module, class or function.
1384 </p> 1833 </p>
1385 <h3>Derived from</h3> 1834 <h3>Derived from</h3>
1386 ast.NodeVisitor 1835 ast.NodeVisitor
1387 <h3>Class Attributes</h3> 1836 <h3>Class Attributes</h3>
1837
1388 <table> 1838 <table>
1389 <tr><td>None</td></tr> 1839 <tr><td>None</td></tr>
1390 </table> 1840 </table>
1391 <h3>Class Methods</h3> 1841 <h3>Class Methods</h3>
1842
1392 <table> 1843 <table>
1393 <tr><td>None</td></tr> 1844 <tr><td>None</td></tr>
1394 </table> 1845 </table>
1395 <h3>Methods</h3> 1846 <h3>Methods</h3>
1396 <table> 1847
1848 <table>
1849
1397 <tr> 1850 <tr>
1398 <td><a href="#TextVisitor.__init__">TextVisitor</a></td> 1851 <td><a href="#TextVisitor.__init__">TextVisitor</a></td>
1399 <td>Constructor</td> 1852 <td>Constructor</td>
1400 </tr><tr> 1853 </tr>
1854 <tr>
1401 <td><a href="#TextVisitor.__addNode">__addNode</a></td> 1855 <td><a href="#TextVisitor.__addNode">__addNode</a></td>
1402 <td>Private method to add a node to our list of nodes.</td> 1856 <td>Private method to add a node to our list of nodes.</td>
1403 </tr><tr> 1857 </tr>
1858 <tr>
1404 <td><a href="#TextVisitor.__isBaseString">__isBaseString</a></td> 1859 <td><a href="#TextVisitor.__isBaseString">__isBaseString</a></td>
1405 <td>Private method to determine, if a node is a base string node.</td> 1860 <td>Private method to determine, if a node is a base string node.</td>
1406 </tr><tr> 1861 </tr>
1862 <tr>
1407 <td><a href="#TextVisitor.__visitBody">__visitBody</a></td> 1863 <td><a href="#TextVisitor.__visitBody">__visitBody</a></td>
1408 <td>Private method to traverse the body of the node manually.</td> 1864 <td>Private method to traverse the body of the node manually.</td>
1409 </tr><tr> 1865 </tr>
1866 <tr>
1410 <td><a href="#TextVisitor.__visitDefinition">__visitDefinition</a></td> 1867 <td><a href="#TextVisitor.__visitDefinition">__visitDefinition</a></td>
1411 <td>Private method handling class and function definitions.</td> 1868 <td>Private method handling class and function definitions.</td>
1412 </tr><tr> 1869 </tr>
1870 <tr>
1413 <td><a href="#TextVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> 1871 <td><a href="#TextVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td>
1414 <td>Public method to handle an asynchronous function definition.</td> 1872 <td>Public method to handle an asynchronous function definition.</td>
1415 </tr><tr> 1873 </tr>
1874 <tr>
1416 <td><a href="#TextVisitor.visit_Bytes">visit_Bytes</a></td> 1875 <td><a href="#TextVisitor.visit_Bytes">visit_Bytes</a></td>
1417 <td>Public method to record a bytes node.</td> 1876 <td>Public method to record a bytes node.</td>
1418 </tr><tr> 1877 </tr>
1878 <tr>
1419 <td><a href="#TextVisitor.visit_Call">visit_Call</a></td> 1879 <td><a href="#TextVisitor.visit_Call">visit_Call</a></td>
1420 <td>Public method to handle a function call.</td> 1880 <td>Public method to handle a function call.</td>
1421 </tr><tr> 1881 </tr>
1882 <tr>
1422 <td><a href="#TextVisitor.visit_ClassDef">visit_ClassDef</a></td> 1883 <td><a href="#TextVisitor.visit_ClassDef">visit_ClassDef</a></td>
1423 <td>Public method to handle a class definition.</td> 1884 <td>Public method to handle a class definition.</td>
1424 </tr><tr> 1885 </tr>
1886 <tr>
1425 <td><a href="#TextVisitor.visit_FunctionDef">visit_FunctionDef</a></td> 1887 <td><a href="#TextVisitor.visit_FunctionDef">visit_FunctionDef</a></td>
1426 <td>Public method to handle a function definition.</td> 1888 <td>Public method to handle a function definition.</td>
1427 </tr><tr> 1889 </tr>
1890 <tr>
1428 <td><a href="#TextVisitor.visit_Module">visit_Module</a></td> 1891 <td><a href="#TextVisitor.visit_Module">visit_Module</a></td>
1429 <td>Public method to handle a module.</td> 1892 <td>Public method to handle a module.</td>
1430 </tr><tr> 1893 </tr>
1894 <tr>
1431 <td><a href="#TextVisitor.visit_Str">visit_Str</a></td> 1895 <td><a href="#TextVisitor.visit_Str">visit_Str</a></td>
1432 <td>Public method to record a string node.</td> 1896 <td>Public method to record a string node.</td>
1433 </tr> 1897 </tr>
1434 </table> 1898 </table>
1435 <h3>Static Methods</h3> 1899 <h3>Static Methods</h3>
1900
1436 <table> 1901 <table>
1437 <tr><td>None</td></tr> 1902 <tr><td>None</td></tr>
1438 </table> 1903 </table>
1904
1439 <a NAME="TextVisitor.__init__" ID="TextVisitor.__init__"></a> 1905 <a NAME="TextVisitor.__init__" ID="TextVisitor.__init__"></a>
1440 <h4>TextVisitor (Constructor)</h4> 1906 <h4>TextVisitor (Constructor)</h4>
1441 <b>TextVisitor</b>(<i></i>) 1907 <b>TextVisitor</b>(<i></i>)
1908
1442 <p> 1909 <p>
1443 Constructor 1910 Constructor
1444 </p><a NAME="TextVisitor.__addNode" ID="TextVisitor.__addNode"></a> 1911 </p>
1912 <a NAME="TextVisitor.__addNode" ID="TextVisitor.__addNode"></a>
1445 <h4>TextVisitor.__addNode</h4> 1913 <h4>TextVisitor.__addNode</h4>
1446 <b>__addNode</b>(<i>node</i>) 1914 <b>__addNode</b>(<i>node</i>)
1915
1447 <p> 1916 <p>
1448 Private method to add a node to our list of nodes. 1917 Private method to add a node to our list of nodes.
1449 </p><dl> 1918 </p>
1919 <dl>
1920
1450 <dt><i>node</i> (ast.AST)</dt> 1921 <dt><i>node</i> (ast.AST)</dt>
1451 <dd> 1922 <dd>
1452 reference to the node to add 1923 reference to the node to add
1453 </dd> 1924 </dd>
1454 </dl><a NAME="TextVisitor.__isBaseString" ID="TextVisitor.__isBaseString"></a> 1925 </dl>
1926 <a NAME="TextVisitor.__isBaseString" ID="TextVisitor.__isBaseString"></a>
1455 <h4>TextVisitor.__isBaseString</h4> 1927 <h4>TextVisitor.__isBaseString</h4>
1456 <b>__isBaseString</b>(<i>node</i>) 1928 <b>__isBaseString</b>(<i>node</i>)
1929
1457 <p> 1930 <p>
1458 Private method to determine, if a node is a base string node. 1931 Private method to determine, if a node is a base string node.
1459 </p><dl> 1932 </p>
1933 <dl>
1934
1460 <dt><i>node</i> (ast.AST)</dt> 1935 <dt><i>node</i> (ast.AST)</dt>
1461 <dd> 1936 <dd>
1462 reference to the node to check 1937 reference to the node to check
1463 </dd> 1938 </dd>
1464 </dl><dl> 1939 </dl>
1940 <dl>
1465 <dt>Returns:</dt> 1941 <dt>Returns:</dt>
1466 <dd> 1942 <dd>
1467 flag indicating a base string 1943 flag indicating a base string
1468 </dd> 1944 </dd>
1469 </dl><dl> 1945 </dl>
1946 <dl>
1470 <dt>Return Type:</dt> 1947 <dt>Return Type:</dt>
1471 <dd> 1948 <dd>
1472 bool 1949 bool
1473 </dd> 1950 </dd>
1474 </dl><a NAME="TextVisitor.__visitBody" ID="TextVisitor.__visitBody"></a> 1951 </dl>
1952 <a NAME="TextVisitor.__visitBody" ID="TextVisitor.__visitBody"></a>
1475 <h4>TextVisitor.__visitBody</h4> 1953 <h4>TextVisitor.__visitBody</h4>
1476 <b>__visitBody</b>(<i>node</i>) 1954 <b>__visitBody</b>(<i>node</i>)
1955
1477 <p> 1956 <p>
1478 Private method to traverse the body of the node manually. 1957 Private method to traverse the body of the node manually.
1479 </p><p> 1958 </p>
1959 <p>
1480 If the first node is an expression which contains a string or bytes it 1960 If the first node is an expression which contains a string or bytes it
1481 marks that as a docstring. 1961 marks that as a docstring.
1482 </p><dl> 1962 </p>
1963 <dl>
1964
1483 <dt><i>node</i> (ast.AST)</dt> 1965 <dt><i>node</i> (ast.AST)</dt>
1484 <dd> 1966 <dd>
1485 reference to the node to traverse 1967 reference to the node to traverse
1486 </dd> 1968 </dd>
1487 </dl><a NAME="TextVisitor.__visitDefinition" ID="TextVisitor.__visitDefinition"></a> 1969 </dl>
1970 <a NAME="TextVisitor.__visitDefinition" ID="TextVisitor.__visitDefinition"></a>
1488 <h4>TextVisitor.__visitDefinition</h4> 1971 <h4>TextVisitor.__visitDefinition</h4>
1489 <b>__visitDefinition</b>(<i>node</i>) 1972 <b>__visitDefinition</b>(<i>node</i>)
1973
1490 <p> 1974 <p>
1491 Private method handling class and function definitions. 1975 Private method handling class and function definitions.
1492 </p><dl> 1976 </p>
1977 <dl>
1978
1493 <dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef)</dt> 1979 <dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef)</dt>
1494 <dd> 1980 <dd>
1495 reference to the node to handle 1981 reference to the node to handle
1496 </dd> 1982 </dd>
1497 </dl><a NAME="TextVisitor.visit_AsyncFunctionDef" ID="TextVisitor.visit_AsyncFunctionDef"></a> 1983 </dl>
1984 <a NAME="TextVisitor.visit_AsyncFunctionDef" ID="TextVisitor.visit_AsyncFunctionDef"></a>
1498 <h4>TextVisitor.visit_AsyncFunctionDef</h4> 1985 <h4>TextVisitor.visit_AsyncFunctionDef</h4>
1499 <b>visit_AsyncFunctionDef</b>(<i>node</i>) 1986 <b>visit_AsyncFunctionDef</b>(<i>node</i>)
1987
1500 <p> 1988 <p>
1501 Public method to handle an asynchronous function definition. 1989 Public method to handle an asynchronous function definition.
1502 </p><dl> 1990 </p>
1991 <dl>
1992
1503 <dt><i>node</i> (ast.AsyncFunctionDef)</dt> 1993 <dt><i>node</i> (ast.AsyncFunctionDef)</dt>
1504 <dd> 1994 <dd>
1505 reference to the node to handle 1995 reference to the node to handle
1506 </dd> 1996 </dd>
1507 </dl><a NAME="TextVisitor.visit_Bytes" ID="TextVisitor.visit_Bytes"></a> 1997 </dl>
1998 <a NAME="TextVisitor.visit_Bytes" ID="TextVisitor.visit_Bytes"></a>
1508 <h4>TextVisitor.visit_Bytes</h4> 1999 <h4>TextVisitor.visit_Bytes</h4>
1509 <b>visit_Bytes</b>(<i>node</i>) 2000 <b>visit_Bytes</b>(<i>node</i>)
2001
1510 <p> 2002 <p>
1511 Public method to record a bytes node. 2003 Public method to record a bytes node.
1512 </p><dl> 2004 </p>
2005 <dl>
2006
1513 <dt><i>node</i> (ast.Bytes)</dt> 2007 <dt><i>node</i> (ast.Bytes)</dt>
1514 <dd> 2008 <dd>
1515 reference to the bytes node 2009 reference to the bytes node
1516 </dd> 2010 </dd>
1517 </dl><a NAME="TextVisitor.visit_Call" ID="TextVisitor.visit_Call"></a> 2011 </dl>
2012 <a NAME="TextVisitor.visit_Call" ID="TextVisitor.visit_Call"></a>
1518 <h4>TextVisitor.visit_Call</h4> 2013 <h4>TextVisitor.visit_Call</h4>
1519 <b>visit_Call</b>(<i>node</i>) 2014 <b>visit_Call</b>(<i>node</i>)
2015
1520 <p> 2016 <p>
1521 Public method to handle a function call. 2017 Public method to handle a function call.
1522 </p><dl> 2018 </p>
2019 <dl>
2020
1523 <dt><i>node</i> (ast.Call)</dt> 2021 <dt><i>node</i> (ast.Call)</dt>
1524 <dd> 2022 <dd>
1525 reference to the node to handle 2023 reference to the node to handle
1526 </dd> 2024 </dd>
1527 </dl><a NAME="TextVisitor.visit_ClassDef" ID="TextVisitor.visit_ClassDef"></a> 2025 </dl>
2026 <a NAME="TextVisitor.visit_ClassDef" ID="TextVisitor.visit_ClassDef"></a>
1528 <h4>TextVisitor.visit_ClassDef</h4> 2027 <h4>TextVisitor.visit_ClassDef</h4>
1529 <b>visit_ClassDef</b>(<i>node</i>) 2028 <b>visit_ClassDef</b>(<i>node</i>)
2029
1530 <p> 2030 <p>
1531 Public method to handle a class definition. 2031 Public method to handle a class definition.
1532 </p><dl> 2032 </p>
2033 <dl>
2034
1533 <dt><i>node</i> (ast.ClassDef)</dt> 2035 <dt><i>node</i> (ast.ClassDef)</dt>
1534 <dd> 2036 <dd>
1535 reference to the node to handle 2037 reference to the node to handle
1536 </dd> 2038 </dd>
1537 </dl><a NAME="TextVisitor.visit_FunctionDef" ID="TextVisitor.visit_FunctionDef"></a> 2039 </dl>
2040 <a NAME="TextVisitor.visit_FunctionDef" ID="TextVisitor.visit_FunctionDef"></a>
1538 <h4>TextVisitor.visit_FunctionDef</h4> 2041 <h4>TextVisitor.visit_FunctionDef</h4>
1539 <b>visit_FunctionDef</b>(<i>node</i>) 2042 <b>visit_FunctionDef</b>(<i>node</i>)
2043
1540 <p> 2044 <p>
1541 Public method to handle a function definition. 2045 Public method to handle a function definition.
1542 </p><dl> 2046 </p>
2047 <dl>
2048
1543 <dt><i>node</i> (ast.FunctionDef)</dt> 2049 <dt><i>node</i> (ast.FunctionDef)</dt>
1544 <dd> 2050 <dd>
1545 reference to the node to handle 2051 reference to the node to handle
1546 </dd> 2052 </dd>
1547 </dl><a NAME="TextVisitor.visit_Module" ID="TextVisitor.visit_Module"></a> 2053 </dl>
2054 <a NAME="TextVisitor.visit_Module" ID="TextVisitor.visit_Module"></a>
1548 <h4>TextVisitor.visit_Module</h4> 2055 <h4>TextVisitor.visit_Module</h4>
1549 <b>visit_Module</b>(<i>node</i>) 2056 <b>visit_Module</b>(<i>node</i>)
2057
1550 <p> 2058 <p>
1551 Public method to handle a module. 2059 Public method to handle a module.
1552 </p><dl> 2060 </p>
2061 <dl>
2062
1553 <dt><i>node</i> (ast.Module)</dt> 2063 <dt><i>node</i> (ast.Module)</dt>
1554 <dd> 2064 <dd>
1555 reference to the node to handle 2065 reference to the node to handle
1556 </dd> 2066 </dd>
1557 </dl><a NAME="TextVisitor.visit_Str" ID="TextVisitor.visit_Str"></a> 2067 </dl>
2068 <a NAME="TextVisitor.visit_Str" ID="TextVisitor.visit_Str"></a>
1558 <h4>TextVisitor.visit_Str</h4> 2069 <h4>TextVisitor.visit_Str</h4>
1559 <b>visit_Str</b>(<i>node</i>) 2070 <b>visit_Str</b>(<i>node</i>)
2071
1560 <p> 2072 <p>
1561 Public method to record a string node. 2073 Public method to record a string node.
1562 </p><dl> 2074 </p>
2075 <dl>
2076
1563 <dt><i>node</i> (ast.Str)</dt> 2077 <dt><i>node</i> (ast.Str)</dt>
1564 <dd> 2078 <dd>
1565 reference to the string node 2079 reference to the string node
1566 </dd> 2080 </dd>
1567 </dl> 2081 </dl>
1568 <div align="right"><a href="#top">Up</a></div> 2082 <div align="right"><a href="#top">Up</a></div>
1569 <hr /><hr /> 2083 <hr />
2084 <hr />
1570 <a NAME="composeCallPath" ID="composeCallPath"></a> 2085 <a NAME="composeCallPath" ID="composeCallPath"></a>
1571 <h2>composeCallPath</h2> 2086 <h2>composeCallPath</h2>
1572 <b>composeCallPath</b>(<i>node</i>) 2087 <b>composeCallPath</b>(<i>node</i>)
2088
1573 <p> 2089 <p>
1574 Generator function to assemble the call path of a given node. 2090 Generator function to assemble the call path of a given node.
1575 </p><dl> 2091 </p>
2092 <dl>
2093
1576 <dt><i>node</i> (ast.Node)</dt> 2094 <dt><i>node</i> (ast.Node)</dt>
1577 <dd> 2095 <dd>
1578 node to assemble call path for 2096 node to assemble call path for
1579 </dd> 2097 </dd>
1580 </dl><dl> 2098 </dl>
2099 <dl>
1581 <dt>Returns:</dt> 2100 <dt>Returns:</dt>
1582 <dd> 2101 <dd>
1583 call path components 2102 call path components
1584 </dd> 2103 </dd>
1585 </dl><dl> 2104 </dl>
2105 <dl>
1586 <dt>Return Type:</dt> 2106 <dt>Return Type:</dt>
1587 <dd> 2107 <dd>
1588 str 2108 str
1589 </dd> 2109 </dd>
1590 </dl> 2110 </dl>

eric ide

mercurial