|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body> |
|
22 <a NAME="top" ID="top"></a> |
|
23 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.Simplify.SimplifyChecker</h1> |
|
24 |
|
25 <p> |
|
26 Module implementing the checker for simplifying Python code. |
|
27 </p> |
|
28 <h3>Global Attributes</h3> |
|
29 |
|
30 <table> |
|
31 <tr><td>None</td></tr> |
|
32 </table> |
|
33 <h3>Classes</h3> |
|
34 |
|
35 <table> |
|
36 |
|
37 <tr> |
|
38 <td><a href="#SimplifyChecker">SimplifyChecker</a></td> |
|
39 <td>Class implementing a checker for to help simplifying Python code.</td> |
|
40 </tr> |
|
41 </table> |
|
42 <h3>Functions</h3> |
|
43 |
|
44 <table> |
|
45 <tr><td>None</td></tr> |
|
46 </table> |
|
47 <hr /> |
|
48 <hr /> |
|
49 <a NAME="SimplifyChecker" ID="SimplifyChecker"></a> |
|
50 <h2>SimplifyChecker</h2> |
|
51 |
|
52 <p> |
|
53 Class implementing a checker for to help simplifying Python code. |
|
54 </p> |
|
55 <h3>Derived from</h3> |
|
56 object |
|
57 <h3>Class Attributes</h3> |
|
58 |
|
59 <table> |
|
60 <tr><td>Codes</td></tr> |
|
61 </table> |
|
62 <h3>Class Methods</h3> |
|
63 |
|
64 <table> |
|
65 <tr><td>None</td></tr> |
|
66 </table> |
|
67 <h3>Methods</h3> |
|
68 |
|
69 <table> |
|
70 |
|
71 <tr> |
|
72 <td><a href="#SimplifyChecker.__init__">SimplifyChecker</a></td> |
|
73 <td>Constructor</td> |
|
74 </tr> |
|
75 <tr> |
|
76 <td><a href="#SimplifyChecker.__error">__error</a></td> |
|
77 <td>Private method to record an issue.</td> |
|
78 </tr> |
|
79 <tr> |
|
80 <td><a href="#SimplifyChecker.__generateTree">__generateTree</a></td> |
|
81 <td>Private method to generate an AST for our source.</td> |
|
82 </tr> |
|
83 <tr> |
|
84 <td><a href="#SimplifyChecker.__ignoreCode">__ignoreCode</a></td> |
|
85 <td>Private method to check if the message code should be ignored.</td> |
|
86 </tr> |
|
87 <tr> |
|
88 <td><a href="#SimplifyChecker.__reportInvalidSyntax">__reportInvalidSyntax</a></td> |
|
89 <td>Private method to report a syntax error.</td> |
|
90 </tr> |
|
91 <tr> |
|
92 <td><a href="#SimplifyChecker.run">run</a></td> |
|
93 <td>Public method to check the given source against functions to be replaced by 'pathlib' equivalents.</td> |
|
94 </tr> |
|
95 </table> |
|
96 <h3>Static Methods</h3> |
|
97 |
|
98 <table> |
|
99 <tr><td>None</td></tr> |
|
100 </table> |
|
101 |
|
102 <a NAME="SimplifyChecker.__init__" ID="SimplifyChecker.__init__"></a> |
|
103 <h4>SimplifyChecker (Constructor)</h4> |
|
104 <b>SimplifyChecker</b>(<i>source, filename, selected, ignored, expected, repeat</i>) |
|
105 |
|
106 <p> |
|
107 Constructor |
|
108 </p> |
|
109 <dl> |
|
110 |
|
111 <dt><i>source</i> (list of str)</dt> |
|
112 <dd> |
|
113 source code to be checked |
|
114 </dd> |
|
115 <dt><i>filename</i> (str)</dt> |
|
116 <dd> |
|
117 name of the source file |
|
118 </dd> |
|
119 <dt><i>selected</i> (list of str)</dt> |
|
120 <dd> |
|
121 list of selected codes |
|
122 </dd> |
|
123 <dt><i>ignored</i> (list of str)</dt> |
|
124 <dd> |
|
125 list of codes to be ignored |
|
126 </dd> |
|
127 <dt><i>expected</i> (list of str)</dt> |
|
128 <dd> |
|
129 list of expected codes |
|
130 </dd> |
|
131 <dt><i>repeat</i> (bool)</dt> |
|
132 <dd> |
|
133 flag indicating to report each occurrence of a code |
|
134 </dd> |
|
135 </dl> |
|
136 <a NAME="SimplifyChecker.__error" ID="SimplifyChecker.__error"></a> |
|
137 <h4>SimplifyChecker.__error</h4> |
|
138 <b>__error</b>(<i>lineNumber, offset, code, *args</i>) |
|
139 |
|
140 <p> |
|
141 Private method to record an issue. |
|
142 </p> |
|
143 <dl> |
|
144 |
|
145 <dt><i>lineNumber</i> (int)</dt> |
|
146 <dd> |
|
147 line number of the issue |
|
148 </dd> |
|
149 <dt><i>offset</i> (int)</dt> |
|
150 <dd> |
|
151 position within line of the issue |
|
152 </dd> |
|
153 <dt><i>code</i> (str)</dt> |
|
154 <dd> |
|
155 message code |
|
156 </dd> |
|
157 <dt><i>args</i> (list)</dt> |
|
158 <dd> |
|
159 arguments for the message |
|
160 </dd> |
|
161 </dl> |
|
162 <a NAME="SimplifyChecker.__generateTree" ID="SimplifyChecker.__generateTree"></a> |
|
163 <h4>SimplifyChecker.__generateTree</h4> |
|
164 <b>__generateTree</b>(<i></i>) |
|
165 |
|
166 <p> |
|
167 Private method to generate an AST for our source. |
|
168 </p> |
|
169 <dl> |
|
170 <dt>Return:</dt> |
|
171 <dd> |
|
172 generated AST |
|
173 </dd> |
|
174 </dl> |
|
175 <dl> |
|
176 <dt>Return Type:</dt> |
|
177 <dd> |
|
178 ast.AST |
|
179 </dd> |
|
180 </dl> |
|
181 <a NAME="SimplifyChecker.__ignoreCode" ID="SimplifyChecker.__ignoreCode"></a> |
|
182 <h4>SimplifyChecker.__ignoreCode</h4> |
|
183 <b>__ignoreCode</b>(<i>code</i>) |
|
184 |
|
185 <p> |
|
186 Private method to check if the message code should be ignored. |
|
187 </p> |
|
188 <dl> |
|
189 |
|
190 <dt><i>code</i> (str)</dt> |
|
191 <dd> |
|
192 message code to check for |
|
193 </dd> |
|
194 </dl> |
|
195 <dl> |
|
196 <dt>Return:</dt> |
|
197 <dd> |
|
198 flag indicating to ignore the given code |
|
199 </dd> |
|
200 </dl> |
|
201 <dl> |
|
202 <dt>Return Type:</dt> |
|
203 <dd> |
|
204 bool |
|
205 </dd> |
|
206 </dl> |
|
207 <a NAME="SimplifyChecker.__reportInvalidSyntax" ID="SimplifyChecker.__reportInvalidSyntax"></a> |
|
208 <h4>SimplifyChecker.__reportInvalidSyntax</h4> |
|
209 <b>__reportInvalidSyntax</b>(<i></i>) |
|
210 |
|
211 <p> |
|
212 Private method to report a syntax error. |
|
213 </p> |
|
214 <a NAME="SimplifyChecker.run" ID="SimplifyChecker.run"></a> |
|
215 <h4>SimplifyChecker.run</h4> |
|
216 <b>run</b>(<i></i>) |
|
217 |
|
218 <p> |
|
219 Public method to check the given source against functions |
|
220 to be replaced by 'pathlib' equivalents. |
|
221 </p> |
|
222 <div align="right"><a href="#top">Up</a></div> |
|
223 <hr /> |
|
224 </body></html> |