5 <link rel="stylesheet" href="styles.css"> |
5 <link rel="stylesheet" href="styles.css"> |
6 </head> |
6 </head> |
7 <body> |
7 <body> |
8 <a NAME="top" ID="top"></a> |
8 <a NAME="top" ID="top"></a> |
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker</h1> |
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsChecker</h1> |
10 |
|
11 <p> |
10 <p> |
12 Module implementing a checker for function type annotations. |
11 Module implementing a checker for function type annotations. |
13 </p> |
12 </p> |
|
13 |
14 <h3>Global Attributes</h3> |
14 <h3>Global Attributes</h3> |
15 |
|
16 <table> |
15 <table> |
17 <tr><td>None</td></tr> |
16 <tr><td>None</td></tr> |
18 </table> |
17 </table> |
|
18 |
19 <h3>Classes</h3> |
19 <h3>Classes</h3> |
20 |
20 <table> |
21 <table> |
|
22 |
|
23 <tr> |
21 <tr> |
24 <td><a href="#AnnotationsChecker">AnnotationsChecker</a></td> |
22 <td><a href="#AnnotationsChecker">AnnotationsChecker</a></td> |
25 <td>Class implementing a checker for function type annotations.</td> |
23 <td>Class implementing a checker for function type annotations.</td> |
26 </tr> |
24 </tr> |
27 </table> |
25 </table> |
|
26 |
28 <h3>Functions</h3> |
27 <h3>Functions</h3> |
29 |
|
30 <table> |
28 <table> |
31 <tr><td>None</td></tr> |
29 <tr><td>None</td></tr> |
32 </table> |
30 </table> |
|
31 |
33 <hr /> |
32 <hr /> |
34 <hr /> |
33 <hr /> |
35 <a NAME="AnnotationsChecker" ID="AnnotationsChecker"></a> |
34 <a NAME="AnnotationsChecker" ID="AnnotationsChecker"></a> |
36 <h2>AnnotationsChecker</h2> |
35 <h2>AnnotationsChecker</h2> |
37 |
|
38 <p> |
36 <p> |
39 Class implementing a checker for function type annotations. |
37 Class implementing a checker for function type annotations. |
40 </p> |
38 </p> |
|
39 |
41 <h3>Derived from</h3> |
40 <h3>Derived from</h3> |
42 None |
41 None |
43 <h3>Class Attributes</h3> |
42 <h3>Class Attributes</h3> |
44 |
|
45 <table> |
43 <table> |
46 <tr><td>Codes</td></tr> |
44 <tr><td>Codes</td></tr> |
47 </table> |
45 </table> |
|
46 |
48 <h3>Class Methods</h3> |
47 <h3>Class Methods</h3> |
49 |
|
50 <table> |
48 <table> |
51 <tr><td>None</td></tr> |
49 <tr><td>None</td></tr> |
52 </table> |
50 </table> |
|
51 |
53 <h3>Methods</h3> |
52 <h3>Methods</h3> |
54 |
53 <table> |
55 <table> |
|
56 |
|
57 <tr> |
54 <tr> |
58 <td><a href="#AnnotationsChecker.__init__">AnnotationsChecker</a></td> |
55 <td><a href="#AnnotationsChecker.__init__">AnnotationsChecker</a></td> |
59 <td>Constructor</td> |
56 <td>Constructor</td> |
60 </tr> |
57 </tr> |
61 <tr> |
58 <tr> |
117 <tr> |
114 <tr> |
118 <td><a href="#AnnotationsChecker.run">run</a></td> |
115 <td><a href="#AnnotationsChecker.run">run</a></td> |
119 <td>Public method to check the given source against annotation issues.</td> |
116 <td>Public method to check the given source against annotation issues.</td> |
120 </tr> |
117 </tr> |
121 </table> |
118 </table> |
|
119 |
122 <h3>Static Methods</h3> |
120 <h3>Static Methods</h3> |
123 |
|
124 <table> |
121 <table> |
125 <tr><td>None</td></tr> |
122 <tr><td>None</td></tr> |
126 </table> |
123 </table> |
|
124 |
127 |
125 |
128 <a NAME="AnnotationsChecker.__init__" ID="AnnotationsChecker.__init__"></a> |
126 <a NAME="AnnotationsChecker.__init__" ID="AnnotationsChecker.__init__"></a> |
129 <h4>AnnotationsChecker (Constructor)</h4> |
127 <h4>AnnotationsChecker (Constructor)</h4> |
130 <b>AnnotationsChecker</b>(<i>source, filename, tree, select, ignore, expected, repeat, args</i>) |
128 <b>AnnotationsChecker</b>(<i>source, filename, tree, select, ignore, expected, repeat, args</i>) |
131 |
|
132 <p> |
129 <p> |
133 Constructor |
130 Constructor |
134 </p> |
131 </p> |
|
132 |
135 <dl> |
133 <dl> |
136 |
134 |
137 <dt><i>source</i> (list of str)</dt> |
135 <dt><i>source</i> (list of str)</dt> |
138 <dd> |
136 <dd> |
139 source code to be checked |
137 source code to be checked |
168 </dd> |
166 </dd> |
169 </dl> |
167 </dl> |
170 <a NAME="AnnotationsChecker.__argumentErrorClassifier" ID="AnnotationsChecker.__argumentErrorClassifier"></a> |
168 <a NAME="AnnotationsChecker.__argumentErrorClassifier" ID="AnnotationsChecker.__argumentErrorClassifier"></a> |
171 <h4>AnnotationsChecker.__argumentErrorClassifier</h4> |
169 <h4>AnnotationsChecker.__argumentErrorClassifier</h4> |
172 <b>__argumentErrorClassifier</b>(<i>isClassMethod, isFirstArg, classDecoratorType, annotationType</i>) |
170 <b>__argumentErrorClassifier</b>(<i>isClassMethod, isFirstArg, classDecoratorType, annotationType</i>) |
173 |
|
174 <p> |
171 <p> |
175 Private method to classify an argument type annotation issue. |
172 Private method to classify an argument type annotation issue. |
176 </p> |
173 </p> |
|
174 |
177 <dl> |
175 <dl> |
178 |
176 |
179 <dt><i>isClassMethod</i> (bool)</dt> |
177 <dt><i>isClassMethod</i> (bool)</dt> |
180 <dd> |
178 <dd> |
181 flag indicating a classmethod type function |
179 flag indicating a classmethod type function |
206 </dd> |
204 </dd> |
207 </dl> |
205 </dl> |
208 <a NAME="AnnotationsChecker.__checkAnnotationComplexity" ID="AnnotationsChecker.__checkAnnotationComplexity"></a> |
206 <a NAME="AnnotationsChecker.__checkAnnotationComplexity" ID="AnnotationsChecker.__checkAnnotationComplexity"></a> |
209 <h4>AnnotationsChecker.__checkAnnotationComplexity</h4> |
207 <h4>AnnotationsChecker.__checkAnnotationComplexity</h4> |
210 <b>__checkAnnotationComplexity</b>(<i></i>) |
208 <b>__checkAnnotationComplexity</b>(<i></i>) |
211 |
|
212 <p> |
209 <p> |
213 Private method to check the type annotation complexity. |
210 Private method to check the type annotation complexity. |
214 </p> |
211 </p> |
|
212 |
215 <a NAME="AnnotationsChecker.__checkAnnotationPep604" ID="AnnotationsChecker.__checkAnnotationPep604"></a> |
213 <a NAME="AnnotationsChecker.__checkAnnotationPep604" ID="AnnotationsChecker.__checkAnnotationPep604"></a> |
216 <h4>AnnotationsChecker.__checkAnnotationPep604</h4> |
214 <h4>AnnotationsChecker.__checkAnnotationPep604</h4> |
217 <b>__checkAnnotationPep604</b>(<i></i>) |
215 <b>__checkAnnotationPep604</b>(<i></i>) |
218 |
|
219 <p> |
216 <p> |
220 Private method to check the use of typing.Union. |
217 Private method to check the use of typing.Union. |
221 </p> |
218 </p> |
|
219 |
222 <a NAME="AnnotationsChecker.__checkAnnotationsCoverage" ID="AnnotationsChecker.__checkAnnotationsCoverage"></a> |
220 <a NAME="AnnotationsChecker.__checkAnnotationsCoverage" ID="AnnotationsChecker.__checkAnnotationsCoverage"></a> |
223 <h4>AnnotationsChecker.__checkAnnotationsCoverage</h4> |
221 <h4>AnnotationsChecker.__checkAnnotationsCoverage</h4> |
224 <b>__checkAnnotationsCoverage</b>(<i></i>) |
222 <b>__checkAnnotationsCoverage</b>(<i></i>) |
225 |
|
226 <p> |
223 <p> |
227 Private method to check for function annotation coverage. |
224 Private method to check for function annotation coverage. |
228 </p> |
225 </p> |
|
226 |
229 <a NAME="AnnotationsChecker.__checkAnnotationsFuture" ID="AnnotationsChecker.__checkAnnotationsFuture"></a> |
227 <a NAME="AnnotationsChecker.__checkAnnotationsFuture" ID="AnnotationsChecker.__checkAnnotationsFuture"></a> |
230 <h4>AnnotationsChecker.__checkAnnotationsFuture</h4> |
228 <h4>AnnotationsChecker.__checkAnnotationsFuture</h4> |
231 <b>__checkAnnotationsFuture</b>(<i></i>) |
229 <b>__checkAnnotationsFuture</b>(<i></i>) |
232 |
|
233 <p> |
230 <p> |
234 Private method to check the use of __future__ and typing imports. |
231 Private method to check the use of __future__ and typing imports. |
235 </p> |
232 </p> |
|
233 |
236 <a NAME="AnnotationsChecker.__checkDeprecatedTypingSymbols" ID="AnnotationsChecker.__checkDeprecatedTypingSymbols"></a> |
234 <a NAME="AnnotationsChecker.__checkDeprecatedTypingSymbols" ID="AnnotationsChecker.__checkDeprecatedTypingSymbols"></a> |
237 <h4>AnnotationsChecker.__checkDeprecatedTypingSymbols</h4> |
235 <h4>AnnotationsChecker.__checkDeprecatedTypingSymbols</h4> |
238 <b>__checkDeprecatedTypingSymbols</b>(<i></i>) |
236 <b>__checkDeprecatedTypingSymbols</b>(<i></i>) |
239 |
|
240 <p> |
237 <p> |
241 Private method to check the use of deprecated 'typing' symbols. |
238 Private method to check the use of deprecated 'typing' symbols. |
242 </p> |
239 </p> |
|
240 |
243 <a NAME="AnnotationsChecker.__checkFunctionAnnotations" ID="AnnotationsChecker.__checkFunctionAnnotations"></a> |
241 <a NAME="AnnotationsChecker.__checkFunctionAnnotations" ID="AnnotationsChecker.__checkFunctionAnnotations"></a> |
244 <h4>AnnotationsChecker.__checkFunctionAnnotations</h4> |
242 <h4>AnnotationsChecker.__checkFunctionAnnotations</h4> |
245 <b>__checkFunctionAnnotations</b>(<i></i>) |
243 <b>__checkFunctionAnnotations</b>(<i></i>) |
246 |
|
247 <p> |
244 <p> |
248 Private method to check for function annotation issues. |
245 Private method to check for function annotation issues. |
249 </p> |
246 </p> |
|
247 |
250 <a NAME="AnnotationsChecker.__classifyError" ID="AnnotationsChecker.__classifyError"></a> |
248 <a NAME="AnnotationsChecker.__classifyError" ID="AnnotationsChecker.__classifyError"></a> |
251 <h4>AnnotationsChecker.__classifyError</h4> |
249 <h4>AnnotationsChecker.__classifyError</h4> |
252 <b>__classifyError</b>(<i>function, arg</i>) |
250 <b>__classifyError</b>(<i>function, arg</i>) |
253 |
|
254 <p> |
251 <p> |
255 Private method to classify the missing type annotation based on the |
252 Private method to classify the missing type annotation based on the |
256 Function & Argument metadata. |
253 Function & Argument metadata. |
257 </p> |
254 </p> |
258 <p> |
255 <p> |
276 </dd> |
274 </dd> |
277 </dl> |
275 </dl> |
278 <a NAME="AnnotationsChecker.__error" ID="AnnotationsChecker.__error"></a> |
276 <a NAME="AnnotationsChecker.__error" ID="AnnotationsChecker.__error"></a> |
279 <h4>AnnotationsChecker.__error</h4> |
277 <h4>AnnotationsChecker.__error</h4> |
280 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) |
278 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) |
281 |
|
282 <p> |
279 <p> |
283 Private method to record an issue. |
280 Private method to record an issue. |
284 </p> |
281 </p> |
|
282 |
285 <dl> |
283 <dl> |
286 |
284 |
287 <dt><i>lineNumber</i> (int)</dt> |
285 <dt><i>lineNumber</i> (int)</dt> |
288 <dd> |
286 <dd> |
289 line number of the issue |
287 line number of the issue |
302 </dd> |
300 </dd> |
303 </dl> |
301 </dl> |
304 <a NAME="AnnotationsChecker.__getAnnotationComplexity" ID="AnnotationsChecker.__getAnnotationComplexity"></a> |
302 <a NAME="AnnotationsChecker.__getAnnotationComplexity" ID="AnnotationsChecker.__getAnnotationComplexity"></a> |
305 <h4>AnnotationsChecker.__getAnnotationComplexity</h4> |
303 <h4>AnnotationsChecker.__getAnnotationComplexity</h4> |
306 <b>__getAnnotationComplexity</b>(<i>annotationNode, defaultComplexity=1</i>) |
304 <b>__getAnnotationComplexity</b>(<i>annotationNode, defaultComplexity=1</i>) |
307 |
|
308 <p> |
305 <p> |
309 Private method to determine the annotation complexity. |
306 Private method to determine the annotation complexity. |
310 </p> |
307 </p> |
|
308 |
311 <dl> |
309 <dl> |
312 |
310 |
313 <dt><i>annotationNode</i> (ast.AST)</dt> |
311 <dt><i>annotationNode</i> (ast.AST)</dt> |
314 <dd> |
312 <dd> |
315 reference to the node to determine the annotation |
313 reference to the node to determine the annotation |
412 </dd> |
410 </dd> |
413 </dl> |
411 </dl> |
414 <a NAME="AnnotationsChecker.__returnErrorClassifier" ID="AnnotationsChecker.__returnErrorClassifier"></a> |
412 <a NAME="AnnotationsChecker.__returnErrorClassifier" ID="AnnotationsChecker.__returnErrorClassifier"></a> |
415 <h4>AnnotationsChecker.__returnErrorClassifier</h4> |
413 <h4>AnnotationsChecker.__returnErrorClassifier</h4> |
416 <b>__returnErrorClassifier</b>(<i>isClassMethod, classDecoratorType, functionType</i>) |
414 <b>__returnErrorClassifier</b>(<i>isClassMethod, classDecoratorType, functionType</i>) |
417 |
|
418 <p> |
415 <p> |
419 Private method to classify a return type annotation issue. |
416 Private method to classify a return type annotation issue. |
420 </p> |
417 </p> |
|
418 |
421 <dl> |
419 <dl> |
422 |
420 |
423 <dt><i>isClassMethod</i> (bool)</dt> |
421 <dt><i>isClassMethod</i> (bool)</dt> |
424 <dd> |
422 <dd> |
425 flag indicating a classmethod type function |
423 flag indicating a classmethod type function |