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.AnnotationsFutureVisitor</h1> |
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsFutureVisitor</h1> |
10 |
|
11 <p> |
10 <p> |
12 Module implementing a node visitor for function type annotations. |
11 Module implementing a node visitor 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="#AnnotationsFutureVisitor">AnnotationsFutureVisitor</a></td> |
22 <td><a href="#AnnotationsFutureVisitor">AnnotationsFutureVisitor</a></td> |
25 <td>Class implementing a node visitor to check __future__ imports.</td> |
23 <td>Class implementing a node visitor to check __future__ imports.</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="AnnotationsFutureVisitor" ID="AnnotationsFutureVisitor"></a> |
34 <a NAME="AnnotationsFutureVisitor" ID="AnnotationsFutureVisitor"></a> |
36 <h2>AnnotationsFutureVisitor</h2> |
35 <h2>AnnotationsFutureVisitor</h2> |
37 |
|
38 <p> |
36 <p> |
39 Class implementing a node visitor to check __future__ imports. |
37 Class implementing a node visitor to check __future__ imports. |
40 </p> |
38 </p> |
|
39 |
41 <h3>Derived from</h3> |
40 <h3>Derived from</h3> |
42 ast.NodeVisitor |
41 ast.NodeVisitor |
43 <h3>Class Attributes</h3> |
42 <h3>Class Attributes</h3> |
44 |
43 <table> |
45 <table> |
44 <tr><td>SimplifiedTypes</td></tr> |
46 <tr><td>SimplifiedTypes</td></tr><tr><td>SimplifyableTypes</td></tr> |
45 <tr><td>SimplifyableTypes</td></tr> |
47 </table> |
46 </table> |
|
47 |
48 <h3>Class Methods</h3> |
48 <h3>Class Methods</h3> |
49 |
|
50 <table> |
49 <table> |
51 <tr><td>None</td></tr> |
50 <tr><td>None</td></tr> |
52 </table> |
51 </table> |
|
52 |
53 <h3>Methods</h3> |
53 <h3>Methods</h3> |
54 |
54 <table> |
55 <table> |
|
56 |
|
57 <tr> |
55 <tr> |
58 <td><a href="#AnnotationsFutureVisitor.__init__">AnnotationsFutureVisitor</a></td> |
56 <td><a href="#AnnotationsFutureVisitor.__init__">AnnotationsFutureVisitor</a></td> |
59 <td>Constructor</td> |
57 <td>Constructor</td> |
60 </tr> |
58 </tr> |
61 <tr> |
59 <tr> |
101 <tr> |
99 <tr> |
102 <td><a href="#AnnotationsFutureVisitor.visit_arg">visit_arg</a></td> |
100 <td><a href="#AnnotationsFutureVisitor.visit_arg">visit_arg</a></td> |
103 <td>Public method to check argument annotations.</td> |
101 <td>Public method to check argument annotations.</td> |
104 </tr> |
102 </tr> |
105 </table> |
103 </table> |
|
104 |
106 <h3>Static Methods</h3> |
105 <h3>Static Methods</h3> |
107 |
|
108 <table> |
106 <table> |
109 <tr><td>None</td></tr> |
107 <tr><td>None</td></tr> |
110 </table> |
108 </table> |
|
109 |
111 |
110 |
112 <a NAME="AnnotationsFutureVisitor.__init__" ID="AnnotationsFutureVisitor.__init__"></a> |
111 <a NAME="AnnotationsFutureVisitor.__init__" ID="AnnotationsFutureVisitor.__init__"></a> |
113 <h4>AnnotationsFutureVisitor (Constructor)</h4> |
112 <h4>AnnotationsFutureVisitor (Constructor)</h4> |
114 <b>AnnotationsFutureVisitor</b>(<i></i>) |
113 <b>AnnotationsFutureVisitor</b>(<i></i>) |
115 |
|
116 <p> |
114 <p> |
117 Constructor |
115 Constructor |
118 </p> |
116 </p> |
|
117 |
119 <a NAME="AnnotationsFutureVisitor.__processAnnotation" ID="AnnotationsFutureVisitor.__processAnnotation"></a> |
118 <a NAME="AnnotationsFutureVisitor.__processAnnotation" ID="AnnotationsFutureVisitor.__processAnnotation"></a> |
120 <h4>AnnotationsFutureVisitor.__processAnnotation</h4> |
119 <h4>AnnotationsFutureVisitor.__processAnnotation</h4> |
121 <b>__processAnnotation</b>(<i>node</i>) |
120 <b>__processAnnotation</b>(<i>node</i>) |
122 |
|
123 <p> |
121 <p> |
124 Private method to process the given annotations. |
122 Private method to process the given annotations. |
125 </p> |
123 </p> |
|
124 |
126 <dl> |
125 <dl> |
127 |
126 |
128 <dt><i>node</i> (ast.expr)</dt> |
127 <dt><i>node</i> (ast.expr)</dt> |
129 <dd> |
128 <dd> |
130 reference to the AST node containing the annotations |
129 reference to the AST node containing the annotations |
131 </dd> |
130 </dd> |
132 </dl> |
131 </dl> |
133 <a NAME="AnnotationsFutureVisitor.getSimplifiedTypes" ID="AnnotationsFutureVisitor.getSimplifiedTypes"></a> |
132 <a NAME="AnnotationsFutureVisitor.getSimplifiedTypes" ID="AnnotationsFutureVisitor.getSimplifiedTypes"></a> |
134 <h4>AnnotationsFutureVisitor.getSimplifiedTypes</h4> |
133 <h4>AnnotationsFutureVisitor.getSimplifiedTypes</h4> |
135 <b>getSimplifiedTypes</b>(<i></i>) |
134 <b>getSimplifiedTypes</b>(<i></i>) |
136 |
|
137 <p> |
135 <p> |
138 Public method Public method to get the list of detected simplified types. |
136 Public method Public method to get the list of detected simplified types. |
139 </p> |
137 </p> |
|
138 |
140 <dl> |
139 <dl> |
141 <dt>Return:</dt> |
140 <dt>Return:</dt> |
142 <dd> |
141 <dd> |
143 list of simplified types |
142 list of simplified types |
144 </dd> |
143 </dd> |
150 </dd> |
149 </dd> |
151 </dl> |
150 </dl> |
152 <a NAME="AnnotationsFutureVisitor.getTypingImports" ID="AnnotationsFutureVisitor.getTypingImports"></a> |
151 <a NAME="AnnotationsFutureVisitor.getTypingImports" ID="AnnotationsFutureVisitor.getTypingImports"></a> |
153 <h4>AnnotationsFutureVisitor.getTypingImports</h4> |
152 <h4>AnnotationsFutureVisitor.getTypingImports</h4> |
154 <b>getTypingImports</b>(<i></i>) |
153 <b>getTypingImports</b>(<i></i>) |
155 |
|
156 <p> |
154 <p> |
157 Public method to get the list of typing imports. |
155 Public method to get the list of typing imports. |
158 </p> |
156 </p> |
|
157 |
159 <dl> |
158 <dl> |
160 <dt>Return:</dt> |
159 <dt>Return:</dt> |
161 <dd> |
160 <dd> |
162 list of typing imports |
161 list of typing imports |
163 </dd> |
162 </dd> |
169 </dd> |
168 </dd> |
170 </dl> |
169 </dl> |
171 <a NAME="AnnotationsFutureVisitor.hasSimplifiedTypes" ID="AnnotationsFutureVisitor.hasSimplifiedTypes"></a> |
170 <a NAME="AnnotationsFutureVisitor.hasSimplifiedTypes" ID="AnnotationsFutureVisitor.hasSimplifiedTypes"></a> |
172 <h4>AnnotationsFutureVisitor.hasSimplifiedTypes</h4> |
171 <h4>AnnotationsFutureVisitor.hasSimplifiedTypes</h4> |
173 <b>hasSimplifiedTypes</b>(<i></i>) |
172 <b>hasSimplifiedTypes</b>(<i></i>) |
174 |
|
175 <p> |
173 <p> |
176 Public method to check, if the analyzed code includes annotations with |
174 Public method to check, if the analyzed code includes annotations with |
177 simplified types. |
175 simplified types. |
178 </p> |
176 </p> |
|
177 |
179 <dl> |
178 <dl> |
180 <dt>Return:</dt> |
179 <dt>Return:</dt> |
181 <dd> |
180 <dd> |
182 flag indicating the presence of simplified types |
181 flag indicating the presence of simplified types |
183 </dd> |
182 </dd> |
189 </dd> |
188 </dd> |
190 </dl> |
189 </dl> |
191 <a NAME="AnnotationsFutureVisitor.hasTypingImports" ID="AnnotationsFutureVisitor.hasTypingImports"></a> |
190 <a NAME="AnnotationsFutureVisitor.hasTypingImports" ID="AnnotationsFutureVisitor.hasTypingImports"></a> |
192 <h4>AnnotationsFutureVisitor.hasTypingImports</h4> |
191 <h4>AnnotationsFutureVisitor.hasTypingImports</h4> |
193 <b>hasTypingImports</b>(<i></i>) |
192 <b>hasTypingImports</b>(<i></i>) |
194 |
|
195 <p> |
193 <p> |
196 Public method to check, if the analyzed code includes typing imports. |
194 Public method to check, if the analyzed code includes typing imports. |
197 </p> |
195 </p> |
|
196 |
198 <dl> |
197 <dl> |
199 <dt>Return:</dt> |
198 <dt>Return:</dt> |
200 <dd> |
199 <dd> |
201 flag indicating the use of typing imports |
200 flag indicating the use of typing imports |
202 </dd> |
201 </dd> |
208 </dd> |
207 </dd> |
209 </dl> |
208 </dl> |
210 <a NAME="AnnotationsFutureVisitor.importsFutureAnnotations" ID="AnnotationsFutureVisitor.importsFutureAnnotations"></a> |
209 <a NAME="AnnotationsFutureVisitor.importsFutureAnnotations" ID="AnnotationsFutureVisitor.importsFutureAnnotations"></a> |
211 <h4>AnnotationsFutureVisitor.importsFutureAnnotations</h4> |
210 <h4>AnnotationsFutureVisitor.importsFutureAnnotations</h4> |
212 <b>importsFutureAnnotations</b>(<i></i>) |
211 <b>importsFutureAnnotations</b>(<i></i>) |
213 |
|
214 <p> |
212 <p> |
215 Public method to check, if the analyzed code uses future annotation. |
213 Public method to check, if the analyzed code uses future annotation. |
216 </p> |
214 </p> |
|
215 |
217 <dl> |
216 <dl> |
218 <dt>Return:</dt> |
217 <dt>Return:</dt> |
219 <dd> |
218 <dd> |
220 flag indicatung the use of future annotation |
219 flag indicatung the use of future annotation |
221 </dd> |
220 </dd> |
227 </dd> |
226 </dd> |
228 </dl> |
227 </dl> |
229 <a NAME="AnnotationsFutureVisitor.visit_AnnAssign" ID="AnnotationsFutureVisitor.visit_AnnAssign"></a> |
228 <a NAME="AnnotationsFutureVisitor.visit_AnnAssign" ID="AnnotationsFutureVisitor.visit_AnnAssign"></a> |
230 <h4>AnnotationsFutureVisitor.visit_AnnAssign</h4> |
229 <h4>AnnotationsFutureVisitor.visit_AnnAssign</h4> |
231 <b>visit_AnnAssign</b>(<i>node</i>) |
230 <b>visit_AnnAssign</b>(<i>node</i>) |
232 |
|
233 <p> |
231 <p> |
234 Public method to check type annotations. |
232 Public method to check type annotations. |
235 </p> |
233 </p> |
|
234 |
236 <dl> |
235 <dl> |
237 |
236 |
238 <dt><i>node</i> (ast.AnnAssign)</dt> |
237 <dt><i>node</i> (ast.AnnAssign)</dt> |
239 <dd> |
238 <dd> |
240 reference to the AST Assign node |
239 reference to the AST Assign node |
241 </dd> |
240 </dd> |
242 </dl> |
241 </dl> |
243 <a NAME="AnnotationsFutureVisitor.visit_Attribute" ID="AnnotationsFutureVisitor.visit_Attribute"></a> |
242 <a NAME="AnnotationsFutureVisitor.visit_Attribute" ID="AnnotationsFutureVisitor.visit_Attribute"></a> |
244 <h4>AnnotationsFutureVisitor.visit_Attribute</h4> |
243 <h4>AnnotationsFutureVisitor.visit_Attribute</h4> |
245 <b>visit_Attribute</b>(<i>node</i>) |
244 <b>visit_Attribute</b>(<i>node</i>) |
246 |
|
247 <p> |
245 <p> |
248 Public method to record simplifiable names. |
246 Public method to record simplifiable names. |
249 </p> |
247 </p> |
250 <p> |
248 <p> |
251 If 'import typing' or 'import typing as t' is used, add simplifiable |
249 If 'import typing' or 'import typing as t' is used, add simplifiable |
252 names that were used later on in the code. |
250 names that were used later on in the code. |
253 </p> |
251 </p> |
|
252 |
254 <dl> |
253 <dl> |
255 |
254 |
256 <dt><i>node</i> (ast.Attribute)</dt> |
255 <dt><i>node</i> (ast.Attribute)</dt> |
257 <dd> |
256 <dd> |
258 reference to the AST Attribute node |
257 reference to the AST Attribute node |
259 </dd> |
258 </dd> |
260 </dl> |
259 </dl> |
261 <a NAME="AnnotationsFutureVisitor.visit_Import" ID="AnnotationsFutureVisitor.visit_Import"></a> |
260 <a NAME="AnnotationsFutureVisitor.visit_Import" ID="AnnotationsFutureVisitor.visit_Import"></a> |
262 <h4>AnnotationsFutureVisitor.visit_Import</h4> |
261 <h4>AnnotationsFutureVisitor.visit_Import</h4> |
263 <b>visit_Import</b>(<i>node</i>) |
262 <b>visit_Import</b>(<i>node</i>) |
264 |
|
265 <p> |
263 <p> |
266 Public method to check imports for typing related stuff. |
264 Public method to check imports for typing related stuff. |
267 </p> |
265 </p> |
268 <p> |
266 <p> |
269 This looks like: |
267 This looks like: |
272 import typing as t |
270 import typing as t |
273 </p> |
271 </p> |
274 <p> |
272 <p> |
275 typing or t will be added to the list of typing aliases. |
273 typing or t will be added to the list of typing aliases. |
276 </p> |
274 </p> |
|
275 |
277 <dl> |
276 <dl> |
278 |
277 |
279 <dt><i>node</i> (ast.Import)</dt> |
278 <dt><i>node</i> (ast.Import)</dt> |
280 <dd> |
279 <dd> |
281 reference to the AST Import node |
280 reference to the AST Import node |
282 </dd> |
281 </dd> |
283 </dl> |
282 </dl> |
284 <a NAME="AnnotationsFutureVisitor.visit_ImportFrom" ID="AnnotationsFutureVisitor.visit_ImportFrom"></a> |
283 <a NAME="AnnotationsFutureVisitor.visit_ImportFrom" ID="AnnotationsFutureVisitor.visit_ImportFrom"></a> |
285 <h4>AnnotationsFutureVisitor.visit_ImportFrom</h4> |
284 <h4>AnnotationsFutureVisitor.visit_ImportFrom</h4> |
286 <b>visit_ImportFrom</b>(<i>node</i>) |
285 <b>visit_ImportFrom</b>(<i>node</i>) |
287 |
|
288 <p> |
286 <p> |
289 Public method to detect the 'from __future__ import annotations' |
287 Public method to detect the 'from __future__ import annotations' |
290 import if present. |
288 import if present. |
291 </p> |
289 </p> |
292 <p> |
290 <p> |
293 If 'from typing import ...' is used, add simplifiable names that were |
291 If 'from typing import ...' is used, add simplifiable names that were |
294 imported. |
292 imported. |
295 </p> |
293 </p> |
|
294 |
296 <dl> |
295 <dl> |
297 |
296 |
298 <dt><i>node</i> (ast.ImportFrom)</dt> |
297 <dt><i>node</i> (ast.ImportFrom)</dt> |
299 <dd> |
298 <dd> |
300 reference to the AST ImportFrom node |
299 reference to the AST ImportFrom node |
301 </dd> |
300 </dd> |
302 </dl> |
301 </dl> |
303 <a NAME="AnnotationsFutureVisitor.visit_arg" ID="AnnotationsFutureVisitor.visit_arg"></a> |
302 <a NAME="AnnotationsFutureVisitor.visit_arg" ID="AnnotationsFutureVisitor.visit_arg"></a> |
304 <h4>AnnotationsFutureVisitor.visit_arg</h4> |
303 <h4>AnnotationsFutureVisitor.visit_arg</h4> |
305 <b>visit_arg</b>(<i>node: ast.arg</i>) |
304 <b>visit_arg</b>(<i>node: ast.arg</i>) |
306 |
|
307 <p> |
305 <p> |
308 Public method to check argument annotations. |
306 Public method to check argument annotations. |
309 </p> |
307 </p> |
|
308 |
310 <dl> |
309 <dl> |
311 |
310 |
312 <dt><i>node</i> (ast.arg)</dt> |
311 <dt><i>node</i> (ast.arg)</dt> |
313 <dd> |
312 <dd> |
314 reference to the AST argument node |
313 reference to the AST argument node |