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

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

eric ide

mercurial