|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.TextVisitor</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.Miscellaneous.TextVisitor</h1> |
|
10 <p> |
|
11 Module implementing a node visitor for bytes and str instances. |
|
12 </p> |
|
13 |
|
14 <h3>Global Attributes</h3> |
|
15 <table> |
|
16 <tr><td>None</td></tr> |
|
17 </table> |
|
18 |
|
19 <h3>Classes</h3> |
|
20 <table> |
|
21 <tr> |
|
22 <td><a href="#TextVisitor">TextVisitor</a></td> |
|
23 <td>Class implementing a node visitor for bytes and str instances.</td> |
|
24 </tr> |
|
25 </table> |
|
26 |
|
27 <h3>Functions</h3> |
|
28 <table> |
|
29 <tr><td>None</td></tr> |
|
30 </table> |
|
31 |
|
32 <hr /> |
|
33 <hr /> |
|
34 <a NAME="TextVisitor" ID="TextVisitor"></a> |
|
35 <h2>TextVisitor</h2> |
|
36 <p> |
|
37 Class implementing a node visitor for bytes and str instances. |
|
38 </p> |
|
39 <p> |
|
40 It tries to detect docstrings as string of the first expression of each |
|
41 module, class or function. |
|
42 </p> |
|
43 |
|
44 <h3>Derived from</h3> |
|
45 ast.NodeVisitor |
|
46 <h3>Class Attributes</h3> |
|
47 <table> |
|
48 <tr><td>None</td></tr> |
|
49 </table> |
|
50 |
|
51 <h3>Class Methods</h3> |
|
52 <table> |
|
53 <tr><td>None</td></tr> |
|
54 </table> |
|
55 |
|
56 <h3>Methods</h3> |
|
57 <table> |
|
58 <tr> |
|
59 <td><a href="#TextVisitor.__init__">TextVisitor</a></td> |
|
60 <td>Constructor</td> |
|
61 </tr> |
|
62 <tr> |
|
63 <td><a href="#TextVisitor.__addNode">__addNode</a></td> |
|
64 <td>Private method to add a node to our list of nodes.</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#TextVisitor.__visitBody">__visitBody</a></td> |
|
68 <td>Private method to traverse the body of the node manually.</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#TextVisitor.__visitDefinition">__visitDefinition</a></td> |
|
72 <td>Private method handling class and function definitions.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#TextVisitor.visit_AsyncFunctionDef">visit_AsyncFunctionDef</a></td> |
|
76 <td>Public method to handle an asynchronous function definition.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#TextVisitor.visit_Call">visit_Call</a></td> |
|
80 <td>Public method to handle a function call.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#TextVisitor.visit_ClassDef">visit_ClassDef</a></td> |
|
84 <td>Public method to handle a class definition.</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#TextVisitor.visit_Constant">visit_Constant</a></td> |
|
88 <td>Public method to handle constant nodes.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#TextVisitor.visit_FunctionDef">visit_FunctionDef</a></td> |
|
92 <td>Public method to handle a function definition.</td> |
|
93 </tr> |
|
94 <tr> |
|
95 <td><a href="#TextVisitor.visit_Module">visit_Module</a></td> |
|
96 <td>Public method to handle a module.</td> |
|
97 </tr> |
|
98 </table> |
|
99 |
|
100 <h3>Static Methods</h3> |
|
101 <table> |
|
102 <tr><td>None</td></tr> |
|
103 </table> |
|
104 |
|
105 |
|
106 <a NAME="TextVisitor.__init__" ID="TextVisitor.__init__"></a> |
|
107 <h4>TextVisitor (Constructor)</h4> |
|
108 <b>TextVisitor</b>(<i></i>) |
|
109 <p> |
|
110 Constructor |
|
111 </p> |
|
112 |
|
113 <a NAME="TextVisitor.__addNode" ID="TextVisitor.__addNode"></a> |
|
114 <h4>TextVisitor.__addNode</h4> |
|
115 <b>__addNode</b>(<i>node</i>) |
|
116 <p> |
|
117 Private method to add a node to our list of nodes. |
|
118 </p> |
|
119 |
|
120 <dl> |
|
121 |
|
122 <dt><i>node</i> (ast.AST)</dt> |
|
123 <dd> |
|
124 reference to the node to add |
|
125 </dd> |
|
126 </dl> |
|
127 <a NAME="TextVisitor.__visitBody" ID="TextVisitor.__visitBody"></a> |
|
128 <h4>TextVisitor.__visitBody</h4> |
|
129 <b>__visitBody</b>(<i>node</i>) |
|
130 <p> |
|
131 Private method to traverse the body of the node manually. |
|
132 </p> |
|
133 <p> |
|
134 If the first node is an expression which contains a string or bytes it |
|
135 marks that as a docstring. |
|
136 </p> |
|
137 |
|
138 <dl> |
|
139 |
|
140 <dt><i>node</i> (ast.AST)</dt> |
|
141 <dd> |
|
142 reference to the node to traverse |
|
143 </dd> |
|
144 </dl> |
|
145 <a NAME="TextVisitor.__visitDefinition" ID="TextVisitor.__visitDefinition"></a> |
|
146 <h4>TextVisitor.__visitDefinition</h4> |
|
147 <b>__visitDefinition</b>(<i>node</i>) |
|
148 <p> |
|
149 Private method handling class and function definitions. |
|
150 </p> |
|
151 |
|
152 <dl> |
|
153 |
|
154 <dt><i>node</i> (ast.FunctionDef, ast.AsyncFunctionDef or ast.ClassDef)</dt> |
|
155 <dd> |
|
156 reference to the node to handle |
|
157 </dd> |
|
158 </dl> |
|
159 <a NAME="TextVisitor.visit_AsyncFunctionDef" ID="TextVisitor.visit_AsyncFunctionDef"></a> |
|
160 <h4>TextVisitor.visit_AsyncFunctionDef</h4> |
|
161 <b>visit_AsyncFunctionDef</b>(<i>node</i>) |
|
162 <p> |
|
163 Public method to handle an asynchronous function definition. |
|
164 </p> |
|
165 |
|
166 <dl> |
|
167 |
|
168 <dt><i>node</i> (ast.AsyncFunctionDef)</dt> |
|
169 <dd> |
|
170 reference to the node to handle |
|
171 </dd> |
|
172 </dl> |
|
173 <a NAME="TextVisitor.visit_Call" ID="TextVisitor.visit_Call"></a> |
|
174 <h4>TextVisitor.visit_Call</h4> |
|
175 <b>visit_Call</b>(<i>node</i>) |
|
176 <p> |
|
177 Public method to handle a function call. |
|
178 </p> |
|
179 |
|
180 <dl> |
|
181 |
|
182 <dt><i>node</i> (ast.Call)</dt> |
|
183 <dd> |
|
184 reference to the node to handle |
|
185 </dd> |
|
186 </dl> |
|
187 <a NAME="TextVisitor.visit_ClassDef" ID="TextVisitor.visit_ClassDef"></a> |
|
188 <h4>TextVisitor.visit_ClassDef</h4> |
|
189 <b>visit_ClassDef</b>(<i>node</i>) |
|
190 <p> |
|
191 Public method to handle a class definition. |
|
192 </p> |
|
193 |
|
194 <dl> |
|
195 |
|
196 <dt><i>node</i> (ast.ClassDef)</dt> |
|
197 <dd> |
|
198 reference to the node to handle |
|
199 </dd> |
|
200 </dl> |
|
201 <a NAME="TextVisitor.visit_Constant" ID="TextVisitor.visit_Constant"></a> |
|
202 <h4>TextVisitor.visit_Constant</h4> |
|
203 <b>visit_Constant</b>(<i>node</i>) |
|
204 <p> |
|
205 Public method to handle constant nodes. |
|
206 </p> |
|
207 |
|
208 <dl> |
|
209 |
|
210 <dt><i>node</i> (ast.Constant)</dt> |
|
211 <dd> |
|
212 reference to the bytes node |
|
213 </dd> |
|
214 </dl> |
|
215 <a NAME="TextVisitor.visit_FunctionDef" ID="TextVisitor.visit_FunctionDef"></a> |
|
216 <h4>TextVisitor.visit_FunctionDef</h4> |
|
217 <b>visit_FunctionDef</b>(<i>node</i>) |
|
218 <p> |
|
219 Public method to handle a function definition. |
|
220 </p> |
|
221 |
|
222 <dl> |
|
223 |
|
224 <dt><i>node</i> (ast.FunctionDef)</dt> |
|
225 <dd> |
|
226 reference to the node to handle |
|
227 </dd> |
|
228 </dl> |
|
229 <a NAME="TextVisitor.visit_Module" ID="TextVisitor.visit_Module"></a> |
|
230 <h4>TextVisitor.visit_Module</h4> |
|
231 <b>visit_Module</b>(<i>node</i>) |
|
232 <p> |
|
233 Public method to handle a module. |
|
234 </p> |
|
235 |
|
236 <dl> |
|
237 |
|
238 <dt><i>node</i> (ast.Module)</dt> |
|
239 <dd> |
|
240 reference to the node to handle |
|
241 </dd> |
|
242 </dl> |
|
243 <div align="right"><a href="#top">Up</a></div> |
|
244 <hr /> |
|
245 </body></html> |