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

changeset 7273
391d6b7b1eff
parent 7247
bf9379f964f3
equal deleted inserted replaced
7272:1779dc278077 7273:391d6b7b1eff
16 16
17 a { color: #BA6D36; } 17 a { color: #BA6D36; }
18 18
19 </style> 19 </style>
20 </head> 20 </head>
21 <body><a NAME="top" ID="top"></a> 21 <body>
22 <a NAME="top" ID="top"></a>
22 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.AnnotationsChecker</h1> 23 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.AnnotationsChecker</h1>
24
23 <p> 25 <p>
24 Module implementing a checker for function type annotations. 26 Module implementing a checker for function type annotations.
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="#AnnotationsChecker">AnnotationsChecker</a></td> 38 <td><a href="#AnnotationsChecker">AnnotationsChecker</a></td>
34 <td>Class implementing a checker for function type annotations.</td> 39 <td>Class implementing a checker for function type annotations.</td>
35 </tr><tr> 40 </tr>
41 <tr>
36 <td><a href="#FunctionVisitor">FunctionVisitor</a></td> 42 <td><a href="#FunctionVisitor">FunctionVisitor</a></td>
37 <td>Class implementing a node visitor to check function annotations.</td> 43 <td>Class implementing a node visitor to check function annotations.</td>
38 </tr> 44 </tr>
39 </table> 45 </table>
40 <h3>Functions</h3> 46 <h3>Functions</h3>
41 <table> 47
48 <table>
49
42 <tr> 50 <tr>
43 <td><a href="#getAnnotationComplexity">getAnnotationComplexity</a></td> 51 <td><a href="#getAnnotationComplexity">getAnnotationComplexity</a></td>
44 <td>Function to determine the annotation complexity.</td> 52 <td>Function to determine the annotation complexity.</td>
45 </tr><tr> 53 </tr>
54 <tr>
46 <td><a href="#hasTypeAnnotations">hasTypeAnnotations</a></td> 55 <td><a href="#hasTypeAnnotations">hasTypeAnnotations</a></td>
47 <td>Function to check for type annotations.</td> 56 <td>Function to check for type annotations.</td>
48 </tr> 57 </tr>
49 </table> 58 </table>
50 <hr /><hr /> 59 <hr />
60 <hr />
51 <a NAME="AnnotationsChecker" ID="AnnotationsChecker"></a> 61 <a NAME="AnnotationsChecker" ID="AnnotationsChecker"></a>
52 <h2>AnnotationsChecker</h2> 62 <h2>AnnotationsChecker</h2>
63
53 <p> 64 <p>
54 Class implementing a checker for function type annotations. 65 Class implementing a checker for function type annotations.
55 </p> 66 </p>
56 <h3>Derived from</h3> 67 <h3>Derived from</h3>
57 object 68 object
58 <h3>Class Attributes</h3> 69 <h3>Class Attributes</h3>
70
59 <table> 71 <table>
60 <tr><td>Codes</td></tr> 72 <tr><td>Codes</td></tr>
61 </table> 73 </table>
62 <h3>Class Methods</h3> 74 <h3>Class Methods</h3>
75
63 <table> 76 <table>
64 <tr><td>None</td></tr> 77 <tr><td>None</td></tr>
65 </table> 78 </table>
66 <h3>Methods</h3> 79 <h3>Methods</h3>
67 <table> 80
81 <table>
82
68 <tr> 83 <tr>
69 <td><a href="#AnnotationsChecker.__init__">AnnotationsChecker</a></td> 84 <td><a href="#AnnotationsChecker.__init__">AnnotationsChecker</a></td>
70 <td>Constructor</td> 85 <td>Constructor</td>
71 </tr><tr> 86 </tr>
87 <tr>
72 <td><a href="#AnnotationsChecker.__checkAnnotationComplexity">__checkAnnotationComplexity</a></td> 88 <td><a href="#AnnotationsChecker.__checkAnnotationComplexity">__checkAnnotationComplexity</a></td>
73 <td>Private method to check the type annotation complexity.</td> 89 <td>Private method to check the type annotation complexity.</td>
74 </tr><tr> 90 </tr>
91 <tr>
75 <td><a href="#AnnotationsChecker.__checkAnnotationsCoverage">__checkAnnotationsCoverage</a></td> 92 <td><a href="#AnnotationsChecker.__checkAnnotationsCoverage">__checkAnnotationsCoverage</a></td>
76 <td>Private method to check for function annotation coverage.</td> 93 <td>Private method to check for function annotation coverage.</td>
77 </tr><tr> 94 </tr>
95 <tr>
78 <td><a href="#AnnotationsChecker.__checkFunctionAnnotations">__checkFunctionAnnotations</a></td> 96 <td><a href="#AnnotationsChecker.__checkFunctionAnnotations">__checkFunctionAnnotations</a></td>
79 <td>Private method to check for function annotation issues.</td> 97 <td>Private method to check for function annotation issues.</td>
80 </tr><tr> 98 </tr>
99 <tr>
81 <td><a href="#AnnotationsChecker.__error">__error</a></td> 100 <td><a href="#AnnotationsChecker.__error">__error</a></td>
82 <td>Private method to record an issue.</td> 101 <td>Private method to record an issue.</td>
83 </tr><tr> 102 </tr>
103 <tr>
84 <td><a href="#AnnotationsChecker.__generateTree">__generateTree</a></td> 104 <td><a href="#AnnotationsChecker.__generateTree">__generateTree</a></td>
85 <td>Private method to generate an AST for our source.</td> 105 <td>Private method to generate an AST for our source.</td>
86 </tr><tr> 106 </tr>
107 <tr>
87 <td><a href="#AnnotationsChecker.__ignoreCode">__ignoreCode</a></td> 108 <td><a href="#AnnotationsChecker.__ignoreCode">__ignoreCode</a></td>
88 <td>Private method to check if the message code should be ignored.</td> 109 <td>Private method to check if the message code should be ignored.</td>
89 </tr><tr> 110 </tr>
111 <tr>
90 <td><a href="#AnnotationsChecker.__reportInvalidSyntax">__reportInvalidSyntax</a></td> 112 <td><a href="#AnnotationsChecker.__reportInvalidSyntax">__reportInvalidSyntax</a></td>
91 <td>Private method to report a syntax error.</td> 113 <td>Private method to report a syntax error.</td>
92 </tr><tr> 114 </tr>
115 <tr>
93 <td><a href="#AnnotationsChecker.run">run</a></td> 116 <td><a href="#AnnotationsChecker.run">run</a></td>
94 <td>Public method to check the given source against annotation issues.</td> 117 <td>Public method to check the given source against annotation issues.</td>
95 </tr> 118 </tr>
96 </table> 119 </table>
97 <h3>Static Methods</h3> 120 <h3>Static Methods</h3>
121
98 <table> 122 <table>
99 <tr><td>None</td></tr> 123 <tr><td>None</td></tr>
100 </table> 124 </table>
125
101 <a NAME="AnnotationsChecker.__init__" ID="AnnotationsChecker.__init__"></a> 126 <a NAME="AnnotationsChecker.__init__" ID="AnnotationsChecker.__init__"></a>
102 <h4>AnnotationsChecker (Constructor)</h4> 127 <h4>AnnotationsChecker (Constructor)</h4>
103 <b>AnnotationsChecker</b>(<i>source, filename, select, ignore, expected, repeat, args</i>) 128 <b>AnnotationsChecker</b>(<i>source, filename, select, ignore, expected, repeat, args</i>)
129
104 <p> 130 <p>
105 Constructor 131 Constructor
106 </p><dl> 132 </p>
133 <dl>
134
107 <dt><i>source</i> (list of str)</dt> 135 <dt><i>source</i> (list of str)</dt>
108 <dd> 136 <dd>
109 source code to be checked 137 source code to be checked
110 </dd><dt><i>filename</i> (str)</dt> 138 </dd>
139 <dt><i>filename</i> (str)</dt>
111 <dd> 140 <dd>
112 name of the source file 141 name of the source file
113 </dd><dt><i>select</i> (list of str)</dt> 142 </dd>
143 <dt><i>select</i> (list of str)</dt>
114 <dd> 144 <dd>
115 list of selected codes 145 list of selected codes
116 </dd><dt><i>ignore</i> (list of str)</dt> 146 </dd>
147 <dt><i>ignore</i> (list of str)</dt>
117 <dd> 148 <dd>
118 list of codes to be ignored 149 list of codes to be ignored
119 </dd><dt><i>expected</i> (list of str)</dt> 150 </dd>
151 <dt><i>expected</i> (list of str)</dt>
120 <dd> 152 <dd>
121 list of expected codes 153 list of expected codes
122 </dd><dt><i>repeat</i> (bool)</dt> 154 </dd>
155 <dt><i>repeat</i> (bool)</dt>
123 <dd> 156 <dd>
124 flag indicating to report each occurrence of a code 157 flag indicating to report each occurrence of a code
125 </dd><dt><i>args</i> (dict)</dt> 158 </dd>
159 <dt><i>args</i> (dict)</dt>
126 <dd> 160 <dd>
127 dictionary of arguments for the annotation checks 161 dictionary of arguments for the annotation checks
128 </dd> 162 </dd>
129 </dl><a NAME="AnnotationsChecker.__checkAnnotationComplexity" ID="AnnotationsChecker.__checkAnnotationComplexity"></a> 163 </dl>
164 <a NAME="AnnotationsChecker.__checkAnnotationComplexity" ID="AnnotationsChecker.__checkAnnotationComplexity"></a>
130 <h4>AnnotationsChecker.__checkAnnotationComplexity</h4> 165 <h4>AnnotationsChecker.__checkAnnotationComplexity</h4>
131 <b>__checkAnnotationComplexity</b>(<i></i>) 166 <b>__checkAnnotationComplexity</b>(<i></i>)
167
132 <p> 168 <p>
133 Private method to check the type annotation complexity. 169 Private method to check the type annotation complexity.
134 </p><a NAME="AnnotationsChecker.__checkAnnotationsCoverage" ID="AnnotationsChecker.__checkAnnotationsCoverage"></a> 170 </p>
171 <a NAME="AnnotationsChecker.__checkAnnotationsCoverage" ID="AnnotationsChecker.__checkAnnotationsCoverage"></a>
135 <h4>AnnotationsChecker.__checkAnnotationsCoverage</h4> 172 <h4>AnnotationsChecker.__checkAnnotationsCoverage</h4>
136 <b>__checkAnnotationsCoverage</b>(<i></i>) 173 <b>__checkAnnotationsCoverage</b>(<i></i>)
174
137 <p> 175 <p>
138 Private method to check for function annotation coverage. 176 Private method to check for function annotation coverage.
139 </p><a NAME="AnnotationsChecker.__checkFunctionAnnotations" ID="AnnotationsChecker.__checkFunctionAnnotations"></a> 177 </p>
178 <a NAME="AnnotationsChecker.__checkFunctionAnnotations" ID="AnnotationsChecker.__checkFunctionAnnotations"></a>
140 <h4>AnnotationsChecker.__checkFunctionAnnotations</h4> 179 <h4>AnnotationsChecker.__checkFunctionAnnotations</h4>
141 <b>__checkFunctionAnnotations</b>(<i></i>) 180 <b>__checkFunctionAnnotations</b>(<i></i>)
181
142 <p> 182 <p>
143 Private method to check for function annotation issues. 183 Private method to check for function annotation issues.
144 </p><a NAME="AnnotationsChecker.__error" ID="AnnotationsChecker.__error"></a> 184 </p>
185 <a NAME="AnnotationsChecker.__error" ID="AnnotationsChecker.__error"></a>
145 <h4>AnnotationsChecker.__error</h4> 186 <h4>AnnotationsChecker.__error</h4>
146 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) 187 <b>__error</b>(<i>lineNumber, offset, code, *args</i>)
188
147 <p> 189 <p>
148 Private method to record an issue. 190 Private method to record an issue.
149 </p><dl> 191 </p>
192 <dl>
193
150 <dt><i>lineNumber</i> (int)</dt> 194 <dt><i>lineNumber</i> (int)</dt>
151 <dd> 195 <dd>
152 line number of the issue 196 line number of the issue
153 </dd><dt><i>offset</i> (int)</dt> 197 </dd>
198 <dt><i>offset</i> (int)</dt>
154 <dd> 199 <dd>
155 position within line of the issue 200 position within line of the issue
156 </dd><dt><i>code</i> (str)</dt> 201 </dd>
202 <dt><i>code</i> (str)</dt>
157 <dd> 203 <dd>
158 message code 204 message code
159 </dd><dt><i>args</i> (list)</dt> 205 </dd>
206 <dt><i>args</i> (list)</dt>
160 <dd> 207 <dd>
161 arguments for the message 208 arguments for the message
162 </dd> 209 </dd>
163 </dl><a NAME="AnnotationsChecker.__generateTree" ID="AnnotationsChecker.__generateTree"></a> 210 </dl>
211 <a NAME="AnnotationsChecker.__generateTree" ID="AnnotationsChecker.__generateTree"></a>
164 <h4>AnnotationsChecker.__generateTree</h4> 212 <h4>AnnotationsChecker.__generateTree</h4>
165 <b>__generateTree</b>(<i></i>) 213 <b>__generateTree</b>(<i></i>)
214
166 <p> 215 <p>
167 Private method to generate an AST for our source. 216 Private method to generate an AST for our source.
168 </p><dl> 217 </p>
218 <dl>
169 <dt>Returns:</dt> 219 <dt>Returns:</dt>
170 <dd> 220 <dd>
171 generated AST 221 generated AST
172 </dd> 222 </dd>
173 </dl><dl> 223 </dl>
224 <dl>
174 <dt>Return Type:</dt> 225 <dt>Return Type:</dt>
175 <dd> 226 <dd>
176 ast.Module 227 ast.Module
177 </dd> 228 </dd>
178 </dl><a NAME="AnnotationsChecker.__ignoreCode" ID="AnnotationsChecker.__ignoreCode"></a> 229 </dl>
230 <a NAME="AnnotationsChecker.__ignoreCode" ID="AnnotationsChecker.__ignoreCode"></a>
179 <h4>AnnotationsChecker.__ignoreCode</h4> 231 <h4>AnnotationsChecker.__ignoreCode</h4>
180 <b>__ignoreCode</b>(<i>code</i>) 232 <b>__ignoreCode</b>(<i>code</i>)
233
181 <p> 234 <p>
182 Private method to check if the message code should be ignored. 235 Private method to check if the message code should be ignored.
183 </p><dl> 236 </p>
237 <dl>
238
184 <dt><i>code</i> (str)</dt> 239 <dt><i>code</i> (str)</dt>
185 <dd> 240 <dd>
186 message code to check for 241 message code to check for
187 </dd> 242 </dd>
188 </dl><dl> 243 </dl>
244 <dl>
189 <dt>Returns:</dt> 245 <dt>Returns:</dt>
190 <dd> 246 <dd>
191 flag indicating to ignore the given code 247 flag indicating to ignore the given code
192 </dd> 248 </dd>
193 </dl><dl> 249 </dl>
250 <dl>
194 <dt>Return Type:</dt> 251 <dt>Return Type:</dt>
195 <dd> 252 <dd>
196 bool 253 bool
197 </dd> 254 </dd>
198 </dl><a NAME="AnnotationsChecker.__reportInvalidSyntax" ID="AnnotationsChecker.__reportInvalidSyntax"></a> 255 </dl>
256 <a NAME="AnnotationsChecker.__reportInvalidSyntax" ID="AnnotationsChecker.__reportInvalidSyntax"></a>
199 <h4>AnnotationsChecker.__reportInvalidSyntax</h4> 257 <h4>AnnotationsChecker.__reportInvalidSyntax</h4>
200 <b>__reportInvalidSyntax</b>(<i></i>) 258 <b>__reportInvalidSyntax</b>(<i></i>)
259
201 <p> 260 <p>
202 Private method to report a syntax error. 261 Private method to report a syntax error.
203 </p><a NAME="AnnotationsChecker.run" ID="AnnotationsChecker.run"></a> 262 </p>
263 <a NAME="AnnotationsChecker.run" ID="AnnotationsChecker.run"></a>
204 <h4>AnnotationsChecker.run</h4> 264 <h4>AnnotationsChecker.run</h4>
205 <b>run</b>(<i></i>) 265 <b>run</b>(<i></i>)
266
206 <p> 267 <p>
207 Public method to check the given source against annotation issues. 268 Public method to check the given source against annotation issues.
208 </p> 269 </p>
209 <div align="right"><a href="#top">Up</a></div> 270 <div align="right"><a href="#top">Up</a></div>
210 <hr /><hr /> 271 <hr />
272 <hr />
211 <a NAME="FunctionVisitor" ID="FunctionVisitor"></a> 273 <a NAME="FunctionVisitor" ID="FunctionVisitor"></a>
212 <h2>FunctionVisitor</h2> 274 <h2>FunctionVisitor</h2>
275
213 <p> 276 <p>
214 Class implementing a node visitor to check function annotations. 277 Class implementing a node visitor to check function annotations.
215 </p><p> 278 </p>
279 <p>
216 Note: this class is modelled after flake8-annotations checker. 280 Note: this class is modelled after flake8-annotations checker.
217 </p> 281 </p>
218 <h3>Derived from</h3> 282 <h3>Derived from</h3>
219 ast.NodeVisitor 283 ast.NodeVisitor
220 <h3>Class Attributes</h3> 284 <h3>Class Attributes</h3>
285
221 <table> 286 <table>
222 <tr><td>None</td></tr> 287 <tr><td>None</td></tr>
223 </table> 288 </table>
224 <h3>Class Methods</h3> 289 <h3>Class Methods</h3>
290
225 <table> 291 <table>
226 <tr><td>None</td></tr> 292 <tr><td>None</td></tr>
227 </table> 293 </table>
228 <h3>Methods</h3> 294 <h3>Methods</h3>
229 <table> 295
296 <table>
297
230 <tr> 298 <tr>
231 <td><a href="#FunctionVisitor.__init__">FunctionVisitor</a></td> 299 <td><a href="#FunctionVisitor.__init__">FunctionVisitor</a></td>
232 <td>Constructor</td> 300 <td>Constructor</td>
233 </tr><tr> 301 </tr>
302 <tr>
234 <td><a href="#FunctionVisitor.__checkFunctionNode">__checkFunctionNode</a></td> 303 <td><a href="#FunctionVisitor.__checkFunctionNode">__checkFunctionNode</a></td>
235 <td>Private method to check an individual function definition node.</td> 304 <td>Private method to check an individual function definition node.</td>
236 </tr><tr> 305 </tr>
306 <tr>
237 <td><a href="#FunctionVisitor.__classifyArgumentError">__classifyArgumentError</a></td> 307 <td><a href="#FunctionVisitor.__classifyArgumentError">__classifyArgumentError</a></td>
238 <td>Private method to classify and record an argument annotation issue.</td> 308 <td>Private method to classify and record an argument annotation issue.</td>
239 </tr><tr> 309 </tr>
310 <tr>
240 <td><a href="#FunctionVisitor.__classifyReturnError">__classifyReturnError</a></td> 311 <td><a href="#FunctionVisitor.__classifyReturnError">__classifyReturnError</a></td>
241 <td>Private method to classify and record a return annotation issue.</td> 312 <td>Private method to classify and record a return annotation issue.</td>
242 </tr><tr> 313 </tr>
314 <tr>
243 <td><a href="#FunctionVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> 315 <td><a href="#FunctionVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td>
244 <td>Public method to handle an async function or method definition.</td> 316 <td>Public method to handle an async function or method definition.</td>
245 </tr><tr> 317 </tr>
318 <tr>
246 <td><a href="#FunctionVisitor.visit_ClassDef">visit_ClassDef</a></td> 319 <td><a href="#FunctionVisitor.visit_ClassDef">visit_ClassDef</a></td>
247 <td>Public method to handle class definitions.</td> 320 <td>Public method to handle class definitions.</td>
248 </tr><tr> 321 </tr>
322 <tr>
249 <td><a href="#FunctionVisitor.visit_FunctionDef">visit_FunctionDef</a></td> 323 <td><a href="#FunctionVisitor.visit_FunctionDef">visit_FunctionDef</a></td>
250 <td>Public method to handle a function or method definition.</td> 324 <td>Public method to handle a function or method definition.</td>
251 </tr> 325 </tr>
252 </table> 326 </table>
253 <h3>Static Methods</h3> 327 <h3>Static Methods</h3>
328
254 <table> 329 <table>
255 <tr><td>None</td></tr> 330 <tr><td>None</td></tr>
256 </table> 331 </table>
332
257 <a NAME="FunctionVisitor.__init__" ID="FunctionVisitor.__init__"></a> 333 <a NAME="FunctionVisitor.__init__" ID="FunctionVisitor.__init__"></a>
258 <h4>FunctionVisitor (Constructor)</h4> 334 <h4>FunctionVisitor (Constructor)</h4>
259 <b>FunctionVisitor</b>(<i>sourceLines</i>) 335 <b>FunctionVisitor</b>(<i>sourceLines</i>)
336
260 <p> 337 <p>
261 Constructor 338 Constructor
262 </p><dl> 339 </p>
340 <dl>
341
263 <dt><i>sourceLines</i> (list of str)</dt> 342 <dt><i>sourceLines</i> (list of str)</dt>
264 <dd> 343 <dd>
265 lines of source code 344 lines of source code
266 </dd> 345 </dd>
267 </dl><a NAME="FunctionVisitor.__checkFunctionNode" ID="FunctionVisitor.__checkFunctionNode"></a> 346 </dl>
347 <a NAME="FunctionVisitor.__checkFunctionNode" ID="FunctionVisitor.__checkFunctionNode"></a>
268 <h4>FunctionVisitor.__checkFunctionNode</h4> 348 <h4>FunctionVisitor.__checkFunctionNode</h4>
269 <b>__checkFunctionNode</b>(<i>node, classMethod=False</i>) 349 <b>__checkFunctionNode</b>(<i>node, classMethod=False</i>)
350
270 <p> 351 <p>
271 Private method to check an individual function definition node. 352 Private method to check an individual function definition node.
272 </p><dl> 353 </p>
354 <dl>
355
273 <dt><i>node</i> (ast.FunctionDef or ast.AsyncFunctionDef)</dt> 356 <dt><i>node</i> (ast.FunctionDef or ast.AsyncFunctionDef)</dt>
274 <dd> 357 <dd>
275 reference to the node to be processed 358 reference to the node to be processed
276 </dd><dt><i>classMethod</i> (bool)</dt> 359 </dd>
360 <dt><i>classMethod</i> (bool)</dt>
277 <dd> 361 <dd>
278 flag indicating a class method 362 flag indicating a class method
279 </dd> 363 </dd>
280 </dl><a NAME="FunctionVisitor.__classifyArgumentError" ID="FunctionVisitor.__classifyArgumentError"></a> 364 </dl>
365 <a NAME="FunctionVisitor.__classifyArgumentError" ID="FunctionVisitor.__classifyArgumentError"></a>
281 <h4>FunctionVisitor.__classifyArgumentError</h4> 366 <h4>FunctionVisitor.__classifyArgumentError</h4>
282 <b>__classifyArgumentError</b>(<i>argNode, argType, methodType</i>) 367 <b>__classifyArgumentError</b>(<i>argNode, argType, methodType</i>)
368
283 <p> 369 <p>
284 Private method to classify and record an argument annotation issue. 370 Private method to classify and record an argument annotation issue.
285 </p><dl> 371 </p>
372 <dl>
373
286 <dt><i>argNode</i> (ast.arguments)</dt> 374 <dt><i>argNode</i> (ast.arguments)</dt>
287 <dd> 375 <dd>
288 reference to the argument node 376 reference to the argument node
289 </dd><dt><i>argType</i> (str)</dt> 377 </dd>
378 <dt><i>argType</i> (str)</dt>
290 <dd> 379 <dd>
291 type of the argument node 380 type of the argument node
292 </dd><dt><i>methodType</i> (str)</dt> 381 </dd>
382 <dt><i>methodType</i> (str)</dt>
293 <dd> 383 <dd>
294 type of method/function the argument belongs to 384 type of method/function the argument belongs to
295 </dd> 385 </dd>
296 </dl><a NAME="FunctionVisitor.__classifyReturnError" ID="FunctionVisitor.__classifyReturnError"></a> 386 </dl>
387 <a NAME="FunctionVisitor.__classifyReturnError" ID="FunctionVisitor.__classifyReturnError"></a>
297 <h4>FunctionVisitor.__classifyReturnError</h4> 388 <h4>FunctionVisitor.__classifyReturnError</h4>
298 <b>__classifyReturnError</b>(<i>methodType, visibilityType, lineno, colOffset</i>) 389 <b>__classifyReturnError</b>(<i>methodType, visibilityType, lineno, colOffset</i>)
390
299 <p> 391 <p>
300 Private method to classify and record a return annotation issue. 392 Private method to classify and record a return annotation issue.
301 </p><dl> 393 </p>
394 <dl>
395
302 <dt><i>methodType</i> (str)</dt> 396 <dt><i>methodType</i> (str)</dt>
303 <dd> 397 <dd>
304 type of method/function the argument belongs to 398 type of method/function the argument belongs to
305 </dd><dt><i>visibilityType</i> (str)</dt> 399 </dd>
400 <dt><i>visibilityType</i> (str)</dt>
306 <dd> 401 <dd>
307 visibility of the function 402 visibility of the function
308 </dd><dt><i>lineno</i> (int)</dt> 403 </dd>
404 <dt><i>lineno</i> (int)</dt>
309 <dd> 405 <dd>
310 line number 406 line number
311 </dd><dt><i>colOffset</i> (int)</dt> 407 </dd>
408 <dt><i>colOffset</i> (int)</dt>
312 <dd> 409 <dd>
313 column number 410 column number
314 </dd> 411 </dd>
315 </dl><a NAME="FunctionVisitor.visit_AsyncFunctionDef" ID="FunctionVisitor.visit_AsyncFunctionDef"></a> 412 </dl>
413 <a NAME="FunctionVisitor.visit_AsyncFunctionDef" ID="FunctionVisitor.visit_AsyncFunctionDef"></a>
316 <h4>FunctionVisitor.visit_AsyncFunctionDef</h4> 414 <h4>FunctionVisitor.visit_AsyncFunctionDef</h4>
317 <b>visit_AsyncFunctionDef</b>(<i>node</i>) 415 <b>visit_AsyncFunctionDef</b>(<i>node</i>)
416
318 <p> 417 <p>
319 Public method to handle an async function or method definition. 418 Public method to handle an async function or method definition.
320 </p><dl> 419 </p>
420 <dl>
421
321 <dt><i>node</i> (ast.AsyncFunctionDef)</dt> 422 <dt><i>node</i> (ast.AsyncFunctionDef)</dt>
322 <dd> 423 <dd>
323 reference to the node to be processed 424 reference to the node to be processed
324 </dd> 425 </dd>
325 </dl><a NAME="FunctionVisitor.visit_ClassDef" ID="FunctionVisitor.visit_ClassDef"></a> 426 </dl>
427 <a NAME="FunctionVisitor.visit_ClassDef" ID="FunctionVisitor.visit_ClassDef"></a>
326 <h4>FunctionVisitor.visit_ClassDef</h4> 428 <h4>FunctionVisitor.visit_ClassDef</h4>
327 <b>visit_ClassDef</b>(<i>node</i>) 429 <b>visit_ClassDef</b>(<i>node</i>)
430
328 <p> 431 <p>
329 Public method to handle class definitions. 432 Public method to handle class definitions.
330 </p><dl> 433 </p>
434 <dl>
435
331 <dt><i>node</i> (ast.ClassDef)</dt> 436 <dt><i>node</i> (ast.ClassDef)</dt>
332 <dd> 437 <dd>
333 reference to the node to be processed 438 reference to the node to be processed
334 </dd> 439 </dd>
335 </dl><a NAME="FunctionVisitor.visit_FunctionDef" ID="FunctionVisitor.visit_FunctionDef"></a> 440 </dl>
441 <a NAME="FunctionVisitor.visit_FunctionDef" ID="FunctionVisitor.visit_FunctionDef"></a>
336 <h4>FunctionVisitor.visit_FunctionDef</h4> 442 <h4>FunctionVisitor.visit_FunctionDef</h4>
337 <b>visit_FunctionDef</b>(<i>node</i>) 443 <b>visit_FunctionDef</b>(<i>node</i>)
444
338 <p> 445 <p>
339 Public method to handle a function or method definition. 446 Public method to handle a function or method definition.
340 </p><dl> 447 </p>
448 <dl>
449
341 <dt><i>node</i> (ast.FunctionDef)</dt> 450 <dt><i>node</i> (ast.FunctionDef)</dt>
342 <dd> 451 <dd>
343 reference to the node to be processed 452 reference to the node to be processed
344 </dd> 453 </dd>
345 </dl> 454 </dl>
346 <div align="right"><a href="#top">Up</a></div> 455 <div align="right"><a href="#top">Up</a></div>
347 <hr /><hr /> 456 <hr />
457 <hr />
348 <a NAME="getAnnotationComplexity" ID="getAnnotationComplexity"></a> 458 <a NAME="getAnnotationComplexity" ID="getAnnotationComplexity"></a>
349 <h2>getAnnotationComplexity</h2> 459 <h2>getAnnotationComplexity</h2>
350 <b>getAnnotationComplexity</b>(<i>annotationNode</i>) 460 <b>getAnnotationComplexity</b>(<i>annotationNode</i>)
461
351 <p> 462 <p>
352 Function to determine the annotation complexity. 463 Function to determine the annotation complexity.
353 </p><dl> 464 </p>
465 <dl>
466
354 <dt><i>annotationNode</i> (ast.AST)</dt> 467 <dt><i>annotationNode</i> (ast.AST)</dt>
355 <dd> 468 <dd>
356 reference to the node to determine the annotation 469 reference to the node to determine the annotation
357 complexity for 470 complexity for
358 </dd> 471 </dd>
359 </dl><dl> 472 </dl>
473 <dl>
360 <dt>Returns:</dt> 474 <dt>Returns:</dt>
361 <dd> 475 <dd>
362 annotation complexity 476 annotation complexity
363 </dd> 477 </dd>
364 </dl><dl> 478 </dl>
479 <dl>
365 <dt>Return Type:</dt> 480 <dt>Return Type:</dt>
366 <dd> 481 <dd>
367 = int 482 = int
368 </dd> 483 </dd>
369 </dl> 484 </dl>
370 <div align="right"><a href="#top">Up</a></div> 485 <div align="right"><a href="#top">Up</a></div>
371 <hr /><hr /> 486 <hr />
487 <hr />
372 <a NAME="hasTypeAnnotations" ID="hasTypeAnnotations"></a> 488 <a NAME="hasTypeAnnotations" ID="hasTypeAnnotations"></a>
373 <h2>hasTypeAnnotations</h2> 489 <h2>hasTypeAnnotations</h2>
374 <b>hasTypeAnnotations</b>(<i>funcNode</i>) 490 <b>hasTypeAnnotations</b>(<i>funcNode</i>)
491
375 <p> 492 <p>
376 Function to check for type annotations. 493 Function to check for type annotations.
377 </p><dl> 494 </p>
495 <dl>
496
378 <dt><i>funcNode</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt> 497 <dt><i>funcNode</i> (ast.AsyncFunctionDef or ast.FunctionDef)</dt>
379 <dd> 498 <dd>
380 reference to the function definition node to be checked 499 reference to the function definition node to be checked
381 </dd> 500 </dd>
382 </dl><dl> 501 </dl>
502 <dl>
383 <dt>Returns:</dt> 503 <dt>Returns:</dt>
384 <dd> 504 <dd>
385 flag indicating the presence of type annotations 505 flag indicating the presence of type annotations
386 </dd> 506 </dd>
387 </dl><dl> 507 </dl>
508 <dl>
388 <dt>Return Type:</dt> 509 <dt>Return Type:</dt>
389 <dd> 510 <dd>
390 bool 511 bool
391 </dd> 512 </dd>
392 </dl> 513 </dl>

eric ide

mercurial