eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.Tabnanny.Tabnanny.html

changeset 7273
391d6b7b1eff
parent 6942
2602857055c5
equal deleted inserted replaced
7272:1779dc278077 7273:391d6b7b1eff
16 16
17 a { color: #BA6D36; } 17 a { color: #BA6D36; }
18 18
19 </style> 19 </style>
20 </head> 20 </head>
21 <body><a NAME="top" ID="top"></a> 21 <body>
22 <a NAME="top" ID="top"></a>
22 <h1>eric6.Plugins.CheckerPlugins.Tabnanny.Tabnanny</h1> 23 <h1>eric6.Plugins.CheckerPlugins.Tabnanny.Tabnanny</h1>
24
23 <p> 25 <p>
24 The Tab Nanny despises ambiguous indentation. She knows no mercy. 26 The Tab Nanny despises ambiguous indentation. She knows no mercy.
25 </p><p> 27 </p>
28 <p>
26 tabnanny -- Detection of ambiguous indentation 29 tabnanny -- Detection of ambiguous indentation
27 </p><p> 30 </p>
31 <p>
28 For the time being this module is intended to be called as a script. 32 For the time being this module is intended to be called as a script.
29 However it is possible to import it into an IDE and use the function 33 However it is possible to import it into an IDE and use the function
30 check() described below. 34 check() described below.
31 </p><p> 35 </p>
36 <p>
32 Warning: The API provided by this module is likely to change in future 37 Warning: The API provided by this module is likely to change in future
33 releases; such changes may not be backward compatible. 38 releases; such changes may not be backward compatible.
34 </p><p> 39 </p>
40 <p>
35 This is a modified version to make the original tabnanny better suitable 41 This is a modified version to make the original tabnanny better suitable
36 for being called from within the eric6 IDE. 42 for being called from within the eric6 IDE.
37 </p><dl> 43 </p>
44 <dl>
45
38 <dt>Raises <b>ValueError</b>:</dt> 46 <dt>Raises <b>ValueError</b>:</dt>
39 <dd> 47 <dd>
40 The tokenize module is too old. 48 The tokenize module is too old.
41 </dd> 49 </dd>
42 </dl> 50 </dl>
43 <h3>Global Attributes</h3> 51 <h3>Global Attributes</h3>
52
44 <table> 53 <table>
45 <tr><td>__all__</td></tr><tr><td>__version__</td></tr> 54 <tr><td>__all__</td></tr><tr><td>__version__</td></tr>
46 </table> 55 </table>
47 <h3>Classes</h3> 56 <h3>Classes</h3>
48 <table> 57
58 <table>
59
49 <tr> 60 <tr>
50 <td><a href="#NannyNag">NannyNag</a></td> 61 <td><a href="#NannyNag">NannyNag</a></td>
51 <td>Class implementing an exception for indentation issues.</td> 62 <td>Class implementing an exception for indentation issues.</td>
52 </tr><tr> 63 </tr>
64 <tr>
53 <td><a href="#Whitespace">Whitespace</a></td> 65 <td><a href="#Whitespace">Whitespace</a></td>
54 <td>Class implementing the whitespace checker.</td> 66 <td>Class implementing the whitespace checker.</td>
55 </tr> 67 </tr>
56 </table> 68 </table>
57 <h3>Functions</h3> 69 <h3>Functions</h3>
58 <table> 70
71 <table>
72
59 <tr> 73 <tr>
60 <td><a href="#__check">__check</a></td> 74 <td><a href="#__check">__check</a></td>
61 <td>Private function to check one Python source file for whitespace related problems.</td> 75 <td>Private function to check one Python source file for whitespace related problems.</td>
62 </tr><tr> 76 </tr>
77 <tr>
63 <td><a href="#batchCheck">batchCheck</a></td> 78 <td><a href="#batchCheck">batchCheck</a></td>
64 <td>Module function to check a batch of files for whitespace related problems.</td> 79 <td>Module function to check a batch of files for whitespace related problems.</td>
65 </tr><tr> 80 </tr>
81 <tr>
66 <td><a href="#check">check</a></td> 82 <td><a href="#check">check</a></td>
67 <td>Private function to check one Python source file for whitespace related problems.</td> 83 <td>Private function to check one Python source file for whitespace related problems.</td>
68 </tr><tr> 84 </tr>
85 <tr>
69 <td><a href="#format_witnesses">format_witnesses</a></td> 86 <td><a href="#format_witnesses">format_witnesses</a></td>
70 <td>Function to format the witnesses as a readable string.</td> 87 <td>Function to format the witnesses as a readable string.</td>
71 </tr><tr> 88 </tr>
89 <tr>
72 <td><a href="#initBatchService">initBatchService</a></td> 90 <td><a href="#initBatchService">initBatchService</a></td>
73 <td>Initialize the batch service and return the entry point.</td> 91 <td>Initialize the batch service and return the entry point.</td>
74 </tr><tr> 92 </tr>
93 <tr>
75 <td><a href="#initService">initService</a></td> 94 <td><a href="#initService">initService</a></td>
76 <td>Initialize the service and return the entry point.</td> 95 <td>Initialize the service and return the entry point.</td>
77 </tr><tr> 96 </tr>
97 <tr>
78 <td><a href="#process_tokens">process_tokens</a></td> 98 <td><a href="#process_tokens">process_tokens</a></td>
79 <td>Function processing all tokens generated by a tokenizer run.</td> 99 <td>Function processing all tokens generated by a tokenizer run.</td>
80 </tr><tr> 100 </tr>
101 <tr>
81 <td><a href="#worker">worker</a></td> 102 <td><a href="#worker">worker</a></td>
82 <td>Module function acting as the parallel worker for the style check.</td> 103 <td>Module function acting as the parallel worker for the style check.</td>
83 </tr> 104 </tr>
84 </table> 105 </table>
85 <hr /><hr /> 106 <hr />
107 <hr />
86 <a NAME="NannyNag" ID="NannyNag"></a> 108 <a NAME="NannyNag" ID="NannyNag"></a>
87 <h2>NannyNag</h2> 109 <h2>NannyNag</h2>
110
88 <p> 111 <p>
89 Class implementing an exception for indentation issues. 112 Class implementing an exception for indentation issues.
90 </p><p> 113 </p>
114 <p>
91 Raised by tokeneater() if detecting an ambiguous indent. 115 Raised by tokeneater() if detecting an ambiguous indent.
92 Captured and handled in check(). 116 Captured and handled in check().
93 </p> 117 </p>
94 <h3>Derived from</h3> 118 <h3>Derived from</h3>
95 Exception 119 Exception
96 <h3>Class Attributes</h3> 120 <h3>Class Attributes</h3>
121
97 <table> 122 <table>
98 <tr><td>None</td></tr> 123 <tr><td>None</td></tr>
99 </table> 124 </table>
100 <h3>Class Methods</h3> 125 <h3>Class Methods</h3>
126
101 <table> 127 <table>
102 <tr><td>None</td></tr> 128 <tr><td>None</td></tr>
103 </table> 129 </table>
104 <h3>Methods</h3> 130 <h3>Methods</h3>
105 <table> 131
132 <table>
133
106 <tr> 134 <tr>
107 <td><a href="#NannyNag.__init__">NannyNag</a></td> 135 <td><a href="#NannyNag.__init__">NannyNag</a></td>
108 <td>Constructor</td> 136 <td>Constructor</td>
109 </tr><tr> 137 </tr>
138 <tr>
110 <td><a href="#NannyNag.get_line">get_line</a></td> 139 <td><a href="#NannyNag.get_line">get_line</a></td>
111 <td>Public method to retrieve the offending line.</td> 140 <td>Public method to retrieve the offending line.</td>
112 </tr><tr> 141 </tr>
142 <tr>
113 <td><a href="#NannyNag.get_lineno">get_lineno</a></td> 143 <td><a href="#NannyNag.get_lineno">get_lineno</a></td>
114 <td>Public method to retrieve the line number.</td> 144 <td>Public method to retrieve the line number.</td>
115 </tr><tr> 145 </tr>
146 <tr>
116 <td><a href="#NannyNag.get_msg">get_msg</a></td> 147 <td><a href="#NannyNag.get_msg">get_msg</a></td>
117 <td>Public method to retrieve the message.</td> 148 <td>Public method to retrieve the message.</td>
118 </tr> 149 </tr>
119 </table> 150 </table>
120 <h3>Static Methods</h3> 151 <h3>Static Methods</h3>
152
121 <table> 153 <table>
122 <tr><td>None</td></tr> 154 <tr><td>None</td></tr>
123 </table> 155 </table>
156
124 <a NAME="NannyNag.__init__" ID="NannyNag.__init__"></a> 157 <a NAME="NannyNag.__init__" ID="NannyNag.__init__"></a>
125 <h4>NannyNag (Constructor)</h4> 158 <h4>NannyNag (Constructor)</h4>
126 <b>NannyNag</b>(<i>lineno, msg, line</i>) 159 <b>NannyNag</b>(<i>lineno, msg, line</i>)
160
127 <p> 161 <p>
128 Constructor 162 Constructor
129 </p><dl> 163 </p>
164 <dl>
165
130 <dt><i>lineno</i></dt> 166 <dt><i>lineno</i></dt>
131 <dd> 167 <dd>
132 Line number of the ambiguous indent. 168 Line number of the ambiguous indent.
133 </dd><dt><i>msg</i></dt> 169 </dd>
170 <dt><i>msg</i></dt>
134 <dd> 171 <dd>
135 Descriptive message assigned to this problem. 172 Descriptive message assigned to this problem.
136 </dd><dt><i>line</i></dt> 173 </dd>
174 <dt><i>line</i></dt>
137 <dd> 175 <dd>
138 The offending source line. 176 The offending source line.
139 </dd> 177 </dd>
140 </dl><a NAME="NannyNag.get_line" ID="NannyNag.get_line"></a> 178 </dl>
179 <a NAME="NannyNag.get_line" ID="NannyNag.get_line"></a>
141 <h4>NannyNag.get_line</h4> 180 <h4>NannyNag.get_line</h4>
142 <b>get_line</b>(<i></i>) 181 <b>get_line</b>(<i></i>)
182
143 <p> 183 <p>
144 Public method to retrieve the offending line. 184 Public method to retrieve the offending line.
145 </p><dl> 185 </p>
186 <dl>
146 <dt>Returns:</dt> 187 <dt>Returns:</dt>
147 <dd> 188 <dd>
148 The line of code (string) 189 The line of code (string)
149 </dd> 190 </dd>
150 </dl><a NAME="NannyNag.get_lineno" ID="NannyNag.get_lineno"></a> 191 </dl>
192 <a NAME="NannyNag.get_lineno" ID="NannyNag.get_lineno"></a>
151 <h4>NannyNag.get_lineno</h4> 193 <h4>NannyNag.get_lineno</h4>
152 <b>get_lineno</b>(<i></i>) 194 <b>get_lineno</b>(<i></i>)
195
153 <p> 196 <p>
154 Public method to retrieve the line number. 197 Public method to retrieve the line number.
155 </p><dl> 198 </p>
199 <dl>
156 <dt>Returns:</dt> 200 <dt>Returns:</dt>
157 <dd> 201 <dd>
158 The line number (integer) 202 The line number (integer)
159 </dd> 203 </dd>
160 </dl><a NAME="NannyNag.get_msg" ID="NannyNag.get_msg"></a> 204 </dl>
205 <a NAME="NannyNag.get_msg" ID="NannyNag.get_msg"></a>
161 <h4>NannyNag.get_msg</h4> 206 <h4>NannyNag.get_msg</h4>
162 <b>get_msg</b>(<i></i>) 207 <b>get_msg</b>(<i></i>)
208
163 <p> 209 <p>
164 Public method to retrieve the message. 210 Public method to retrieve the message.
165 </p><dl> 211 </p>
212 <dl>
166 <dt>Returns:</dt> 213 <dt>Returns:</dt>
167 <dd> 214 <dd>
168 The error message (string) 215 The error message (string)
169 </dd> 216 </dd>
170 </dl> 217 </dl>
171 <div align="right"><a href="#top">Up</a></div> 218 <div align="right"><a href="#top">Up</a></div>
172 <hr /><hr /> 219 <hr />
220 <hr />
173 <a NAME="Whitespace" ID="Whitespace"></a> 221 <a NAME="Whitespace" ID="Whitespace"></a>
174 <h2>Whitespace</h2> 222 <h2>Whitespace</h2>
223
175 <p> 224 <p>
176 Class implementing the whitespace checker. 225 Class implementing the whitespace checker.
177 </p> 226 </p>
178 <h3>Derived from</h3> 227 <h3>Derived from</h3>
179 object 228 object
180 <h3>Class Attributes</h3> 229 <h3>Class Attributes</h3>
230
181 <table> 231 <table>
182 <tr><td>None</td></tr> 232 <tr><td>None</td></tr>
183 </table> 233 </table>
184 <h3>Class Methods</h3> 234 <h3>Class Methods</h3>
235
185 <table> 236 <table>
186 <tr><td>None</td></tr> 237 <tr><td>None</td></tr>
187 </table> 238 </table>
188 <h3>Methods</h3> 239 <h3>Methods</h3>
189 <table> 240
241 <table>
242
190 <tr> 243 <tr>
191 <td><a href="#Whitespace.__init__">Whitespace</a></td> 244 <td><a href="#Whitespace.__init__">Whitespace</a></td>
192 <td>Constructor</td> 245 <td>Constructor</td>
193 </tr><tr> 246 </tr>
247 <tr>
194 <td><a href="#Whitespace.equal">equal</a></td> 248 <td><a href="#Whitespace.equal">equal</a></td>
195 <td>Public method to compare the indentation levels of two Whitespace objects for equality.</td> 249 <td>Public method to compare the indentation levels of two Whitespace objects for equality.</td>
196 </tr><tr> 250 </tr>
251 <tr>
197 <td><a href="#Whitespace.indent_level">indent_level</a></td> 252 <td><a href="#Whitespace.indent_level">indent_level</a></td>
198 <td>Public method to determine the indentation level.</td> 253 <td>Public method to determine the indentation level.</td>
199 </tr><tr> 254 </tr>
255 <tr>
200 <td><a href="#Whitespace.less">less</a></td> 256 <td><a href="#Whitespace.less">less</a></td>
201 <td>Public method to compare the indentation level against another Whitespace objects to be smaller.</td> 257 <td>Public method to compare the indentation level against another Whitespace objects to be smaller.</td>
202 </tr><tr> 258 </tr>
259 <tr>
203 <td><a href="#Whitespace.longest_run_of_spaces">longest_run_of_spaces</a></td> 260 <td><a href="#Whitespace.longest_run_of_spaces">longest_run_of_spaces</a></td>
204 <td>Public method to calculate the length of longest contiguous run of spaces.</td> 261 <td>Public method to calculate the length of longest contiguous run of spaces.</td>
205 </tr><tr> 262 </tr>
263 <tr>
206 <td><a href="#Whitespace.not_equal_witness">not_equal_witness</a></td> 264 <td><a href="#Whitespace.not_equal_witness">not_equal_witness</a></td>
207 <td>Public method to calculate a tuple of witnessing tab size.</td> 265 <td>Public method to calculate a tuple of witnessing tab size.</td>
208 </tr><tr> 266 </tr>
267 <tr>
209 <td><a href="#Whitespace.not_less_witness">not_less_witness</a></td> 268 <td><a href="#Whitespace.not_less_witness">not_less_witness</a></td>
210 <td>Public method to calculate a tuple of witnessing tab size.</td> 269 <td>Public method to calculate a tuple of witnessing tab size.</td>
211 </tr> 270 </tr>
212 </table> 271 </table>
213 <h3>Static Methods</h3> 272 <h3>Static Methods</h3>
273
214 <table> 274 <table>
215 <tr><td>None</td></tr> 275 <tr><td>None</td></tr>
216 </table> 276 </table>
277
217 <a NAME="Whitespace.__init__" ID="Whitespace.__init__"></a> 278 <a NAME="Whitespace.__init__" ID="Whitespace.__init__"></a>
218 <h4>Whitespace (Constructor)</h4> 279 <h4>Whitespace (Constructor)</h4>
219 <b>Whitespace</b>(<i>ws</i>) 280 <b>Whitespace</b>(<i>ws</i>)
281
220 <p> 282 <p>
221 Constructor 283 Constructor
222 </p><dl> 284 </p>
285 <dl>
286
223 <dt><i>ws</i></dt> 287 <dt><i>ws</i></dt>
224 <dd> 288 <dd>
225 The string to be checked. 289 The string to be checked.
226 </dd> 290 </dd>
227 </dl><a NAME="Whitespace.equal" ID="Whitespace.equal"></a> 291 </dl>
292 <a NAME="Whitespace.equal" ID="Whitespace.equal"></a>
228 <h4>Whitespace.equal</h4> 293 <h4>Whitespace.equal</h4>
229 <b>equal</b>(<i>other</i>) 294 <b>equal</b>(<i>other</i>)
295
230 <p> 296 <p>
231 Public method to compare the indentation levels of two Whitespace 297 Public method to compare the indentation levels of two Whitespace
232 objects for equality. 298 objects for equality.
233 </p><dl> 299 </p>
300 <dl>
301
234 <dt><i>other</i></dt> 302 <dt><i>other</i></dt>
235 <dd> 303 <dd>
236 Whitespace object to compare against. 304 Whitespace object to compare against.
237 </dd> 305 </dd>
238 </dl><dl> 306 </dl>
307 <dl>
239 <dt>Returns:</dt> 308 <dt>Returns:</dt>
240 <dd> 309 <dd>
241 True, if we compare equal against the other Whitespace object. 310 True, if we compare equal against the other Whitespace object.
242 </dd> 311 </dd>
243 </dl><a NAME="Whitespace.indent_level" ID="Whitespace.indent_level"></a> 312 </dl>
313 <a NAME="Whitespace.indent_level" ID="Whitespace.indent_level"></a>
244 <h4>Whitespace.indent_level</h4> 314 <h4>Whitespace.indent_level</h4>
245 <b>indent_level</b>(<i>tabsize</i>) 315 <b>indent_level</b>(<i>tabsize</i>)
316
246 <p> 317 <p>
247 Public method to determine the indentation level. 318 Public method to determine the indentation level.
248 </p><dl> 319 </p>
320 <dl>
321
249 <dt><i>tabsize</i></dt> 322 <dt><i>tabsize</i></dt>
250 <dd> 323 <dd>
251 The length of a tab stop. (integer) 324 The length of a tab stop. (integer)
252 </dd> 325 </dd>
253 </dl><dl> 326 </dl>
327 <dl>
254 <dt>Returns:</dt> 328 <dt>Returns:</dt>
255 <dd> 329 <dd>
256 indentation level (integer) 330 indentation level (integer)
257 </dd> 331 </dd>
258 </dl><a NAME="Whitespace.less" ID="Whitespace.less"></a> 332 </dl>
333 <a NAME="Whitespace.less" ID="Whitespace.less"></a>
259 <h4>Whitespace.less</h4> 334 <h4>Whitespace.less</h4>
260 <b>less</b>(<i>other</i>) 335 <b>less</b>(<i>other</i>)
336
261 <p> 337 <p>
262 Public method to compare the indentation level against another 338 Public method to compare the indentation level against another
263 Whitespace objects to be smaller. 339 Whitespace objects to be smaller.
264 </p><dl> 340 </p>
341 <dl>
342
265 <dt><i>other</i></dt> 343 <dt><i>other</i></dt>
266 <dd> 344 <dd>
267 Whitespace object to compare against. 345 Whitespace object to compare against.
268 </dd> 346 </dd>
269 </dl><dl> 347 </dl>
348 <dl>
270 <dt>Returns:</dt> 349 <dt>Returns:</dt>
271 <dd> 350 <dd>
272 True, if we compare less against the other Whitespace object. 351 True, if we compare less against the other Whitespace object.
273 </dd> 352 </dd>
274 </dl><a NAME="Whitespace.longest_run_of_spaces" ID="Whitespace.longest_run_of_spaces"></a> 353 </dl>
354 <a NAME="Whitespace.longest_run_of_spaces" ID="Whitespace.longest_run_of_spaces"></a>
275 <h4>Whitespace.longest_run_of_spaces</h4> 355 <h4>Whitespace.longest_run_of_spaces</h4>
276 <b>longest_run_of_spaces</b>(<i></i>) 356 <b>longest_run_of_spaces</b>(<i></i>)
357
277 <p> 358 <p>
278 Public method to calculate the length of longest contiguous run of 359 Public method to calculate the length of longest contiguous run of
279 spaces. 360 spaces.
280 </p><dl> 361 </p>
362 <dl>
281 <dt>Returns:</dt> 363 <dt>Returns:</dt>
282 <dd> 364 <dd>
283 The length of longest contiguous run of spaces (whether or not 365 The length of longest contiguous run of spaces (whether or not
284 preceding a tab) 366 preceding a tab)
285 </dd> 367 </dd>
286 </dl><a NAME="Whitespace.not_equal_witness" ID="Whitespace.not_equal_witness"></a> 368 </dl>
369 <a NAME="Whitespace.not_equal_witness" ID="Whitespace.not_equal_witness"></a>
287 <h4>Whitespace.not_equal_witness</h4> 370 <h4>Whitespace.not_equal_witness</h4>
288 <b>not_equal_witness</b>(<i>other</i>) 371 <b>not_equal_witness</b>(<i>other</i>)
372
289 <p> 373 <p>
290 Public method to calculate a tuple of witnessing tab size. 374 Public method to calculate a tuple of witnessing tab size.
291 </p><p> 375 </p>
376 <p>
292 Intended to be used after not self.equal(other) is known, in which 377 Intended to be used after not self.equal(other) is known, in which
293 case it will return at least one witnessing tab size. 378 case it will return at least one witnessing tab size.
294 </p><dl> 379 </p>
380 <dl>
381
295 <dt><i>other</i></dt> 382 <dt><i>other</i></dt>
296 <dd> 383 <dd>
297 Whitespace object to calculate against. 384 Whitespace object to calculate against.
298 </dd> 385 </dd>
299 </dl><dl> 386 </dl>
387 <dl>
300 <dt>Returns:</dt> 388 <dt>Returns:</dt>
301 <dd> 389 <dd>
302 A list of tuples (ts, i1, i2) such that 390 A list of tuples (ts, i1, i2) such that
303 i1 == self.indent_level(ts) != other.indent_level(ts) == i2. 391 i1 == self.indent_level(ts) != other.indent_level(ts) == i2.
304 </dd> 392 </dd>
305 </dl><a NAME="Whitespace.not_less_witness" ID="Whitespace.not_less_witness"></a> 393 </dl>
394 <a NAME="Whitespace.not_less_witness" ID="Whitespace.not_less_witness"></a>
306 <h4>Whitespace.not_less_witness</h4> 395 <h4>Whitespace.not_less_witness</h4>
307 <b>not_less_witness</b>(<i>other</i>) 396 <b>not_less_witness</b>(<i>other</i>)
397
308 <p> 398 <p>
309 Public method to calculate a tuple of witnessing tab size. 399 Public method to calculate a tuple of witnessing tab size.
310 </p><p> 400 </p>
401 <p>
311 Intended to be used after not self.less(other is known, in which 402 Intended to be used after not self.less(other is known, in which
312 case it will return at least one witnessing tab size. 403 case it will return at least one witnessing tab size.
313 </p><dl> 404 </p>
405 <dl>
406
314 <dt><i>other</i></dt> 407 <dt><i>other</i></dt>
315 <dd> 408 <dd>
316 Whitespace object to calculate against. 409 Whitespace object to calculate against.
317 </dd> 410 </dd>
318 </dl><dl> 411 </dl>
412 <dl>
319 <dt>Returns:</dt> 413 <dt>Returns:</dt>
320 <dd> 414 <dd>
321 A list of tuples (ts, i1, i2) such that 415 A list of tuples (ts, i1, i2) such that
322 i1 == self.indent_level(ts) >= other.indent_level(ts) == i2. 416 i1 == self.indent_level(ts) >= other.indent_level(ts) == i2.
323 </dd> 417 </dd>
324 </dl> 418 </dl>
325 <div align="right"><a href="#top">Up</a></div> 419 <div align="right"><a href="#top">Up</a></div>
326 <hr /><hr /> 420 <hr />
421 <hr />
327 <a NAME="__check" ID="__check"></a> 422 <a NAME="__check" ID="__check"></a>
328 <h2>__check</h2> 423 <h2>__check</h2>
329 <b>__check</b>(<i>file, text=""</i>) 424 <b>__check</b>(<i>file, text=""</i>)
425
330 <p> 426 <p>
331 Private function to check one Python source file for whitespace related 427 Private function to check one Python source file for whitespace related
332 problems. 428 problems.
333 </p><dl> 429 </p>
430 <dl>
431
334 <dt><i>file</i></dt> 432 <dt><i>file</i></dt>
335 <dd> 433 <dd>
336 source filename (string) 434 source filename (string)
337 </dd><dt><i>text</i></dt> 435 </dd>
436 <dt><i>text</i></dt>
338 <dd> 437 <dd>
339 source text (string) 438 source text (string)
340 </dd> 439 </dd>
341 </dl><dl> 440 </dl>
441 <dl>
342 <dt>Returns:</dt> 442 <dt>Returns:</dt>
343 <dd> 443 <dd>
344 A tuple indicating status (True = an error was found), the 444 A tuple indicating status (True = an error was found), the
345 filename, the linenumber and the error message 445 filename, the linenumber and the error message
346 (boolean, string, string). The values are only 446 (boolean, string, string). The values are only
347 valid, if the status is True. 447 valid, if the status is True.
348 </dd> 448 </dd>
349 </dl> 449 </dl>
350 <div align="right"><a href="#top">Up</a></div> 450 <div align="right"><a href="#top">Up</a></div>
351 <hr /><hr /> 451 <hr />
452 <hr />
352 <a NAME="batchCheck" ID="batchCheck"></a> 453 <a NAME="batchCheck" ID="batchCheck"></a>
353 <h2>batchCheck</h2> 454 <h2>batchCheck</h2>
354 <b>batchCheck</b>(<i>argumentsList, send, fx, cancelled, maxProcesses=0</i>) 455 <b>batchCheck</b>(<i>argumentsList, send, fx, cancelled, maxProcesses=0</i>)
456
355 <p> 457 <p>
356 Module function to check a batch of files for whitespace related problems. 458 Module function to check a batch of files for whitespace related problems.
357 </p><dl> 459 </p>
460 <dl>
461
358 <dt><i>argumentsList</i> (list)</dt> 462 <dt><i>argumentsList</i> (list)</dt>
359 <dd> 463 <dd>
360 list of arguments tuples as given for check 464 list of arguments tuples as given for check
361 </dd><dt><i>send</i> (func)</dt> 465 </dd>
466 <dt><i>send</i> (func)</dt>
362 <dd> 467 <dd>
363 reference to send function 468 reference to send function
364 </dd><dt><i>fx</i> (str)</dt> 469 </dd>
470 <dt><i>fx</i> (str)</dt>
365 <dd> 471 <dd>
366 registered service name 472 registered service name
367 </dd><dt><i>cancelled</i> (func)</dt> 473 </dd>
474 <dt><i>cancelled</i> (func)</dt>
368 <dd> 475 <dd>
369 reference to function checking for a cancellation 476 reference to function checking for a cancellation
370 </dd><dt><i>maxProcesses</i> (int)</dt> 477 </dd>
478 <dt><i>maxProcesses</i> (int)</dt>
371 <dd> 479 <dd>
372 number of processes to be used 480 number of processes to be used
373 </dd> 481 </dd>
374 </dl> 482 </dl>
375 <div align="right"><a href="#top">Up</a></div> 483 <div align="right"><a href="#top">Up</a></div>
376 <hr /><hr /> 484 <hr />
485 <hr />
377 <a NAME="check" ID="check"></a> 486 <a NAME="check" ID="check"></a>
378 <h2>check</h2> 487 <h2>check</h2>
379 <b>check</b>(<i>file, text=""</i>) 488 <b>check</b>(<i>file, text=""</i>)
489
380 <p> 490 <p>
381 Private function to check one Python source file for whitespace related 491 Private function to check one Python source file for whitespace related
382 problems. 492 problems.
383 </p><dl> 493 </p>
494 <dl>
495
384 <dt><i>file</i></dt> 496 <dt><i>file</i></dt>
385 <dd> 497 <dd>
386 source filename (string) 498 source filename (string)
387 </dd><dt><i>text</i></dt> 499 </dd>
500 <dt><i>text</i></dt>
388 <dd> 501 <dd>
389 source text (string) 502 source text (string)
390 </dd> 503 </dd>
391 </dl><dl> 504 </dl>
505 <dl>
392 <dt>Returns:</dt> 506 <dt>Returns:</dt>
393 <dd> 507 <dd>
394 A tuple indicating status (True = an error was found), the 508 A tuple indicating status (True = an error was found), the
395 filename, the linenumber and the error message 509 filename, the linenumber and the error message
396 (boolean, string, string, string). The values are only 510 (boolean, string, string, string). The values are only
397 valid, if the status is True. 511 valid, if the status is True.
398 </dd> 512 </dd>
399 </dl> 513 </dl>
400 <div align="right"><a href="#top">Up</a></div> 514 <div align="right"><a href="#top">Up</a></div>
401 <hr /><hr /> 515 <hr />
516 <hr />
402 <a NAME="format_witnesses" ID="format_witnesses"></a> 517 <a NAME="format_witnesses" ID="format_witnesses"></a>
403 <h2>format_witnesses</h2> 518 <h2>format_witnesses</h2>
404 <b>format_witnesses</b>(<i>w</i>) 519 <b>format_witnesses</b>(<i>w</i>)
520
405 <p> 521 <p>
406 Function to format the witnesses as a readable string. 522 Function to format the witnesses as a readable string.
407 </p><dl> 523 </p>
524 <dl>
525
408 <dt><i>w</i></dt> 526 <dt><i>w</i></dt>
409 <dd> 527 <dd>
410 A list of witnesses 528 A list of witnesses
411 </dd> 529 </dd>
412 </dl><dl> 530 </dl>
531 <dl>
413 <dt>Returns:</dt> 532 <dt>Returns:</dt>
414 <dd> 533 <dd>
415 A formated string of the witnesses. 534 A formated string of the witnesses.
416 </dd> 535 </dd>
417 </dl> 536 </dl>
418 <div align="right"><a href="#top">Up</a></div> 537 <div align="right"><a href="#top">Up</a></div>
419 <hr /><hr /> 538 <hr />
539 <hr />
420 <a NAME="initBatchService" ID="initBatchService"></a> 540 <a NAME="initBatchService" ID="initBatchService"></a>
421 <h2>initBatchService</h2> 541 <h2>initBatchService</h2>
422 <b>initBatchService</b>(<i></i>) 542 <b>initBatchService</b>(<i></i>)
543
423 <p> 544 <p>
424 Initialize the batch service and return the entry point. 545 Initialize the batch service and return the entry point.
425 </p><dl> 546 </p>
547 <dl>
426 <dt>Returns:</dt> 548 <dt>Returns:</dt>
427 <dd> 549 <dd>
428 the entry point for the background client (function) 550 the entry point for the background client (function)
429 </dd> 551 </dd>
430 </dl> 552 </dl>
431 <div align="right"><a href="#top">Up</a></div> 553 <div align="right"><a href="#top">Up</a></div>
432 <hr /><hr /> 554 <hr />
555 <hr />
433 <a NAME="initService" ID="initService"></a> 556 <a NAME="initService" ID="initService"></a>
434 <h2>initService</h2> 557 <h2>initService</h2>
435 <b>initService</b>(<i></i>) 558 <b>initService</b>(<i></i>)
559
436 <p> 560 <p>
437 Initialize the service and return the entry point. 561 Initialize the service and return the entry point.
438 </p><dl> 562 </p>
563 <dl>
439 <dt>Returns:</dt> 564 <dt>Returns:</dt>
440 <dd> 565 <dd>
441 the entry point for the background client (function) 566 the entry point for the background client (function)
442 </dd> 567 </dd>
443 </dl> 568 </dl>
444 <div align="right"><a href="#top">Up</a></div> 569 <div align="right"><a href="#top">Up</a></div>
445 <hr /><hr /> 570 <hr />
571 <hr />
446 <a NAME="process_tokens" ID="process_tokens"></a> 572 <a NAME="process_tokens" ID="process_tokens"></a>
447 <h2>process_tokens</h2> 573 <h2>process_tokens</h2>
448 <b>process_tokens</b>(<i>tokens</i>) 574 <b>process_tokens</b>(<i>tokens</i>)
575
449 <p> 576 <p>
450 Function processing all tokens generated by a tokenizer run. 577 Function processing all tokens generated by a tokenizer run.
451 </p><dl> 578 </p>
579 <dl>
580
452 <dt><i>tokens</i></dt> 581 <dt><i>tokens</i></dt>
453 <dd> 582 <dd>
454 list of tokens 583 list of tokens
455 </dd> 584 </dd>
456 </dl><dl> 585 </dl>
586 <dl>
587
457 <dt>Raises <b>NannyNag</b>:</dt> 588 <dt>Raises <b>NannyNag</b>:</dt>
458 <dd> 589 <dd>
459 raised to indicate an indentation error 590 raised to indicate an indentation error
460 </dd> 591 </dd>
461 </dl> 592 </dl>
462 <div align="right"><a href="#top">Up</a></div> 593 <div align="right"><a href="#top">Up</a></div>
463 <hr /><hr /> 594 <hr />
595 <hr />
464 <a NAME="worker" ID="worker"></a> 596 <a NAME="worker" ID="worker"></a>
465 <h2>worker</h2> 597 <h2>worker</h2>
466 <b>worker</b>(<i>inputQueue, outputQueue</i>) 598 <b>worker</b>(<i>inputQueue, outputQueue</i>)
599
467 <p> 600 <p>
468 Module function acting as the parallel worker for the style check. 601 Module function acting as the parallel worker for the style check.
469 </p><dl> 602 </p>
603 <dl>
604
470 <dt><i>inputQueue</i></dt> 605 <dt><i>inputQueue</i></dt>
471 <dd> 606 <dd>
472 input queue (multiprocessing.Queue) 607 input queue (multiprocessing.Queue)
473 </dd><dt><i>outputQueue</i></dt> 608 </dd>
609 <dt><i>outputQueue</i></dt>
474 <dd> 610 <dd>
475 output queue (multiprocessing.Queue) 611 output queue (multiprocessing.Queue)
476 </dd> 612 </dd>
477 </dl> 613 </dl>
478 <div align="right"><a href="#top">Up</a></div> 614 <div align="right"><a href="#top">Up</a></div>

eric ide

mercurial