|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsDeprecationsVisitor</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Annotations.AnnotationsDeprecationsVisitor</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a node visitor for checking the use of deprecated 'typing' symbols. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>None</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#AnnotationsDeprecationsVisitor">AnnotationsDeprecationsVisitor</a></td> |
|
25 <td>Class implementing a node visitor for checking the use of deprecated 'typing' symbols.</td> |
|
26 </tr> |
|
27 <tr> |
|
28 <td><a href="#AnnotationsFutureImportVisitor">AnnotationsFutureImportVisitor</a></td> |
|
29 <td>Class implementing a node visitor to dtermine, if the annotations __future__ import is present.</td> |
|
30 </tr> |
|
31 </table> |
|
32 <h3>Functions</h3> |
|
33 |
|
34 <table> |
|
35 <tr><td>None</td></tr> |
|
36 </table> |
|
37 <hr /> |
|
38 <hr /> |
|
39 <a NAME="AnnotationsDeprecationsVisitor" ID="AnnotationsDeprecationsVisitor"></a> |
|
40 <h2>AnnotationsDeprecationsVisitor</h2> |
|
41 |
|
42 <p> |
|
43 Class implementing a node visitor for checking the use of deprecated 'typing' |
|
44 symbols. |
|
45 </p> |
|
46 <h3>Derived from</h3> |
|
47 ast.NodeVisitor |
|
48 <h3>Class Attributes</h3> |
|
49 |
|
50 <table> |
|
51 <tr><td>NameReplacements</td></tr><tr><td>visit_AsyncFunctionDef</td></tr> |
|
52 </table> |
|
53 <h3>Class Methods</h3> |
|
54 |
|
55 <table> |
|
56 <tr><td>None</td></tr> |
|
57 </table> |
|
58 <h3>Methods</h3> |
|
59 |
|
60 <table> |
|
61 |
|
62 <tr> |
|
63 <td><a href="#AnnotationsDeprecationsVisitor.__init__">AnnotationsDeprecationsVisitor</a></td> |
|
64 <td>Constructor</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#AnnotationsDeprecationsVisitor.__checkDeprecation">__checkDeprecation</a></td> |
|
68 <td>Private method to check, if the given name is deprecated.</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#AnnotationsDeprecationsVisitor.getIssues">getIssues</a></td> |
|
72 <td>Public method to get the list of detected issues.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#AnnotationsDeprecationsVisitor.visit_AnnAssign">visit_AnnAssign</a></td> |
|
76 <td>Public method to handle an ast.AnnAssign node.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#AnnotationsDeprecationsVisitor.visit_Attribute">visit_Attribute</a></td> |
|
80 <td>Public method to handle an ast.Attribute node.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#AnnotationsDeprecationsVisitor.visit_FunctionDef">visit_FunctionDef</a></td> |
|
84 <td>Public method to handle an ast.FunctionDef or ast.AsyncFunctionDef node.</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#AnnotationsDeprecationsVisitor.visit_Import">visit_Import</a></td> |
|
88 <td>Public method to handle an ast.Import node.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#AnnotationsDeprecationsVisitor.visit_ImportFrom">visit_ImportFrom</a></td> |
|
92 <td>Public method to handle an ast.ImportFrom node.</td> |
|
93 </tr> |
|
94 </table> |
|
95 <h3>Static Methods</h3> |
|
96 |
|
97 <table> |
|
98 <tr><td>None</td></tr> |
|
99 </table> |
|
100 |
|
101 <a NAME="AnnotationsDeprecationsVisitor.__init__" ID="AnnotationsDeprecationsVisitor.__init__"></a> |
|
102 <h4>AnnotationsDeprecationsVisitor (Constructor)</h4> |
|
103 <b>AnnotationsDeprecationsVisitor</b>(<i>exemptedList</i>) |
|
104 |
|
105 <p> |
|
106 Constructor |
|
107 </p> |
|
108 <dl> |
|
109 |
|
110 <dt><i>exemptedList</i> (list of str)</dt> |
|
111 <dd> |
|
112 list of typing symbols exempted from checking |
|
113 </dd> |
|
114 </dl> |
|
115 <a NAME="AnnotationsDeprecationsVisitor.__checkDeprecation" ID="AnnotationsDeprecationsVisitor.__checkDeprecation"></a> |
|
116 <h4>AnnotationsDeprecationsVisitor.__checkDeprecation</h4> |
|
117 <b>__checkDeprecation</b>(<i>node, name</i>) |
|
118 |
|
119 <p> |
|
120 Private method to check, if the given name is deprecated. |
|
121 </p> |
|
122 <dl> |
|
123 |
|
124 <dt><i>node</i> (ast.ImportFrom, ast.Attribute)</dt> |
|
125 <dd> |
|
126 reference to the node |
|
127 </dd> |
|
128 <dt><i>name</i> (str)</dt> |
|
129 <dd> |
|
130 name to be checked |
|
131 </dd> |
|
132 </dl> |
|
133 <a NAME="AnnotationsDeprecationsVisitor.getIssues" ID="AnnotationsDeprecationsVisitor.getIssues"></a> |
|
134 <h4>AnnotationsDeprecationsVisitor.getIssues</h4> |
|
135 <b>getIssues</b>(<i></i>) |
|
136 |
|
137 <p> |
|
138 Public method to get the list of detected issues. |
|
139 </p> |
|
140 <dl> |
|
141 <dt>Return:</dt> |
|
142 <dd> |
|
143 list of detected issues consisting of a tuple of a reference to the node |
|
144 and a tuple containing the used name and the suggested replacement |
|
145 </dd> |
|
146 </dl> |
|
147 <dl> |
|
148 <dt>Return Type:</dt> |
|
149 <dd> |
|
150 list of tuples of (ast.AST, (str, str)) |
|
151 </dd> |
|
152 </dl> |
|
153 <a NAME="AnnotationsDeprecationsVisitor.visit_AnnAssign" ID="AnnotationsDeprecationsVisitor.visit_AnnAssign"></a> |
|
154 <h4>AnnotationsDeprecationsVisitor.visit_AnnAssign</h4> |
|
155 <b>visit_AnnAssign</b>(<i>node</i>) |
|
156 |
|
157 <p> |
|
158 Public method to handle an ast.AnnAssign node. |
|
159 </p> |
|
160 <dl> |
|
161 |
|
162 <dt><i>node</i> (ast.AnnAssign)</dt> |
|
163 <dd> |
|
164 reference to the node to be handled |
|
165 </dd> |
|
166 </dl> |
|
167 <a NAME="AnnotationsDeprecationsVisitor.visit_Attribute" ID="AnnotationsDeprecationsVisitor.visit_Attribute"></a> |
|
168 <h4>AnnotationsDeprecationsVisitor.visit_Attribute</h4> |
|
169 <b>visit_Attribute</b>(<i>node</i>) |
|
170 |
|
171 <p> |
|
172 Public method to handle an ast.Attribute node. |
|
173 </p> |
|
174 <dl> |
|
175 |
|
176 <dt><i>node</i> (ast.Attribute)</dt> |
|
177 <dd> |
|
178 reference to the node to be handled |
|
179 </dd> |
|
180 </dl> |
|
181 <a NAME="AnnotationsDeprecationsVisitor.visit_FunctionDef" ID="AnnotationsDeprecationsVisitor.visit_FunctionDef"></a> |
|
182 <h4>AnnotationsDeprecationsVisitor.visit_FunctionDef</h4> |
|
183 <b>visit_FunctionDef</b>(<i>node</i>) |
|
184 |
|
185 <p> |
|
186 Public method to handle an ast.FunctionDef or ast.AsyncFunctionDef node. |
|
187 </p> |
|
188 <dl> |
|
189 |
|
190 <dt><i>node</i> (ast.FunctionDef or ast.AsyncFunctionDef)</dt> |
|
191 <dd> |
|
192 reference to the node to be handled |
|
193 </dd> |
|
194 </dl> |
|
195 <a NAME="AnnotationsDeprecationsVisitor.visit_Import" ID="AnnotationsDeprecationsVisitor.visit_Import"></a> |
|
196 <h4>AnnotationsDeprecationsVisitor.visit_Import</h4> |
|
197 <b>visit_Import</b>(<i>node</i>) |
|
198 |
|
199 <p> |
|
200 Public method to handle an ast.Import node. |
|
201 </p> |
|
202 <dl> |
|
203 |
|
204 <dt><i>node</i> (ast.Import)</dt> |
|
205 <dd> |
|
206 reference to the node to be handled |
|
207 </dd> |
|
208 </dl> |
|
209 <a NAME="AnnotationsDeprecationsVisitor.visit_ImportFrom" ID="AnnotationsDeprecationsVisitor.visit_ImportFrom"></a> |
|
210 <h4>AnnotationsDeprecationsVisitor.visit_ImportFrom</h4> |
|
211 <b>visit_ImportFrom</b>(<i>node</i>) |
|
212 |
|
213 <p> |
|
214 Public method to handle an ast.ImportFrom node. |
|
215 </p> |
|
216 <dl> |
|
217 |
|
218 <dt><i>node</i> (ast.ImportFrom)</dt> |
|
219 <dd> |
|
220 reference to the node to be handled |
|
221 </dd> |
|
222 </dl> |
|
223 <div align="right"><a href="#top">Up</a></div> |
|
224 <hr /> |
|
225 <hr /> |
|
226 <a NAME="AnnotationsFutureImportVisitor" ID="AnnotationsFutureImportVisitor"></a> |
|
227 <h2>AnnotationsFutureImportVisitor</h2> |
|
228 |
|
229 <p> |
|
230 Class implementing a node visitor to dtermine, if the annotations __future__ |
|
231 import is present. |
|
232 </p> |
|
233 <p> |
|
234 This class is used to determine usage of annotations for Python 3.8. |
|
235 </p> |
|
236 <h3>Derived from</h3> |
|
237 ast.NodeVisitor |
|
238 <h3>Class Attributes</h3> |
|
239 |
|
240 <table> |
|
241 <tr><td>None</td></tr> |
|
242 </table> |
|
243 <h3>Class Methods</h3> |
|
244 |
|
245 <table> |
|
246 <tr><td>None</td></tr> |
|
247 </table> |
|
248 <h3>Methods</h3> |
|
249 |
|
250 <table> |
|
251 |
|
252 <tr> |
|
253 <td><a href="#AnnotationsFutureImportVisitor.__init__">AnnotationsFutureImportVisitor</a></td> |
|
254 <td>Constructor</td> |
|
255 </tr> |
|
256 <tr> |
|
257 <td><a href="#AnnotationsFutureImportVisitor.futureImportPresent">futureImportPresent</a></td> |
|
258 <td>Public method to check, if a 'from __future__ import annotations' statement exists.</td> |
|
259 </tr> |
|
260 <tr> |
|
261 <td><a href="#AnnotationsFutureImportVisitor.visit_ImportFrom">visit_ImportFrom</a></td> |
|
262 <td>Public method to handle an ast.ImportFrom node.</td> |
|
263 </tr> |
|
264 </table> |
|
265 <h3>Static Methods</h3> |
|
266 |
|
267 <table> |
|
268 <tr><td>None</td></tr> |
|
269 </table> |
|
270 |
|
271 <a NAME="AnnotationsFutureImportVisitor.__init__" ID="AnnotationsFutureImportVisitor.__init__"></a> |
|
272 <h4>AnnotationsFutureImportVisitor (Constructor)</h4> |
|
273 <b>AnnotationsFutureImportVisitor</b>(<i></i>) |
|
274 |
|
275 <p> |
|
276 Constructor |
|
277 </p> |
|
278 <a NAME="AnnotationsFutureImportVisitor.futureImportPresent" ID="AnnotationsFutureImportVisitor.futureImportPresent"></a> |
|
279 <h4>AnnotationsFutureImportVisitor.futureImportPresent</h4> |
|
280 <b>futureImportPresent</b>(<i></i>) |
|
281 |
|
282 <p> |
|
283 Public method to check, if a 'from __future__ import annotations' statement |
|
284 exists. |
|
285 </p> |
|
286 <dl> |
|
287 <dt>Return:</dt> |
|
288 <dd> |
|
289 flag indicating the existence of the import statement |
|
290 </dd> |
|
291 </dl> |
|
292 <dl> |
|
293 <dt>Return Type:</dt> |
|
294 <dd> |
|
295 bool |
|
296 </dd> |
|
297 </dl> |
|
298 <a NAME="AnnotationsFutureImportVisitor.visit_ImportFrom" ID="AnnotationsFutureImportVisitor.visit_ImportFrom"></a> |
|
299 <h4>AnnotationsFutureImportVisitor.visit_ImportFrom</h4> |
|
300 <b>visit_ImportFrom</b>(<i>node</i>) |
|
301 |
|
302 <p> |
|
303 Public method to handle an ast.ImportFrom node. |
|
304 </p> |
|
305 <dl> |
|
306 |
|
307 <dt><i>node</i> (ast.ImportFrom)</dt> |
|
308 <dd> |
|
309 reference to the node to be handled |
|
310 </dd> |
|
311 </dl> |
|
312 <div align="right"><a href="#top">Up</a></div> |
|
313 <hr /> |
|
314 </body></html> |