|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DefaultMatchCaseVisitor</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.DefaultMatchCaseVisitor</h1> |
|
10 <p> |
|
11 Module implementing a node visitor to check default match cases. |
|
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="#DefaultMatchCaseVisitor">DefaultMatchCaseVisitor</a></td> |
|
23 <td>Class implementing a node visitor to check default match cases.</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="DefaultMatchCaseVisitor" ID="DefaultMatchCaseVisitor"></a> |
|
35 <h2>DefaultMatchCaseVisitor</h2> |
|
36 <p> |
|
37 Class implementing a node visitor to check default match cases. |
|
38 </p> |
|
39 <p> |
|
40 Note: This class is modeled after flake8-spm v0.0.1. |
|
41 </p> |
|
42 |
|
43 <h3>Derived from</h3> |
|
44 ast.NodeVisitor |
|
45 <h3>Class Attributes</h3> |
|
46 <table> |
|
47 <tr><td>None</td></tr> |
|
48 </table> |
|
49 |
|
50 <h3>Class Methods</h3> |
|
51 <table> |
|
52 <tr><td>None</td></tr> |
|
53 </table> |
|
54 |
|
55 <h3>Methods</h3> |
|
56 <table> |
|
57 <tr> |
|
58 <td><a href="#DefaultMatchCaseVisitor.__init__">DefaultMatchCaseVisitor</a></td> |
|
59 <td>Constructor</td> |
|
60 </tr> |
|
61 <tr> |
|
62 <td><a href="#DefaultMatchCaseVisitor.__badNodes">__badNodes</a></td> |
|
63 <td>Private method to yield bad match nodes.</td> |
|
64 </tr> |
|
65 <tr> |
|
66 <td><a href="#DefaultMatchCaseVisitor.__emptyMatchDefault">__emptyMatchDefault</a></td> |
|
67 <td>Private method to check for an empty default match case.</td> |
|
68 </tr> |
|
69 <tr> |
|
70 <td><a href="#DefaultMatchCaseVisitor.__findBadNode">__findBadNode</a></td> |
|
71 <td>Private method returning a reference to the bad node of a case node.</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#DefaultMatchCaseVisitor.__lastStatementDoesNotRaise">__lastStatementDoesNotRaise</a></td> |
|
75 <td>Private method to check that the last case statement does not raise an exception.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising">__returnPrecedesExceptionRaising</a></td> |
|
79 <td>Private method to check that no return precedes an exception raising.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#DefaultMatchCaseVisitor.visit_Match">visit_Match</a></td> |
|
83 <td>Public method to handle Match nodes.</td> |
|
84 </tr> |
|
85 </table> |
|
86 |
|
87 <h3>Static Methods</h3> |
|
88 <table> |
|
89 <tr><td>None</td></tr> |
|
90 </table> |
|
91 |
|
92 |
|
93 <a NAME="DefaultMatchCaseVisitor.__init__" ID="DefaultMatchCaseVisitor.__init__"></a> |
|
94 <h4>DefaultMatchCaseVisitor (Constructor)</h4> |
|
95 <b>DefaultMatchCaseVisitor</b>(<i></i>) |
|
96 <p> |
|
97 Constructor |
|
98 </p> |
|
99 |
|
100 <a NAME="DefaultMatchCaseVisitor.__badNodes" ID="DefaultMatchCaseVisitor.__badNodes"></a> |
|
101 <h4>DefaultMatchCaseVisitor.__badNodes</h4> |
|
102 <b>__badNodes</b>(<i>node</i>) |
|
103 <p> |
|
104 Private method to yield bad match nodes. |
|
105 </p> |
|
106 |
|
107 <dl> |
|
108 |
|
109 <dt><i>node</i> (ast.Match)</dt> |
|
110 <dd> |
|
111 reference to the node to be processed |
|
112 </dd> |
|
113 </dl> |
|
114 <dl> |
|
115 <dt>Yield:</dt> |
|
116 <dd> |
|
117 tuple containing a reference to bad match case node and the corresponding |
|
118 issue code |
|
119 </dd> |
|
120 </dl> |
|
121 <dl> |
|
122 <dt>Yield Type:</dt> |
|
123 <dd> |
|
124 tyuple of (ast.AST, str) |
|
125 </dd> |
|
126 </dl> |
|
127 <a NAME="DefaultMatchCaseVisitor.__emptyMatchDefault" ID="DefaultMatchCaseVisitor.__emptyMatchDefault"></a> |
|
128 <h4>DefaultMatchCaseVisitor.__emptyMatchDefault</h4> |
|
129 <b>__emptyMatchDefault</b>(<i>case</i>) |
|
130 <p> |
|
131 Private method to check for an empty default match case. |
|
132 </p> |
|
133 |
|
134 <dl> |
|
135 |
|
136 <dt><i>case</i> (ast.match_case)</dt> |
|
137 <dd> |
|
138 reference to the node to be processed |
|
139 </dd> |
|
140 </dl> |
|
141 <dl> |
|
142 <dt>Return:</dt> |
|
143 <dd> |
|
144 flag indicating an empty default match case |
|
145 </dd> |
|
146 </dl> |
|
147 <dl> |
|
148 <dt>Return Type:</dt> |
|
149 <dd> |
|
150 bool |
|
151 </dd> |
|
152 </dl> |
|
153 <a NAME="DefaultMatchCaseVisitor.__findBadNode" ID="DefaultMatchCaseVisitor.__findBadNode"></a> |
|
154 <h4>DefaultMatchCaseVisitor.__findBadNode</h4> |
|
155 <b>__findBadNode</b>(<i>case</i>) |
|
156 <p> |
|
157 Private method returning a reference to the bad node of a case node. |
|
158 </p> |
|
159 |
|
160 <dl> |
|
161 |
|
162 <dt><i>case</i> (ast.match_case)</dt> |
|
163 <dd> |
|
164 reference to the node to be processed |
|
165 </dd> |
|
166 </dl> |
|
167 <dl> |
|
168 <dt>Return:</dt> |
|
169 <dd> |
|
170 reference to the bad node |
|
171 </dd> |
|
172 </dl> |
|
173 <dl> |
|
174 <dt>Return Type:</dt> |
|
175 <dd> |
|
176 ast.AST |
|
177 </dd> |
|
178 </dl> |
|
179 <a NAME="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise" ID="DefaultMatchCaseVisitor.__lastStatementDoesNotRaise"></a> |
|
180 <h4>DefaultMatchCaseVisitor.__lastStatementDoesNotRaise</h4> |
|
181 <b>__lastStatementDoesNotRaise</b>(<i>case</i>) |
|
182 <p> |
|
183 Private method to check that the last case statement does not raise an |
|
184 exception. |
|
185 </p> |
|
186 |
|
187 <dl> |
|
188 |
|
189 <dt><i>case</i> (ast.match_case)</dt> |
|
190 <dd> |
|
191 reference to the node to be processed |
|
192 </dd> |
|
193 </dl> |
|
194 <dl> |
|
195 <dt>Return:</dt> |
|
196 <dd> |
|
197 flag indicating that the last case statement does not raise an |
|
198 exception |
|
199 </dd> |
|
200 </dl> |
|
201 <dl> |
|
202 <dt>Return Type:</dt> |
|
203 <dd> |
|
204 bool |
|
205 </dd> |
|
206 </dl> |
|
207 <a NAME="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising" ID="DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising"></a> |
|
208 <h4>DefaultMatchCaseVisitor.__returnPrecedesExceptionRaising</h4> |
|
209 <b>__returnPrecedesExceptionRaising</b>(<i>case</i>) |
|
210 <p> |
|
211 Private method to check that no return precedes an exception raising. |
|
212 </p> |
|
213 |
|
214 <dl> |
|
215 |
|
216 <dt><i>case</i> (ast.match_case)</dt> |
|
217 <dd> |
|
218 reference to the node to be processed |
|
219 </dd> |
|
220 </dl> |
|
221 <dl> |
|
222 <dt>Return:</dt> |
|
223 <dd> |
|
224 flag indicating that a return precedes an exception raising |
|
225 </dd> |
|
226 </dl> |
|
227 <dl> |
|
228 <dt>Return Type:</dt> |
|
229 <dd> |
|
230 bool |
|
231 </dd> |
|
232 </dl> |
|
233 <a NAME="DefaultMatchCaseVisitor.visit_Match" ID="DefaultMatchCaseVisitor.visit_Match"></a> |
|
234 <h4>DefaultMatchCaseVisitor.visit_Match</h4> |
|
235 <b>visit_Match</b>(<i>node</i>) |
|
236 <p> |
|
237 Public method to handle Match nodes. |
|
238 </p> |
|
239 |
|
240 <dl> |
|
241 |
|
242 <dt><i>node</i> (ast.Match)</dt> |
|
243 <dd> |
|
244 reference to the node to be processed |
|
245 </dd> |
|
246 </dl> |
|
247 <div align="right"><a href="#top">Up</a></div> |
|
248 <hr /> |
|
249 </body></html> |