|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer</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.CodeStyleFixer</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing a class to fix certain code style issues. |
|
13 </p> |
|
14 <h3>Global Attributes</h3> |
|
15 |
|
16 <table> |
|
17 <tr><td>FixableCodeStyleIssues</td></tr> |
|
18 </table> |
|
19 <h3>Classes</h3> |
|
20 |
|
21 <table> |
|
22 |
|
23 <tr> |
|
24 <td><a href="#CodeStyleFixer">CodeStyleFixer</a></td> |
|
25 <td>Class implementing a fixer for certain code style issues.</td> |
|
26 </tr> |
|
27 <tr> |
|
28 <td><a href="#IndentationWrapper">IndentationWrapper</a></td> |
|
29 <td>Class used by fixers dealing with indentation.</td> |
|
30 </tr> |
|
31 <tr> |
|
32 <td><a href="#LineShortener">LineShortener</a></td> |
|
33 <td>Class used to shorten lines to a given maximum of characters.</td> |
|
34 </tr> |
|
35 <tr> |
|
36 <td><a href="#Reindenter">Reindenter</a></td> |
|
37 <td>Class to reindent badly-indented code to uniformly use four-space indentation.</td> |
|
38 </tr> |
|
39 </table> |
|
40 <h3>Functions</h3> |
|
41 |
|
42 <table> |
|
43 <tr><td>None</td></tr> |
|
44 </table> |
|
45 <hr /> |
|
46 <hr /> |
|
47 <a NAME="CodeStyleFixer" ID="CodeStyleFixer"></a> |
|
48 <h2>CodeStyleFixer</h2> |
|
49 |
|
50 <p> |
|
51 Class implementing a fixer for certain code style issues. |
|
52 </p> |
|
53 <h3>Derived from</h3> |
|
54 None |
|
55 <h3>Class Attributes</h3> |
|
56 |
|
57 <table> |
|
58 <tr><td>None</td></tr> |
|
59 </table> |
|
60 <h3>Class Methods</h3> |
|
61 |
|
62 <table> |
|
63 <tr><td>None</td></tr> |
|
64 </table> |
|
65 <h3>Methods</h3> |
|
66 |
|
67 <table> |
|
68 |
|
69 <tr> |
|
70 <td><a href="#CodeStyleFixer.__init__">CodeStyleFixer</a></td> |
|
71 <td>Constructor</td> |
|
72 </tr> |
|
73 <tr> |
|
74 <td><a href="#CodeStyleFixer.__codeMatch">__codeMatch</a></td> |
|
75 <td>Private method to check, if the code should be fixed.</td> |
|
76 </tr> |
|
77 <tr> |
|
78 <td><a href="#CodeStyleFixer.__findLogical">__findLogical</a></td> |
|
79 <td>Private method to extract the index of all the starts and ends of lines.</td> |
|
80 </tr> |
|
81 <tr> |
|
82 <td><a href="#CodeStyleFixer.__fixBlankLinesBefore">__fixBlankLinesBefore</a></td> |
|
83 <td>Private method to fix the need for blank lines before class, function and method definitions.</td> |
|
84 </tr> |
|
85 <tr> |
|
86 <td><a href="#CodeStyleFixer.__fixD111">__fixD111</a></td> |
|
87 <td>Private method to fix docstring enclosed in wrong quotes.</td> |
|
88 </tr> |
|
89 <tr> |
|
90 <td><a href="#CodeStyleFixer.__fixD112">__fixD112</a></td> |
|
91 <td>Private method to fix docstring 'r' in leading quotes.</td> |
|
92 </tr> |
|
93 <tr> |
|
94 <td><a href="#CodeStyleFixer.__fixD121">__fixD121</a></td> |
|
95 <td>Private method to fix a single line docstring on multiple lines.</td> |
|
96 </tr> |
|
97 <tr> |
|
98 <td><a href="#CodeStyleFixer.__fixD131">__fixD131</a></td> |
|
99 <td>Private method to fix a docstring summary not ending with a period.</td> |
|
100 </tr> |
|
101 <tr> |
|
102 <td><a href="#CodeStyleFixer.__fixD141">__fixD141</a></td> |
|
103 <td>Private method to fix a function/method docstring preceded by a blank line.</td> |
|
104 </tr> |
|
105 <tr> |
|
106 <td><a href="#CodeStyleFixer.__fixD142">__fixD142</a></td> |
|
107 <td>Private method to fix a class docstring not preceded by a blank line.</td> |
|
108 </tr> |
|
109 <tr> |
|
110 <td><a href="#CodeStyleFixer.__fixD143">__fixD143</a></td> |
|
111 <td>Private method to fix a class docstring not followed by a blank line.</td> |
|
112 </tr> |
|
113 <tr> |
|
114 <td><a href="#CodeStyleFixer.__fixD144">__fixD144</a></td> |
|
115 <td>Private method to fix a docstring summary not followed by a blank line.</td> |
|
116 </tr> |
|
117 <tr> |
|
118 <td><a href="#CodeStyleFixer.__fixD145">__fixD145</a></td> |
|
119 <td>Private method to fix the last paragraph of a multi-line docstring not followed by a blank line.</td> |
|
120 </tr> |
|
121 <tr> |
|
122 <td><a href="#CodeStyleFixer.__fixD221">__fixD221</a></td> |
|
123 <td>Private method to fix leading and trailing quotes of docstring not on separate lines.</td> |
|
124 </tr> |
|
125 <tr> |
|
126 <td><a href="#CodeStyleFixer.__fixD242">__fixD242</a></td> |
|
127 <td>Private method to fix a class or function/method docstring preceded by a blank line.</td> |
|
128 </tr> |
|
129 <tr> |
|
130 <td><a href="#CodeStyleFixer.__fixD243">__fixD243</a></td> |
|
131 <td>Private method to fix a class or function/method docstring followed by a blank line.</td> |
|
132 </tr> |
|
133 <tr> |
|
134 <td><a href="#CodeStyleFixer.__fixD247">__fixD247</a></td> |
|
135 <td>Private method to fix a last paragraph of a docstring followed by a blank line.</td> |
|
136 </tr> |
|
137 <tr> |
|
138 <td><a href="#CodeStyleFixer.__fixE101">__fixE101</a></td> |
|
139 <td>Private method to fix obsolete tab usage and indentation errors.</td> |
|
140 </tr> |
|
141 <tr> |
|
142 <td><a href="#CodeStyleFixer.__fixE121">__fixE121</a></td> |
|
143 <td>Private method to fix the indentation of continuation lines and closing brackets.</td> |
|
144 </tr> |
|
145 <tr> |
|
146 <td><a href="#CodeStyleFixer.__fixE122">__fixE122</a></td> |
|
147 <td>Private method to fix a missing indentation of continuation lines.</td> |
|
148 </tr> |
|
149 <tr> |
|
150 <td><a href="#CodeStyleFixer.__fixE123">__fixE123</a></td> |
|
151 <td>Private method to fix the indentation of a closing bracket lines.</td> |
|
152 </tr> |
|
153 <tr> |
|
154 <td><a href="#CodeStyleFixer.__fixE125">__fixE125</a></td> |
|
155 <td>Private method to fix the indentation of continuation lines not distinguishable from next logical line.</td> |
|
156 </tr> |
|
157 <tr> |
|
158 <td><a href="#CodeStyleFixer.__fixE126">__fixE126</a></td> |
|
159 <td>Private method to fix over-indented/under-indented hanging indentation.</td> |
|
160 </tr> |
|
161 <tr> |
|
162 <td><a href="#CodeStyleFixer.__fixE127">__fixE127</a></td> |
|
163 <td>Private method to fix over/under indented lines.</td> |
|
164 </tr> |
|
165 <tr> |
|
166 <td><a href="#CodeStyleFixer.__fixE201">__fixE201</a></td> |
|
167 <td>Private method to fix extraneous whitespace.</td> |
|
168 </tr> |
|
169 <tr> |
|
170 <td><a href="#CodeStyleFixer.__fixE221">__fixE221</a></td> |
|
171 <td>Private method to fix extraneous whitespace around operator or keyword.</td> |
|
172 </tr> |
|
173 <tr> |
|
174 <td><a href="#CodeStyleFixer.__fixE225">__fixE225</a></td> |
|
175 <td>Private method to fix extraneous whitespaces around operator.</td> |
|
176 </tr> |
|
177 <tr> |
|
178 <td><a href="#CodeStyleFixer.__fixE231">__fixE231</a></td> |
|
179 <td>Private method to fix missing whitespace after ',;:'.</td> |
|
180 </tr> |
|
181 <tr> |
|
182 <td><a href="#CodeStyleFixer.__fixE251">__fixE251</a></td> |
|
183 <td>Private method to fix extraneous whitespace around keyword and default parameter equals.</td> |
|
184 </tr> |
|
185 <tr> |
|
186 <td><a href="#CodeStyleFixer.__fixE261">__fixE261</a></td> |
|
187 <td>Private method to fix whitespace before or after inline comment.</td> |
|
188 </tr> |
|
189 <tr> |
|
190 <td><a href="#CodeStyleFixer.__fixE304">__fixE304</a></td> |
|
191 <td>Private method to fix superfluous blank lines after a function decorator.</td> |
|
192 </tr> |
|
193 <tr> |
|
194 <td><a href="#CodeStyleFixer.__fixE401">__fixE401</a></td> |
|
195 <td>Private method to fix multiple imports on one line.</td> |
|
196 </tr> |
|
197 <tr> |
|
198 <td><a href="#CodeStyleFixer.__fixE501">__fixE501</a></td> |
|
199 <td>Private method to fix the long lines by breaking them.</td> |
|
200 </tr> |
|
201 <tr> |
|
202 <td><a href="#CodeStyleFixer.__fixE502">__fixE502</a></td> |
|
203 <td>Private method to fix redundant backslash within brackets.</td> |
|
204 </tr> |
|
205 <tr> |
|
206 <td><a href="#CodeStyleFixer.__fixE701">__fixE701</a></td> |
|
207 <td>Private method to fix colon-separated compound statements.</td> |
|
208 </tr> |
|
209 <tr> |
|
210 <td><a href="#CodeStyleFixer.__fixE702">__fixE702</a></td> |
|
211 <td>Private method to fix semicolon-separated compound statements.</td> |
|
212 </tr> |
|
213 <tr> |
|
214 <td><a href="#CodeStyleFixer.__fixE711">__fixE711</a></td> |
|
215 <td>Private method to fix comparison with None.</td> |
|
216 </tr> |
|
217 <tr> |
|
218 <td><a href="#CodeStyleFixer.__fixN804">__fixN804</a></td> |
|
219 <td>Private method to fix a wrong first argument of normal and class methods.</td> |
|
220 </tr> |
|
221 <tr> |
|
222 <td><a href="#CodeStyleFixer.__fixN806">__fixN806</a></td> |
|
223 <td>Private method to fix a wrong first argument of static methods.</td> |
|
224 </tr> |
|
225 <tr> |
|
226 <td><a href="#CodeStyleFixer.__fixReindent">__fixReindent</a></td> |
|
227 <td>Private method to fix a badly indented line.</td> |
|
228 </tr> |
|
229 <tr> |
|
230 <td><a href="#CodeStyleFixer.__fixW291">__fixW291</a></td> |
|
231 <td>Private method to fix trailing whitespace.</td> |
|
232 </tr> |
|
233 <tr> |
|
234 <td><a href="#CodeStyleFixer.__fixW292">__fixW292</a></td> |
|
235 <td>Private method to fix a missing newline at the end of file.</td> |
|
236 </tr> |
|
237 <tr> |
|
238 <td><a href="#CodeStyleFixer.__fixW391">__fixW391</a></td> |
|
239 <td>Private method to fix trailing blank lines.</td> |
|
240 </tr> |
|
241 <tr> |
|
242 <td><a href="#CodeStyleFixer.__fixW603">__fixW603</a></td> |
|
243 <td>Private method to fix the not equal notation.</td> |
|
244 </tr> |
|
245 <tr> |
|
246 <td><a href="#CodeStyleFixer.__fixWhitespace">__fixWhitespace</a></td> |
|
247 <td>Private method to correct whitespace at the given offset.</td> |
|
248 </tr> |
|
249 <tr> |
|
250 <td><a href="#CodeStyleFixer.__getID">__getID</a></td> |
|
251 <td>Private method to get the ID for a deferred fix.</td> |
|
252 </tr> |
|
253 <tr> |
|
254 <td><a href="#CodeStyleFixer.__getIndent">__getIndent</a></td> |
|
255 <td>Private method to get the indentation string.</td> |
|
256 </tr> |
|
257 <tr> |
|
258 <td><a href="#CodeStyleFixer.__getIndentWord">__getIndentWord</a></td> |
|
259 <td>Private method to determine the indentation type.</td> |
|
260 </tr> |
|
261 <tr> |
|
262 <td><a href="#CodeStyleFixer.__getLogical">__getLogical</a></td> |
|
263 <td>Private method to get the logical line corresponding to the given position.</td> |
|
264 </tr> |
|
265 <tr> |
|
266 <td><a href="#CodeStyleFixer.__multilineStringLines">__multilineStringLines</a></td> |
|
267 <td>Private method to determine the line numbers that are within multi line strings and these which are part of a documentation string.</td> |
|
268 </tr> |
|
269 <tr> |
|
270 <td><a href="#CodeStyleFixer.finalize">finalize</a></td> |
|
271 <td>Public method to apply all deferred fixes.</td> |
|
272 </tr> |
|
273 <tr> |
|
274 <td><a href="#CodeStyleFixer.fixIssue">fixIssue</a></td> |
|
275 <td>Public method to fix the fixable issues.</td> |
|
276 </tr> |
|
277 <tr> |
|
278 <td><a href="#CodeStyleFixer.mutualStartswith">mutualStartswith</a></td> |
|
279 <td>Local helper method to compare the beginnings of two strings against each other.</td> |
|
280 </tr> |
|
281 <tr> |
|
282 <td><a href="#CodeStyleFixer.saveFile">saveFile</a></td> |
|
283 <td>Public method to save the modified file.</td> |
|
284 </tr> |
|
285 </table> |
|
286 <h3>Static Methods</h3> |
|
287 |
|
288 <table> |
|
289 <tr><td>None</td></tr> |
|
290 </table> |
|
291 |
|
292 <a NAME="CodeStyleFixer.__init__" ID="CodeStyleFixer.__init__"></a> |
|
293 <h4>CodeStyleFixer (Constructor)</h4> |
|
294 <b>CodeStyleFixer</b>(<i>filename, sourceLines, fixCodes, noFixCodes, maxLineLength, blankLines, inPlace, eol, backup=False</i>) |
|
295 |
|
296 <p> |
|
297 Constructor |
|
298 </p> |
|
299 <dl> |
|
300 |
|
301 <dt><i>filename</i> (str)</dt> |
|
302 <dd> |
|
303 name of the file to be fixed |
|
304 </dd> |
|
305 <dt><i>sourceLines</i> (list of str)</dt> |
|
306 <dd> |
|
307 list of source lines including eol marker |
|
308 </dd> |
|
309 <dt><i>fixCodes</i> (str)</dt> |
|
310 <dd> |
|
311 list of codes to be fixed as a comma separated |
|
312 string |
|
313 </dd> |
|
314 <dt><i>noFixCodes</i> (str)</dt> |
|
315 <dd> |
|
316 list of codes not to be fixed as a comma |
|
317 separated string |
|
318 </dd> |
|
319 <dt><i>maxLineLength</i> (int)</dt> |
|
320 <dd> |
|
321 maximum allowed line length |
|
322 </dd> |
|
323 <dt><i>blankLines</i> (tuple of (int, int))</dt> |
|
324 <dd> |
|
325 tuple containg the number of blank lines before |
|
326 a top level class or function and before a method or nested class |
|
327 or function |
|
328 </dd> |
|
329 <dt><i>inPlace</i> (bool)</dt> |
|
330 <dd> |
|
331 flag indicating to modify the file in place |
|
332 </dd> |
|
333 <dt><i>eol</i> (str)</dt> |
|
334 <dd> |
|
335 end of line character(s) |
|
336 </dd> |
|
337 <dt><i>backup</i> (bool)</dt> |
|
338 <dd> |
|
339 flag indicating to create a backup before fixing |
|
340 anything |
|
341 </dd> |
|
342 </dl> |
|
343 <a NAME="CodeStyleFixer.__codeMatch" ID="CodeStyleFixer.__codeMatch"></a> |
|
344 <h4>CodeStyleFixer.__codeMatch</h4> |
|
345 <b>__codeMatch</b>(<i>code</i>) |
|
346 |
|
347 <p> |
|
348 Private method to check, if the code should be fixed. |
|
349 </p> |
|
350 <dl> |
|
351 |
|
352 <dt><i>code</i></dt> |
|
353 <dd> |
|
354 to check (string) |
|
355 </dd> |
|
356 </dl> |
|
357 <dl> |
|
358 <dt>Return:</dt> |
|
359 <dd> |
|
360 flag indicating it should be fixed (boolean) |
|
361 </dd> |
|
362 </dl> |
|
363 <a NAME="CodeStyleFixer.__findLogical" ID="CodeStyleFixer.__findLogical"></a> |
|
364 <h4>CodeStyleFixer.__findLogical</h4> |
|
365 <b>__findLogical</b>(<i></i>) |
|
366 |
|
367 <p> |
|
368 Private method to extract the index of all the starts and ends of |
|
369 lines. |
|
370 </p> |
|
371 <dl> |
|
372 <dt>Return:</dt> |
|
373 <dd> |
|
374 tuple containing two lists of integer with start and end tuples |
|
375 of lines |
|
376 </dd> |
|
377 </dl> |
|
378 <a NAME="CodeStyleFixer.__fixBlankLinesBefore" ID="CodeStyleFixer.__fixBlankLinesBefore"></a> |
|
379 <h4>CodeStyleFixer.__fixBlankLinesBefore</h4> |
|
380 <b>__fixBlankLinesBefore</b>(<i>code, line, pos, apply=False</i>) |
|
381 |
|
382 <p> |
|
383 Private method to fix the need for blank lines before class, function |
|
384 and method definitions. |
|
385 </p> |
|
386 <p> |
|
387 Codes: E301, E302, E303, E305, E306, E307, E308 |
|
388 </p> |
|
389 <dl> |
|
390 |
|
391 <dt><i>code</i> (str)</dt> |
|
392 <dd> |
|
393 code of the issue |
|
394 </dd> |
|
395 <dt><i>line</i> (int)</dt> |
|
396 <dd> |
|
397 line number of the issue |
|
398 </dd> |
|
399 <dt><i>pos</i> (int)</dt> |
|
400 <dd> |
|
401 position inside line |
|
402 </dd> |
|
403 <dt><i>apply</i> (bool)</dt> |
|
404 <dd> |
|
405 flag indicating, that the fix should be applied |
|
406 </dd> |
|
407 </dl> |
|
408 <dl> |
|
409 <dt>Return:</dt> |
|
410 <dd> |
|
411 value indicating an applied/deferred fix (-1, 0, 1), |
|
412 a message code for the fix, a list of arguments for the |
|
413 message and an ID for a deferred fix |
|
414 </dd> |
|
415 </dl> |
|
416 <dl> |
|
417 <dt>Return Type:</dt> |
|
418 <dd> |
|
419 tuple of (int, str, list or int, int) |
|
420 </dd> |
|
421 </dl> |
|
422 <a NAME="CodeStyleFixer.__fixD111" ID="CodeStyleFixer.__fixD111"></a> |
|
423 <h4>CodeStyleFixer.__fixD111</h4> |
|
424 <b>__fixD111</b>(<i>code, line, pos</i>) |
|
425 |
|
426 <p> |
|
427 Private method to fix docstring enclosed in wrong quotes. |
|
428 </p> |
|
429 <p> |
|
430 Codes: D111 |
|
431 </p> |
|
432 <dl> |
|
433 |
|
434 <dt><i>code</i> (str)</dt> |
|
435 <dd> |
|
436 code of the issue |
|
437 </dd> |
|
438 <dt><i>line</i> (int)</dt> |
|
439 <dd> |
|
440 line number of the issue |
|
441 </dd> |
|
442 <dt><i>pos</i> (int)</dt> |
|
443 <dd> |
|
444 position inside line |
|
445 </dd> |
|
446 </dl> |
|
447 <dl> |
|
448 <dt>Return:</dt> |
|
449 <dd> |
|
450 value indicating an applied/deferred fix (-1, 0, 1), |
|
451 a message code for the fix, a list of arguments for the |
|
452 message and an ID for a deferred fix |
|
453 </dd> |
|
454 </dl> |
|
455 <dl> |
|
456 <dt>Return Type:</dt> |
|
457 <dd> |
|
458 tuple of (int, str, list or int, int) |
|
459 </dd> |
|
460 </dl> |
|
461 <a NAME="CodeStyleFixer.__fixD112" ID="CodeStyleFixer.__fixD112"></a> |
|
462 <h4>CodeStyleFixer.__fixD112</h4> |
|
463 <b>__fixD112</b>(<i>code, line, pos</i>) |
|
464 |
|
465 <p> |
|
466 Private method to fix docstring 'r' in leading quotes. |
|
467 </p> |
|
468 <p> |
|
469 Codes: D112 |
|
470 </p> |
|
471 <dl> |
|
472 |
|
473 <dt><i>code</i> (str)</dt> |
|
474 <dd> |
|
475 code of the issue |
|
476 </dd> |
|
477 <dt><i>line</i> (int)</dt> |
|
478 <dd> |
|
479 line number of the issue |
|
480 </dd> |
|
481 <dt><i>pos</i> (int)</dt> |
|
482 <dd> |
|
483 position inside line |
|
484 </dd> |
|
485 </dl> |
|
486 <dl> |
|
487 <dt>Return:</dt> |
|
488 <dd> |
|
489 value indicating an applied/deferred fix (-1, 0, 1), |
|
490 a message code for the fix, a list of arguments for the |
|
491 message and an ID for a deferred fix |
|
492 </dd> |
|
493 </dl> |
|
494 <dl> |
|
495 <dt>Return Type:</dt> |
|
496 <dd> |
|
497 tuple of (int, str, list or int, int) |
|
498 </dd> |
|
499 </dl> |
|
500 <a NAME="CodeStyleFixer.__fixD121" ID="CodeStyleFixer.__fixD121"></a> |
|
501 <h4>CodeStyleFixer.__fixD121</h4> |
|
502 <b>__fixD121</b>(<i>code, line, pos, apply=False</i>) |
|
503 |
|
504 <p> |
|
505 Private method to fix a single line docstring on multiple lines. |
|
506 </p> |
|
507 <p> |
|
508 Codes: D121 |
|
509 </p> |
|
510 <dl> |
|
511 |
|
512 <dt><i>code</i> (str)</dt> |
|
513 <dd> |
|
514 code of the issue |
|
515 </dd> |
|
516 <dt><i>line</i> (int)</dt> |
|
517 <dd> |
|
518 line number of the issue |
|
519 </dd> |
|
520 <dt><i>pos</i> (int)</dt> |
|
521 <dd> |
|
522 position inside line |
|
523 </dd> |
|
524 <dt><i>apply</i> (bool)</dt> |
|
525 <dd> |
|
526 flag indicating, that the fix should be applied |
|
527 </dd> |
|
528 </dl> |
|
529 <dl> |
|
530 <dt>Return:</dt> |
|
531 <dd> |
|
532 value indicating an applied/deferred fix (-1, 0, 1), |
|
533 a message code for the fix, a list of arguments for the |
|
534 message and an ID for a deferred fix |
|
535 </dd> |
|
536 </dl> |
|
537 <dl> |
|
538 <dt>Return Type:</dt> |
|
539 <dd> |
|
540 tuple of (int, str, list or int, int) |
|
541 </dd> |
|
542 </dl> |
|
543 <a NAME="CodeStyleFixer.__fixD131" ID="CodeStyleFixer.__fixD131"></a> |
|
544 <h4>CodeStyleFixer.__fixD131</h4> |
|
545 <b>__fixD131</b>(<i>code, line, pos</i>) |
|
546 |
|
547 <p> |
|
548 Private method to fix a docstring summary not ending with a |
|
549 period. |
|
550 </p> |
|
551 <p> |
|
552 Codes: D131 |
|
553 </p> |
|
554 <dl> |
|
555 |
|
556 <dt><i>code</i> (str)</dt> |
|
557 <dd> |
|
558 code of the issue |
|
559 </dd> |
|
560 <dt><i>line</i> (int)</dt> |
|
561 <dd> |
|
562 line number of the issue |
|
563 </dd> |
|
564 <dt><i>pos</i> (int)</dt> |
|
565 <dd> |
|
566 position inside line |
|
567 </dd> |
|
568 </dl> |
|
569 <dl> |
|
570 <dt>Return:</dt> |
|
571 <dd> |
|
572 value indicating an applied/deferred fix (-1, 0, 1), |
|
573 a message code for the fix, a list of arguments for the |
|
574 message and an ID for a deferred fix |
|
575 </dd> |
|
576 </dl> |
|
577 <dl> |
|
578 <dt>Return Type:</dt> |
|
579 <dd> |
|
580 tuple of (int, str, list or int, int) |
|
581 </dd> |
|
582 </dl> |
|
583 <a NAME="CodeStyleFixer.__fixD141" ID="CodeStyleFixer.__fixD141"></a> |
|
584 <h4>CodeStyleFixer.__fixD141</h4> |
|
585 <b>__fixD141</b>(<i>code, line, pos, apply=False</i>) |
|
586 |
|
587 <p> |
|
588 Private method to fix a function/method docstring preceded by a |
|
589 blank line. |
|
590 </p> |
|
591 <p> |
|
592 Codes: D141 |
|
593 </p> |
|
594 <dl> |
|
595 |
|
596 <dt><i>code</i> (str)</dt> |
|
597 <dd> |
|
598 code of the issue |
|
599 </dd> |
|
600 <dt><i>line</i> (int)</dt> |
|
601 <dd> |
|
602 line number of the issue |
|
603 </dd> |
|
604 <dt><i>pos</i> (int)</dt> |
|
605 <dd> |
|
606 position inside line |
|
607 </dd> |
|
608 <dt><i>apply</i> (bool)</dt> |
|
609 <dd> |
|
610 flag indicating, that the fix should be applied |
|
611 </dd> |
|
612 </dl> |
|
613 <dl> |
|
614 <dt>Return:</dt> |
|
615 <dd> |
|
616 value indicating an applied/deferred fix (-1, 0, 1), |
|
617 a message code for the fix, a list of arguments for the |
|
618 message and an ID for a deferred fix |
|
619 </dd> |
|
620 </dl> |
|
621 <dl> |
|
622 <dt>Return Type:</dt> |
|
623 <dd> |
|
624 tuple of (int, str, list or int, int) |
|
625 </dd> |
|
626 </dl> |
|
627 <a NAME="CodeStyleFixer.__fixD142" ID="CodeStyleFixer.__fixD142"></a> |
|
628 <h4>CodeStyleFixer.__fixD142</h4> |
|
629 <b>__fixD142</b>(<i>code, line, pos, apply=False</i>) |
|
630 |
|
631 <p> |
|
632 Private method to fix a class docstring not preceded by a |
|
633 blank line. |
|
634 </p> |
|
635 <p> |
|
636 Codes: D142 |
|
637 </p> |
|
638 <dl> |
|
639 |
|
640 <dt><i>code</i> (str)</dt> |
|
641 <dd> |
|
642 code of the issue |
|
643 </dd> |
|
644 <dt><i>line</i> (int)</dt> |
|
645 <dd> |
|
646 line number of the issue |
|
647 </dd> |
|
648 <dt><i>pos</i> (int)</dt> |
|
649 <dd> |
|
650 position inside line |
|
651 </dd> |
|
652 <dt><i>apply</i> (bool)</dt> |
|
653 <dd> |
|
654 flag indicating, that the fix should be applied |
|
655 </dd> |
|
656 </dl> |
|
657 <dl> |
|
658 <dt>Return:</dt> |
|
659 <dd> |
|
660 value indicating an applied/deferred fix (-1, 0, 1), |
|
661 a message code for the fix, a list of arguments for the |
|
662 message and an ID for a deferred fix |
|
663 </dd> |
|
664 </dl> |
|
665 <dl> |
|
666 <dt>Return Type:</dt> |
|
667 <dd> |
|
668 tuple of (int, str, list or int, int) |
|
669 </dd> |
|
670 </dl> |
|
671 <a NAME="CodeStyleFixer.__fixD143" ID="CodeStyleFixer.__fixD143"></a> |
|
672 <h4>CodeStyleFixer.__fixD143</h4> |
|
673 <b>__fixD143</b>(<i>code, line, pos, apply=False</i>) |
|
674 |
|
675 <p> |
|
676 Private method to fix a class docstring not followed by a |
|
677 blank line. |
|
678 </p> |
|
679 <p> |
|
680 Codes: D143 |
|
681 </p> |
|
682 <dl> |
|
683 |
|
684 <dt><i>code</i> (str)</dt> |
|
685 <dd> |
|
686 code of the issue |
|
687 </dd> |
|
688 <dt><i>line</i> (int)</dt> |
|
689 <dd> |
|
690 line number of the issue |
|
691 </dd> |
|
692 <dt><i>pos</i> (int)</dt> |
|
693 <dd> |
|
694 position inside line |
|
695 </dd> |
|
696 <dt><i>apply</i> (bool)</dt> |
|
697 <dd> |
|
698 flag indicating, that the fix should be applied |
|
699 </dd> |
|
700 </dl> |
|
701 <dl> |
|
702 <dt>Return:</dt> |
|
703 <dd> |
|
704 value indicating an applied/deferred fix (-1, 0, 1), |
|
705 a message code for the fix, a list of arguments for the |
|
706 message and an ID for a deferred fix |
|
707 </dd> |
|
708 </dl> |
|
709 <dl> |
|
710 <dt>Return Type:</dt> |
|
711 <dd> |
|
712 tuple of (int, str, list or int, int) |
|
713 </dd> |
|
714 </dl> |
|
715 <a NAME="CodeStyleFixer.__fixD144" ID="CodeStyleFixer.__fixD144"></a> |
|
716 <h4>CodeStyleFixer.__fixD144</h4> |
|
717 <b>__fixD144</b>(<i>code, line, pos, apply=False</i>) |
|
718 |
|
719 <p> |
|
720 Private method to fix a docstring summary not followed by a |
|
721 blank line. |
|
722 </p> |
|
723 <p> |
|
724 Codes: D144 |
|
725 </p> |
|
726 <dl> |
|
727 |
|
728 <dt><i>code</i> (str)</dt> |
|
729 <dd> |
|
730 code of the issue |
|
731 </dd> |
|
732 <dt><i>line</i> (int)</dt> |
|
733 <dd> |
|
734 line number of the issue |
|
735 </dd> |
|
736 <dt><i>pos</i> (int)</dt> |
|
737 <dd> |
|
738 position inside line |
|
739 </dd> |
|
740 <dt><i>apply</i> (bool)</dt> |
|
741 <dd> |
|
742 flag indicating, that the fix should be applied |
|
743 </dd> |
|
744 </dl> |
|
745 <dl> |
|
746 <dt>Return:</dt> |
|
747 <dd> |
|
748 value indicating an applied/deferred fix (-1, 0, 1), |
|
749 a message code for the fix, a list of arguments for the |
|
750 message and an ID for a deferred fix |
|
751 </dd> |
|
752 </dl> |
|
753 <dl> |
|
754 <dt>Return Type:</dt> |
|
755 <dd> |
|
756 tuple of (int, str, list or int, int) |
|
757 </dd> |
|
758 </dl> |
|
759 <a NAME="CodeStyleFixer.__fixD145" ID="CodeStyleFixer.__fixD145"></a> |
|
760 <h4>CodeStyleFixer.__fixD145</h4> |
|
761 <b>__fixD145</b>(<i>code, line, pos, apply=False</i>) |
|
762 |
|
763 <p> |
|
764 Private method to fix the last paragraph of a multi-line docstring |
|
765 not followed by a blank line. |
|
766 </p> |
|
767 <p> |
|
768 Codes: D143 |
|
769 </p> |
|
770 <dl> |
|
771 |
|
772 <dt><i>code</i> (str)</dt> |
|
773 <dd> |
|
774 code of the issue |
|
775 </dd> |
|
776 <dt><i>line</i> (int)</dt> |
|
777 <dd> |
|
778 line number of the issue |
|
779 </dd> |
|
780 <dt><i>pos</i> (int)</dt> |
|
781 <dd> |
|
782 position inside line |
|
783 </dd> |
|
784 <dt><i>apply</i> (bool)</dt> |
|
785 <dd> |
|
786 flag indicating, that the fix should be applied |
|
787 </dd> |
|
788 </dl> |
|
789 <dl> |
|
790 <dt>Return:</dt> |
|
791 <dd> |
|
792 value indicating an applied/deferred fix (-1, 0, 1), |
|
793 a message code for the fix, a list of arguments for the |
|
794 message and an ID for a deferred fix |
|
795 </dd> |
|
796 </dl> |
|
797 <dl> |
|
798 <dt>Return Type:</dt> |
|
799 <dd> |
|
800 tuple of (int, str, list or int, int) |
|
801 </dd> |
|
802 </dl> |
|
803 <a NAME="CodeStyleFixer.__fixD221" ID="CodeStyleFixer.__fixD221"></a> |
|
804 <h4>CodeStyleFixer.__fixD221</h4> |
|
805 <b>__fixD221</b>(<i>code, line, pos, apply=False</i>) |
|
806 |
|
807 <p> |
|
808 Private method to fix leading and trailing quotes of docstring |
|
809 not on separate lines. |
|
810 </p> |
|
811 <p> |
|
812 Codes: D221, D222 |
|
813 </p> |
|
814 <dl> |
|
815 |
|
816 <dt><i>code</i> (str)</dt> |
|
817 <dd> |
|
818 code of the issue |
|
819 </dd> |
|
820 <dt><i>line</i> (int)</dt> |
|
821 <dd> |
|
822 line number of the issue |
|
823 </dd> |
|
824 <dt><i>pos</i> (int)</dt> |
|
825 <dd> |
|
826 position inside line |
|
827 </dd> |
|
828 <dt><i>apply</i> (bool)</dt> |
|
829 <dd> |
|
830 flag indicating, that the fix should be applied |
|
831 </dd> |
|
832 </dl> |
|
833 <dl> |
|
834 <dt>Return:</dt> |
|
835 <dd> |
|
836 value indicating an applied/deferred fix (-1, 0, 1), |
|
837 a message code for the fix, a list of arguments for the |
|
838 message and an ID for a deferred fix |
|
839 </dd> |
|
840 </dl> |
|
841 <dl> |
|
842 <dt>Return Type:</dt> |
|
843 <dd> |
|
844 tuple of (int, str, list or int, int) |
|
845 </dd> |
|
846 </dl> |
|
847 <a NAME="CodeStyleFixer.__fixD242" ID="CodeStyleFixer.__fixD242"></a> |
|
848 <h4>CodeStyleFixer.__fixD242</h4> |
|
849 <b>__fixD242</b>(<i>code, line, pos, apply=False</i>) |
|
850 |
|
851 <p> |
|
852 Private method to fix a class or function/method docstring preceded |
|
853 by a blank line. |
|
854 </p> |
|
855 <p> |
|
856 Codes: D242, D244 |
|
857 </p> |
|
858 <dl> |
|
859 |
|
860 <dt><i>code</i> (str)</dt> |
|
861 <dd> |
|
862 code of the issue |
|
863 </dd> |
|
864 <dt><i>line</i> (int)</dt> |
|
865 <dd> |
|
866 line number of the issue |
|
867 </dd> |
|
868 <dt><i>pos</i> (int)</dt> |
|
869 <dd> |
|
870 position inside line |
|
871 </dd> |
|
872 <dt><i>apply</i> (bool)</dt> |
|
873 <dd> |
|
874 flag indicating, that the fix should be applied |
|
875 </dd> |
|
876 </dl> |
|
877 <dl> |
|
878 <dt>Return:</dt> |
|
879 <dd> |
|
880 value indicating an applied/deferred fix (-1, 0, 1), |
|
881 a message code for the fix, a list of arguments for the |
|
882 message and an ID for a deferred fix |
|
883 </dd> |
|
884 </dl> |
|
885 <dl> |
|
886 <dt>Return Type:</dt> |
|
887 <dd> |
|
888 tuple of (int, str, list or int, int) |
|
889 </dd> |
|
890 </dl> |
|
891 <a NAME="CodeStyleFixer.__fixD243" ID="CodeStyleFixer.__fixD243"></a> |
|
892 <h4>CodeStyleFixer.__fixD243</h4> |
|
893 <b>__fixD243</b>(<i>code, line, pos, apply=False</i>) |
|
894 |
|
895 <p> |
|
896 Private method to fix a class or function/method docstring followed |
|
897 by a blank line. |
|
898 </p> |
|
899 <p> |
|
900 Codes: D243, D245 |
|
901 </p> |
|
902 <dl> |
|
903 |
|
904 <dt><i>code</i> (str)</dt> |
|
905 <dd> |
|
906 code of the issue |
|
907 </dd> |
|
908 <dt><i>line</i> (int)</dt> |
|
909 <dd> |
|
910 line number of the issue |
|
911 </dd> |
|
912 <dt><i>pos</i> (int)</dt> |
|
913 <dd> |
|
914 position inside line |
|
915 </dd> |
|
916 <dt><i>apply</i> (bool)</dt> |
|
917 <dd> |
|
918 flag indicating, that the fix should be applied |
|
919 </dd> |
|
920 </dl> |
|
921 <dl> |
|
922 <dt>Return:</dt> |
|
923 <dd> |
|
924 value indicating an applied/deferred fix (-1, 0, 1), |
|
925 a message code for the fix, a list of arguments for the |
|
926 message and an ID for a deferred fix |
|
927 </dd> |
|
928 </dl> |
|
929 <dl> |
|
930 <dt>Return Type:</dt> |
|
931 <dd> |
|
932 tuple of (int, str, list or int, int) |
|
933 </dd> |
|
934 </dl> |
|
935 <a NAME="CodeStyleFixer.__fixD247" ID="CodeStyleFixer.__fixD247"></a> |
|
936 <h4>CodeStyleFixer.__fixD247</h4> |
|
937 <b>__fixD247</b>(<i>code, line, pos, apply=False</i>) |
|
938 |
|
939 <p> |
|
940 Private method to fix a last paragraph of a docstring followed |
|
941 by a blank line. |
|
942 </p> |
|
943 <p> |
|
944 Codes: D247 |
|
945 </p> |
|
946 <dl> |
|
947 |
|
948 <dt><i>code</i> (str)</dt> |
|
949 <dd> |
|
950 code of the issue |
|
951 </dd> |
|
952 <dt><i>line</i> (int)</dt> |
|
953 <dd> |
|
954 line number of the issue |
|
955 </dd> |
|
956 <dt><i>pos</i> (int)</dt> |
|
957 <dd> |
|
958 position inside line |
|
959 </dd> |
|
960 <dt><i>apply</i> (bool)</dt> |
|
961 <dd> |
|
962 flag indicating, that the fix should be applied |
|
963 </dd> |
|
964 </dl> |
|
965 <dl> |
|
966 <dt>Return:</dt> |
|
967 <dd> |
|
968 value indicating an applied/deferred fix (-1, 0, 1), |
|
969 a message code for the fix, a list of arguments for the |
|
970 message and an ID for a deferred fix |
|
971 </dd> |
|
972 </dl> |
|
973 <dl> |
|
974 <dt>Return Type:</dt> |
|
975 <dd> |
|
976 tuple of (int, str, list or int, int) |
|
977 </dd> |
|
978 </dl> |
|
979 <a NAME="CodeStyleFixer.__fixE101" ID="CodeStyleFixer.__fixE101"></a> |
|
980 <h4>CodeStyleFixer.__fixE101</h4> |
|
981 <b>__fixE101</b>(<i>code, line, pos</i>) |
|
982 |
|
983 <p> |
|
984 Private method to fix obsolete tab usage and indentation errors. |
|
985 </p> |
|
986 <p> |
|
987 Codes: E101, E111, W191 |
|
988 </p> |
|
989 <dl> |
|
990 |
|
991 <dt><i>code</i> (str)</dt> |
|
992 <dd> |
|
993 code of the issue |
|
994 </dd> |
|
995 <dt><i>line</i> (int)</dt> |
|
996 <dd> |
|
997 line number of the issue |
|
998 </dd> |
|
999 <dt><i>pos</i> (int)</dt> |
|
1000 <dd> |
|
1001 position inside line |
|
1002 </dd> |
|
1003 </dl> |
|
1004 <dl> |
|
1005 <dt>Return:</dt> |
|
1006 <dd> |
|
1007 value indicating an applied/deferred fix (-1, 0, 1), |
|
1008 a message code for the fix, a list of arguments for the |
|
1009 message and an ID for a deferred fix |
|
1010 </dd> |
|
1011 </dl> |
|
1012 <dl> |
|
1013 <dt>Return Type:</dt> |
|
1014 <dd> |
|
1015 tuple of (int, str, list or int, int) |
|
1016 </dd> |
|
1017 </dl> |
|
1018 <a NAME="CodeStyleFixer.__fixE121" ID="CodeStyleFixer.__fixE121"></a> |
|
1019 <h4>CodeStyleFixer.__fixE121</h4> |
|
1020 <b>__fixE121</b>(<i>code, line, pos, apply=False</i>) |
|
1021 |
|
1022 <p> |
|
1023 Private method to fix the indentation of continuation lines and |
|
1024 closing brackets. |
|
1025 </p> |
|
1026 <p> |
|
1027 Codes: E121, E124 |
|
1028 </p> |
|
1029 <dl> |
|
1030 |
|
1031 <dt><i>code</i> (str)</dt> |
|
1032 <dd> |
|
1033 code of the issue |
|
1034 </dd> |
|
1035 <dt><i>line</i> (int)</dt> |
|
1036 <dd> |
|
1037 line number of the issue |
|
1038 </dd> |
|
1039 <dt><i>pos</i> (int)</dt> |
|
1040 <dd> |
|
1041 position inside line |
|
1042 </dd> |
|
1043 <dt><i>apply</i> (bool)</dt> |
|
1044 <dd> |
|
1045 flag indicating, that the fix should be applied |
|
1046 </dd> |
|
1047 </dl> |
|
1048 <dl> |
|
1049 <dt>Return:</dt> |
|
1050 <dd> |
|
1051 value indicating an applied/deferred fix (-1, 0, 1), |
|
1052 a message code for the fix, a list of arguments for the |
|
1053 message and an ID for a deferred fix |
|
1054 </dd> |
|
1055 </dl> |
|
1056 <dl> |
|
1057 <dt>Return Type:</dt> |
|
1058 <dd> |
|
1059 tuple of (int, str, list or int, int) |
|
1060 </dd> |
|
1061 </dl> |
|
1062 <a NAME="CodeStyleFixer.__fixE122" ID="CodeStyleFixer.__fixE122"></a> |
|
1063 <h4>CodeStyleFixer.__fixE122</h4> |
|
1064 <b>__fixE122</b>(<i>code, line, pos, apply=False</i>) |
|
1065 |
|
1066 <p> |
|
1067 Private method to fix a missing indentation of continuation lines. |
|
1068 </p> |
|
1069 <p> |
|
1070 Codes: E122 |
|
1071 </p> |
|
1072 <dl> |
|
1073 |
|
1074 <dt><i>code</i> (str)</dt> |
|
1075 <dd> |
|
1076 code of the issue |
|
1077 </dd> |
|
1078 <dt><i>line</i> (int)</dt> |
|
1079 <dd> |
|
1080 line number of the issue |
|
1081 </dd> |
|
1082 <dt><i>pos</i> (int)</dt> |
|
1083 <dd> |
|
1084 position inside line |
|
1085 </dd> |
|
1086 <dt><i>apply</i> (bool)</dt> |
|
1087 <dd> |
|
1088 flag indicating, that the fix should be applied |
|
1089 </dd> |
|
1090 </dl> |
|
1091 <dl> |
|
1092 <dt>Return:</dt> |
|
1093 <dd> |
|
1094 value indicating an applied/deferred fix (-1, 0, 1), |
|
1095 a message code for the fix, a list of arguments for the |
|
1096 message and an ID for a deferred fix |
|
1097 </dd> |
|
1098 </dl> |
|
1099 <dl> |
|
1100 <dt>Return Type:</dt> |
|
1101 <dd> |
|
1102 tuple of (int, str, list or int, int) |
|
1103 </dd> |
|
1104 </dl> |
|
1105 <a NAME="CodeStyleFixer.__fixE123" ID="CodeStyleFixer.__fixE123"></a> |
|
1106 <h4>CodeStyleFixer.__fixE123</h4> |
|
1107 <b>__fixE123</b>(<i>code, line, pos, apply=False</i>) |
|
1108 |
|
1109 <p> |
|
1110 Private method to fix the indentation of a closing bracket lines. |
|
1111 </p> |
|
1112 <p> |
|
1113 Codes: E123 |
|
1114 </p> |
|
1115 <dl> |
|
1116 |
|
1117 <dt><i>code</i> (str)</dt> |
|
1118 <dd> |
|
1119 code of the issue |
|
1120 </dd> |
|
1121 <dt><i>line</i> (int)</dt> |
|
1122 <dd> |
|
1123 line number of the issue |
|
1124 </dd> |
|
1125 <dt><i>pos</i> (int)</dt> |
|
1126 <dd> |
|
1127 position inside line |
|
1128 </dd> |
|
1129 <dt><i>apply</i> (bool)</dt> |
|
1130 <dd> |
|
1131 flag indicating, that the fix should be applied |
|
1132 </dd> |
|
1133 </dl> |
|
1134 <dl> |
|
1135 <dt>Return:</dt> |
|
1136 <dd> |
|
1137 value indicating an applied/deferred fix (-1, 0, 1), |
|
1138 a message code for the fix, a list of arguments for the |
|
1139 message and an ID for a deferred fix |
|
1140 </dd> |
|
1141 </dl> |
|
1142 <dl> |
|
1143 <dt>Return Type:</dt> |
|
1144 <dd> |
|
1145 tuple of (int, str, list or int, int) |
|
1146 </dd> |
|
1147 </dl> |
|
1148 <a NAME="CodeStyleFixer.__fixE125" ID="CodeStyleFixer.__fixE125"></a> |
|
1149 <h4>CodeStyleFixer.__fixE125</h4> |
|
1150 <b>__fixE125</b>(<i>code, line, pos, apply=False</i>) |
|
1151 |
|
1152 <p> |
|
1153 Private method to fix the indentation of continuation lines not |
|
1154 distinguishable from next logical line. |
|
1155 </p> |
|
1156 <p> |
|
1157 Codes: E125 |
|
1158 </p> |
|
1159 <dl> |
|
1160 |
|
1161 <dt><i>code</i> (str)</dt> |
|
1162 <dd> |
|
1163 code of the issue |
|
1164 </dd> |
|
1165 <dt><i>line</i> (int)</dt> |
|
1166 <dd> |
|
1167 line number of the issue |
|
1168 </dd> |
|
1169 <dt><i>pos</i> (int)</dt> |
|
1170 <dd> |
|
1171 position inside line |
|
1172 </dd> |
|
1173 <dt><i>apply</i> (bool)</dt> |
|
1174 <dd> |
|
1175 flag indicating, that the fix should be applied |
|
1176 </dd> |
|
1177 </dl> |
|
1178 <dl> |
|
1179 <dt>Return:</dt> |
|
1180 <dd> |
|
1181 value indicating an applied/deferred fix (-1, 0, 1), |
|
1182 a message code for the fix, a list of arguments for the |
|
1183 message and an ID for a deferred fix |
|
1184 </dd> |
|
1185 </dl> |
|
1186 <dl> |
|
1187 <dt>Return Type:</dt> |
|
1188 <dd> |
|
1189 tuple of (int, str, list or int, int) |
|
1190 </dd> |
|
1191 </dl> |
|
1192 <a NAME="CodeStyleFixer.__fixE126" ID="CodeStyleFixer.__fixE126"></a> |
|
1193 <h4>CodeStyleFixer.__fixE126</h4> |
|
1194 <b>__fixE126</b>(<i>code, line, pos, apply=False</i>) |
|
1195 |
|
1196 <p> |
|
1197 Private method to fix over-indented/under-indented hanging |
|
1198 indentation. |
|
1199 </p> |
|
1200 <p> |
|
1201 Codes: E126, E133 |
|
1202 </p> |
|
1203 <dl> |
|
1204 |
|
1205 <dt><i>code</i> (str)</dt> |
|
1206 <dd> |
|
1207 code of the issue |
|
1208 </dd> |
|
1209 <dt><i>line</i> (int)</dt> |
|
1210 <dd> |
|
1211 line number of the issue |
|
1212 </dd> |
|
1213 <dt><i>pos</i> (int)</dt> |
|
1214 <dd> |
|
1215 position inside line |
|
1216 </dd> |
|
1217 <dt><i>apply</i> (bool)</dt> |
|
1218 <dd> |
|
1219 flag indicating, that the fix should be applied |
|
1220 </dd> |
|
1221 </dl> |
|
1222 <dl> |
|
1223 <dt>Return:</dt> |
|
1224 <dd> |
|
1225 value indicating an applied/deferred fix (-1, 0, 1), |
|
1226 a message code for the fix, a list of arguments for the |
|
1227 message and an ID for a deferred fix |
|
1228 </dd> |
|
1229 </dl> |
|
1230 <dl> |
|
1231 <dt>Return Type:</dt> |
|
1232 <dd> |
|
1233 tuple of (int, str, list or int, int) |
|
1234 </dd> |
|
1235 </dl> |
|
1236 <a NAME="CodeStyleFixer.__fixE127" ID="CodeStyleFixer.__fixE127"></a> |
|
1237 <h4>CodeStyleFixer.__fixE127</h4> |
|
1238 <b>__fixE127</b>(<i>code, line, pos, apply=False</i>) |
|
1239 |
|
1240 <p> |
|
1241 Private method to fix over/under indented lines. |
|
1242 </p> |
|
1243 <p> |
|
1244 Codes: E127, E128 |
|
1245 </p> |
|
1246 <dl> |
|
1247 |
|
1248 <dt><i>code</i> (str)</dt> |
|
1249 <dd> |
|
1250 code of the issue |
|
1251 </dd> |
|
1252 <dt><i>line</i> (int)</dt> |
|
1253 <dd> |
|
1254 line number of the issue |
|
1255 </dd> |
|
1256 <dt><i>pos</i> (int)</dt> |
|
1257 <dd> |
|
1258 position inside line |
|
1259 </dd> |
|
1260 <dt><i>apply</i> (bool)</dt> |
|
1261 <dd> |
|
1262 flag indicating, that the fix should be applied |
|
1263 </dd> |
|
1264 </dl> |
|
1265 <dl> |
|
1266 <dt>Return:</dt> |
|
1267 <dd> |
|
1268 value indicating an applied/deferred fix (-1, 0, 1), |
|
1269 a message code for the fix, a list of arguments for the |
|
1270 message and an ID for a deferred fix |
|
1271 </dd> |
|
1272 </dl> |
|
1273 <dl> |
|
1274 <dt>Return Type:</dt> |
|
1275 <dd> |
|
1276 tuple of (int, str, list or int, int) |
|
1277 </dd> |
|
1278 </dl> |
|
1279 <a NAME="CodeStyleFixer.__fixE201" ID="CodeStyleFixer.__fixE201"></a> |
|
1280 <h4>CodeStyleFixer.__fixE201</h4> |
|
1281 <b>__fixE201</b>(<i>code, line, pos</i>) |
|
1282 |
|
1283 <p> |
|
1284 Private method to fix extraneous whitespace. |
|
1285 </p> |
|
1286 <p> |
|
1287 Codes: E201, E202, E203, E211 |
|
1288 </p> |
|
1289 <dl> |
|
1290 |
|
1291 <dt><i>code</i> (str)</dt> |
|
1292 <dd> |
|
1293 code of the issue |
|
1294 </dd> |
|
1295 <dt><i>line</i> (int)</dt> |
|
1296 <dd> |
|
1297 line number of the issue |
|
1298 </dd> |
|
1299 <dt><i>pos</i> (int)</dt> |
|
1300 <dd> |
|
1301 position inside line |
|
1302 </dd> |
|
1303 </dl> |
|
1304 <dl> |
|
1305 <dt>Return:</dt> |
|
1306 <dd> |
|
1307 value indicating an applied/deferred fix (-1, 0, 1), |
|
1308 a message code for the fix, a list of arguments for the |
|
1309 message and an ID for a deferred fix |
|
1310 </dd> |
|
1311 </dl> |
|
1312 <dl> |
|
1313 <dt>Return Type:</dt> |
|
1314 <dd> |
|
1315 tuple of (int, str, list or int, int) |
|
1316 </dd> |
|
1317 </dl> |
|
1318 <a NAME="CodeStyleFixer.__fixE221" ID="CodeStyleFixer.__fixE221"></a> |
|
1319 <h4>CodeStyleFixer.__fixE221</h4> |
|
1320 <b>__fixE221</b>(<i>code, line, pos</i>) |
|
1321 |
|
1322 <p> |
|
1323 Private method to fix extraneous whitespace around operator or |
|
1324 keyword. |
|
1325 </p> |
|
1326 <p> |
|
1327 Codes: E221, E222, E223, E224, E241, E242, E271, E272, E273, E274 |
|
1328 </p> |
|
1329 <dl> |
|
1330 |
|
1331 <dt><i>code</i> (str)</dt> |
|
1332 <dd> |
|
1333 code of the issue |
|
1334 </dd> |
|
1335 <dt><i>line</i> (int)</dt> |
|
1336 <dd> |
|
1337 line number of the issue |
|
1338 </dd> |
|
1339 <dt><i>pos</i> (int)</dt> |
|
1340 <dd> |
|
1341 position inside line |
|
1342 </dd> |
|
1343 </dl> |
|
1344 <dl> |
|
1345 <dt>Return:</dt> |
|
1346 <dd> |
|
1347 value indicating an applied/deferred fix (-1, 0, 1), |
|
1348 a message code for the fix, a list of arguments for the |
|
1349 message and an ID for a deferred fix |
|
1350 </dd> |
|
1351 </dl> |
|
1352 <dl> |
|
1353 <dt>Return Type:</dt> |
|
1354 <dd> |
|
1355 tuple of (int, str, list or int, int) |
|
1356 </dd> |
|
1357 </dl> |
|
1358 <a NAME="CodeStyleFixer.__fixE225" ID="CodeStyleFixer.__fixE225"></a> |
|
1359 <h4>CodeStyleFixer.__fixE225</h4> |
|
1360 <b>__fixE225</b>(<i>code, line, pos</i>) |
|
1361 |
|
1362 <p> |
|
1363 Private method to fix extraneous whitespaces around operator. |
|
1364 </p> |
|
1365 <p> |
|
1366 Codes: E225, E226, E227, E228 |
|
1367 </p> |
|
1368 <dl> |
|
1369 |
|
1370 <dt><i>code</i> (str)</dt> |
|
1371 <dd> |
|
1372 code of the issue |
|
1373 </dd> |
|
1374 <dt><i>line</i> (int)</dt> |
|
1375 <dd> |
|
1376 line number of the issue |
|
1377 </dd> |
|
1378 <dt><i>pos</i> (int)</dt> |
|
1379 <dd> |
|
1380 position inside line |
|
1381 </dd> |
|
1382 </dl> |
|
1383 <dl> |
|
1384 <dt>Return:</dt> |
|
1385 <dd> |
|
1386 value indicating an applied/deferred fix (-1, 0, 1), |
|
1387 a message code for the fix, a list of arguments for the |
|
1388 message and an ID for a deferred fix |
|
1389 </dd> |
|
1390 </dl> |
|
1391 <dl> |
|
1392 <dt>Return Type:</dt> |
|
1393 <dd> |
|
1394 tuple of (int, str, list or int, int) |
|
1395 </dd> |
|
1396 </dl> |
|
1397 <a NAME="CodeStyleFixer.__fixE231" ID="CodeStyleFixer.__fixE231"></a> |
|
1398 <h4>CodeStyleFixer.__fixE231</h4> |
|
1399 <b>__fixE231</b>(<i>code, line, pos</i>) |
|
1400 |
|
1401 <p> |
|
1402 Private method to fix missing whitespace after ',;:'. |
|
1403 </p> |
|
1404 <p> |
|
1405 Codes: E231 |
|
1406 </p> |
|
1407 <dl> |
|
1408 |
|
1409 <dt><i>code</i> (str)</dt> |
|
1410 <dd> |
|
1411 code of the issue |
|
1412 </dd> |
|
1413 <dt><i>line</i> (int)</dt> |
|
1414 <dd> |
|
1415 line number of the issue |
|
1416 </dd> |
|
1417 <dt><i>pos</i> (int)</dt> |
|
1418 <dd> |
|
1419 position inside line |
|
1420 </dd> |
|
1421 </dl> |
|
1422 <dl> |
|
1423 <dt>Return:</dt> |
|
1424 <dd> |
|
1425 value indicating an applied/deferred fix (-1, 0, 1), |
|
1426 a message code for the fix, a list of arguments for the |
|
1427 message and an ID for a deferred fix |
|
1428 </dd> |
|
1429 </dl> |
|
1430 <dl> |
|
1431 <dt>Return Type:</dt> |
|
1432 <dd> |
|
1433 tuple of (int, str, list or int, int) |
|
1434 </dd> |
|
1435 </dl> |
|
1436 <a NAME="CodeStyleFixer.__fixE251" ID="CodeStyleFixer.__fixE251"></a> |
|
1437 <h4>CodeStyleFixer.__fixE251</h4> |
|
1438 <b>__fixE251</b>(<i>code, line, pos</i>) |
|
1439 |
|
1440 <p> |
|
1441 Private method to fix extraneous whitespace around keyword and |
|
1442 default parameter equals. |
|
1443 </p> |
|
1444 <p> |
|
1445 Codes: E251 |
|
1446 </p> |
|
1447 <dl> |
|
1448 |
|
1449 <dt><i>code</i> (str)</dt> |
|
1450 <dd> |
|
1451 code of the issue |
|
1452 </dd> |
|
1453 <dt><i>line</i> (int)</dt> |
|
1454 <dd> |
|
1455 line number of the issue |
|
1456 </dd> |
|
1457 <dt><i>pos</i> (int)</dt> |
|
1458 <dd> |
|
1459 position inside line |
|
1460 </dd> |
|
1461 </dl> |
|
1462 <dl> |
|
1463 <dt>Return:</dt> |
|
1464 <dd> |
|
1465 value indicating an applied/deferred fix (-1, 0, 1), |
|
1466 a message code for the fix, a list of arguments for the |
|
1467 message and an ID for a deferred fix |
|
1468 </dd> |
|
1469 </dl> |
|
1470 <dl> |
|
1471 <dt>Return Type:</dt> |
|
1472 <dd> |
|
1473 tuple of (int, str, list or int, int) |
|
1474 </dd> |
|
1475 </dl> |
|
1476 <a NAME="CodeStyleFixer.__fixE261" ID="CodeStyleFixer.__fixE261"></a> |
|
1477 <h4>CodeStyleFixer.__fixE261</h4> |
|
1478 <b>__fixE261</b>(<i>code, line, pos</i>) |
|
1479 |
|
1480 <p> |
|
1481 Private method to fix whitespace before or after inline comment. |
|
1482 </p> |
|
1483 <p> |
|
1484 Codes: E261, E262 |
|
1485 </p> |
|
1486 <dl> |
|
1487 |
|
1488 <dt><i>code</i> (str)</dt> |
|
1489 <dd> |
|
1490 code of the issue |
|
1491 </dd> |
|
1492 <dt><i>line</i> (int)</dt> |
|
1493 <dd> |
|
1494 line number of the issue |
|
1495 </dd> |
|
1496 <dt><i>pos</i> (int)</dt> |
|
1497 <dd> |
|
1498 position inside line |
|
1499 </dd> |
|
1500 </dl> |
|
1501 <dl> |
|
1502 <dt>Return:</dt> |
|
1503 <dd> |
|
1504 value indicating an applied/deferred fix (-1, 0, 1), |
|
1505 a message code for the fix, a list of arguments for the |
|
1506 message and an ID for a deferred fix |
|
1507 </dd> |
|
1508 </dl> |
|
1509 <dl> |
|
1510 <dt>Return Type:</dt> |
|
1511 <dd> |
|
1512 tuple of (int, str, list or int, int) |
|
1513 </dd> |
|
1514 </dl> |
|
1515 <a NAME="CodeStyleFixer.__fixE304" ID="CodeStyleFixer.__fixE304"></a> |
|
1516 <h4>CodeStyleFixer.__fixE304</h4> |
|
1517 <b>__fixE304</b>(<i>code, line, pos, apply=False</i>) |
|
1518 |
|
1519 <p> |
|
1520 Private method to fix superfluous blank lines after a function |
|
1521 decorator. |
|
1522 </p> |
|
1523 <p> |
|
1524 Codes: E304 |
|
1525 </p> |
|
1526 <dl> |
|
1527 |
|
1528 <dt><i>code</i> (str)</dt> |
|
1529 <dd> |
|
1530 code of the issue |
|
1531 </dd> |
|
1532 <dt><i>line</i> (int)</dt> |
|
1533 <dd> |
|
1534 line number of the issue |
|
1535 </dd> |
|
1536 <dt><i>pos</i> (int)</dt> |
|
1537 <dd> |
|
1538 position inside line |
|
1539 </dd> |
|
1540 <dt><i>apply</i> (bool)</dt> |
|
1541 <dd> |
|
1542 flag indicating, that the fix should be applied |
|
1543 </dd> |
|
1544 </dl> |
|
1545 <dl> |
|
1546 <dt>Return:</dt> |
|
1547 <dd> |
|
1548 value indicating an applied/deferred fix (-1, 0, 1), |
|
1549 a message code for the fix, a list of arguments for the |
|
1550 message and an ID for a deferred fix |
|
1551 </dd> |
|
1552 </dl> |
|
1553 <dl> |
|
1554 <dt>Return Type:</dt> |
|
1555 <dd> |
|
1556 tuple of (int, str, list or int, int) |
|
1557 </dd> |
|
1558 </dl> |
|
1559 <a NAME="CodeStyleFixer.__fixE401" ID="CodeStyleFixer.__fixE401"></a> |
|
1560 <h4>CodeStyleFixer.__fixE401</h4> |
|
1561 <b>__fixE401</b>(<i>code, line, pos, apply=False</i>) |
|
1562 |
|
1563 <p> |
|
1564 Private method to fix multiple imports on one line. |
|
1565 </p> |
|
1566 <p> |
|
1567 Codes: E401 |
|
1568 </p> |
|
1569 <dl> |
|
1570 |
|
1571 <dt><i>code</i> (str)</dt> |
|
1572 <dd> |
|
1573 code of the issue |
|
1574 </dd> |
|
1575 <dt><i>line</i> (int)</dt> |
|
1576 <dd> |
|
1577 line number of the issue |
|
1578 </dd> |
|
1579 <dt><i>pos</i> (int)</dt> |
|
1580 <dd> |
|
1581 position inside line |
|
1582 </dd> |
|
1583 <dt><i>apply</i> (bool)</dt> |
|
1584 <dd> |
|
1585 flag indicating, that the fix should be applied |
|
1586 </dd> |
|
1587 </dl> |
|
1588 <dl> |
|
1589 <dt>Return:</dt> |
|
1590 <dd> |
|
1591 value indicating an applied/deferred fix (-1, 0, 1), |
|
1592 a message code for the fix, a list of arguments for the |
|
1593 message and an ID for a deferred fix |
|
1594 </dd> |
|
1595 </dl> |
|
1596 <dl> |
|
1597 <dt>Return Type:</dt> |
|
1598 <dd> |
|
1599 tuple of (int, str, list or int, int) |
|
1600 </dd> |
|
1601 </dl> |
|
1602 <a NAME="CodeStyleFixer.__fixE501" ID="CodeStyleFixer.__fixE501"></a> |
|
1603 <h4>CodeStyleFixer.__fixE501</h4> |
|
1604 <b>__fixE501</b>(<i>code, line, pos, apply=False</i>) |
|
1605 |
|
1606 <p> |
|
1607 Private method to fix the long lines by breaking them. |
|
1608 </p> |
|
1609 <p> |
|
1610 Codes: E501 |
|
1611 </p> |
|
1612 <dl> |
|
1613 |
|
1614 <dt><i>code</i> (str)</dt> |
|
1615 <dd> |
|
1616 code of the issue |
|
1617 </dd> |
|
1618 <dt><i>line</i> (int)</dt> |
|
1619 <dd> |
|
1620 line number of the issue |
|
1621 </dd> |
|
1622 <dt><i>pos</i> (int)</dt> |
|
1623 <dd> |
|
1624 position inside line |
|
1625 </dd> |
|
1626 <dt><i>apply</i> (bool)</dt> |
|
1627 <dd> |
|
1628 flag indicating, that the fix should be applied |
|
1629 </dd> |
|
1630 </dl> |
|
1631 <dl> |
|
1632 <dt>Return:</dt> |
|
1633 <dd> |
|
1634 value indicating an applied/deferred fix (-1, 0, 1), |
|
1635 a message code for the fix, a list of arguments for the |
|
1636 message and an ID for a deferred fix |
|
1637 </dd> |
|
1638 </dl> |
|
1639 <dl> |
|
1640 <dt>Return Type:</dt> |
|
1641 <dd> |
|
1642 tuple of (int, str, list or int, int) |
|
1643 </dd> |
|
1644 </dl> |
|
1645 <a NAME="CodeStyleFixer.__fixE502" ID="CodeStyleFixer.__fixE502"></a> |
|
1646 <h4>CodeStyleFixer.__fixE502</h4> |
|
1647 <b>__fixE502</b>(<i>code, line, pos</i>) |
|
1648 |
|
1649 <p> |
|
1650 Private method to fix redundant backslash within brackets. |
|
1651 </p> |
|
1652 <p> |
|
1653 Codes: E502 |
|
1654 </p> |
|
1655 <dl> |
|
1656 |
|
1657 <dt><i>code</i> (str)</dt> |
|
1658 <dd> |
|
1659 code of the issue |
|
1660 </dd> |
|
1661 <dt><i>line</i> (int)</dt> |
|
1662 <dd> |
|
1663 line number of the issue |
|
1664 </dd> |
|
1665 <dt><i>pos</i> (int)</dt> |
|
1666 <dd> |
|
1667 position inside line |
|
1668 </dd> |
|
1669 </dl> |
|
1670 <dl> |
|
1671 <dt>Return:</dt> |
|
1672 <dd> |
|
1673 value indicating an applied/deferred fix (-1, 0, 1), |
|
1674 a message code for the fix, a list of arguments for the |
|
1675 message and an ID for a deferred fix |
|
1676 </dd> |
|
1677 </dl> |
|
1678 <dl> |
|
1679 <dt>Return Type:</dt> |
|
1680 <dd> |
|
1681 tuple of (int, str, list or int, int) |
|
1682 </dd> |
|
1683 </dl> |
|
1684 <a NAME="CodeStyleFixer.__fixE701" ID="CodeStyleFixer.__fixE701"></a> |
|
1685 <h4>CodeStyleFixer.__fixE701</h4> |
|
1686 <b>__fixE701</b>(<i>code, line, pos, apply=False</i>) |
|
1687 |
|
1688 <p> |
|
1689 Private method to fix colon-separated compound statements. |
|
1690 </p> |
|
1691 <p> |
|
1692 Codes: E701 |
|
1693 </p> |
|
1694 <dl> |
|
1695 |
|
1696 <dt><i>code</i> (str)</dt> |
|
1697 <dd> |
|
1698 code of the issue |
|
1699 </dd> |
|
1700 <dt><i>line</i> (int)</dt> |
|
1701 <dd> |
|
1702 line number of the issue |
|
1703 </dd> |
|
1704 <dt><i>pos</i> (int)</dt> |
|
1705 <dd> |
|
1706 position inside line |
|
1707 </dd> |
|
1708 <dt><i>apply</i> (bool)</dt> |
|
1709 <dd> |
|
1710 flag indicating, that the fix should be applied |
|
1711 </dd> |
|
1712 </dl> |
|
1713 <dl> |
|
1714 <dt>Return:</dt> |
|
1715 <dd> |
|
1716 value indicating an applied/deferred fix (-1, 0, 1), |
|
1717 a message code for the fix, a list of arguments for the |
|
1718 message and an ID for a deferred fix |
|
1719 </dd> |
|
1720 </dl> |
|
1721 <dl> |
|
1722 <dt>Return Type:</dt> |
|
1723 <dd> |
|
1724 tuple of (int, str, list or int, int) |
|
1725 </dd> |
|
1726 </dl> |
|
1727 <a NAME="CodeStyleFixer.__fixE702" ID="CodeStyleFixer.__fixE702"></a> |
|
1728 <h4>CodeStyleFixer.__fixE702</h4> |
|
1729 <b>__fixE702</b>(<i>code, line, pos, apply=False</i>) |
|
1730 |
|
1731 <p> |
|
1732 Private method to fix semicolon-separated compound statements. |
|
1733 </p> |
|
1734 <p> |
|
1735 Codes: E702, E703 |
|
1736 </p> |
|
1737 <dl> |
|
1738 |
|
1739 <dt><i>code</i> (str)</dt> |
|
1740 <dd> |
|
1741 code of the issue |
|
1742 </dd> |
|
1743 <dt><i>line</i> (int)</dt> |
|
1744 <dd> |
|
1745 line number of the issue |
|
1746 </dd> |
|
1747 <dt><i>pos</i> (int)</dt> |
|
1748 <dd> |
|
1749 position inside line |
|
1750 </dd> |
|
1751 <dt><i>apply</i> (bool)</dt> |
|
1752 <dd> |
|
1753 flag indicating, that the fix should be applied |
|
1754 </dd> |
|
1755 </dl> |
|
1756 <dl> |
|
1757 <dt>Return:</dt> |
|
1758 <dd> |
|
1759 value indicating an applied/deferred fix (-1, 0, 1), |
|
1760 a message code for the fix, a list of arguments for the |
|
1761 message and an ID for a deferred fix |
|
1762 </dd> |
|
1763 </dl> |
|
1764 <dl> |
|
1765 <dt>Return Type:</dt> |
|
1766 <dd> |
|
1767 tuple of (int, str, list or int, int) |
|
1768 </dd> |
|
1769 </dl> |
|
1770 <a NAME="CodeStyleFixer.__fixE711" ID="CodeStyleFixer.__fixE711"></a> |
|
1771 <h4>CodeStyleFixer.__fixE711</h4> |
|
1772 <b>__fixE711</b>(<i>code, line, pos</i>) |
|
1773 |
|
1774 <p> |
|
1775 Private method to fix comparison with None. |
|
1776 </p> |
|
1777 <p> |
|
1778 Codes: E711, E712 |
|
1779 </p> |
|
1780 <dl> |
|
1781 |
|
1782 <dt><i>code</i> (str)</dt> |
|
1783 <dd> |
|
1784 code of the issue |
|
1785 </dd> |
|
1786 <dt><i>line</i> (int)</dt> |
|
1787 <dd> |
|
1788 line number of the issue |
|
1789 </dd> |
|
1790 <dt><i>pos</i> (int)</dt> |
|
1791 <dd> |
|
1792 position inside line |
|
1793 </dd> |
|
1794 </dl> |
|
1795 <dl> |
|
1796 <dt>Return:</dt> |
|
1797 <dd> |
|
1798 value indicating an applied/deferred fix (-1, 0, 1), |
|
1799 a message code for the fix, a list of arguments for the |
|
1800 message and an ID for a deferred fix |
|
1801 </dd> |
|
1802 </dl> |
|
1803 <dl> |
|
1804 <dt>Return Type:</dt> |
|
1805 <dd> |
|
1806 tuple of (int, str, list or int, int) |
|
1807 </dd> |
|
1808 </dl> |
|
1809 <a NAME="CodeStyleFixer.__fixN804" ID="CodeStyleFixer.__fixN804"></a> |
|
1810 <h4>CodeStyleFixer.__fixN804</h4> |
|
1811 <b>__fixN804</b>(<i>code, line, pos, apply=False</i>) |
|
1812 |
|
1813 <p> |
|
1814 Private method to fix a wrong first argument of normal and |
|
1815 class methods. |
|
1816 </p> |
|
1817 <p> |
|
1818 Codes: N804, N805 |
|
1819 </p> |
|
1820 <dl> |
|
1821 |
|
1822 <dt><i>code</i> (str)</dt> |
|
1823 <dd> |
|
1824 code of the issue |
|
1825 </dd> |
|
1826 <dt><i>line</i> (int)</dt> |
|
1827 <dd> |
|
1828 line number of the issue |
|
1829 </dd> |
|
1830 <dt><i>pos</i> (int)</dt> |
|
1831 <dd> |
|
1832 position inside line |
|
1833 </dd> |
|
1834 <dt><i>apply</i> (bool)</dt> |
|
1835 <dd> |
|
1836 flag indicating, that the fix should be applied |
|
1837 </dd> |
|
1838 </dl> |
|
1839 <dl> |
|
1840 <dt>Return:</dt> |
|
1841 <dd> |
|
1842 value indicating an applied/deferred fix (-1, 0, 1), |
|
1843 a message code for the fix, a list of arguments for the |
|
1844 message and an ID for a deferred fix |
|
1845 </dd> |
|
1846 </dl> |
|
1847 <dl> |
|
1848 <dt>Return Type:</dt> |
|
1849 <dd> |
|
1850 tuple of (int, str, list or int, int) |
|
1851 </dd> |
|
1852 </dl> |
|
1853 <a NAME="CodeStyleFixer.__fixN806" ID="CodeStyleFixer.__fixN806"></a> |
|
1854 <h4>CodeStyleFixer.__fixN806</h4> |
|
1855 <b>__fixN806</b>(<i>code, line, pos, apply=False</i>) |
|
1856 |
|
1857 <p> |
|
1858 Private method to fix a wrong first argument of static methods. |
|
1859 </p> |
|
1860 <p> |
|
1861 Codes: N806 |
|
1862 </p> |
|
1863 <dl> |
|
1864 |
|
1865 <dt><i>code</i> (str)</dt> |
|
1866 <dd> |
|
1867 code of the issue |
|
1868 </dd> |
|
1869 <dt><i>line</i> (int)</dt> |
|
1870 <dd> |
|
1871 line number of the issue |
|
1872 </dd> |
|
1873 <dt><i>pos</i> (int)</dt> |
|
1874 <dd> |
|
1875 position inside line |
|
1876 </dd> |
|
1877 <dt><i>apply</i> (bool)</dt> |
|
1878 <dd> |
|
1879 flag indicating, that the fix should be applied |
|
1880 </dd> |
|
1881 </dl> |
|
1882 <dl> |
|
1883 <dt>Return:</dt> |
|
1884 <dd> |
|
1885 value indicating an applied/deferred fix (-1, 0, 1), |
|
1886 a message code for the fix, a list of arguments for the |
|
1887 message and an ID for a deferred fix |
|
1888 </dd> |
|
1889 </dl> |
|
1890 <dl> |
|
1891 <dt>Return Type:</dt> |
|
1892 <dd> |
|
1893 tuple of (int, str, list or int, int) |
|
1894 </dd> |
|
1895 </dl> |
|
1896 <a NAME="CodeStyleFixer.__fixReindent" ID="CodeStyleFixer.__fixReindent"></a> |
|
1897 <h4>CodeStyleFixer.__fixReindent</h4> |
|
1898 <b>__fixReindent</b>(<i>line, pos, logical</i>) |
|
1899 |
|
1900 <p> |
|
1901 Private method to fix a badly indented line. |
|
1902 </p> |
|
1903 <p> |
|
1904 This is done by adding or removing from its initial indent only. |
|
1905 </p> |
|
1906 <dl> |
|
1907 |
|
1908 <dt><i>line</i></dt> |
|
1909 <dd> |
|
1910 line number of the issue (integer) |
|
1911 </dd> |
|
1912 <dt><i>pos</i></dt> |
|
1913 <dd> |
|
1914 position inside line (integer) |
|
1915 </dd> |
|
1916 <dt><i>logical</i></dt> |
|
1917 <dd> |
|
1918 logical line structure |
|
1919 </dd> |
|
1920 </dl> |
|
1921 <dl> |
|
1922 <dt>Return:</dt> |
|
1923 <dd> |
|
1924 flag indicating a change was done (boolean) |
|
1925 </dd> |
|
1926 </dl> |
|
1927 <dl> |
|
1928 |
|
1929 <dt>Raises <b>ValueError</b>:</dt> |
|
1930 <dd> |
|
1931 raised to indicate a bad 'logical' parameter |
|
1932 </dd> |
|
1933 </dl> |
|
1934 <a NAME="CodeStyleFixer.__fixW291" ID="CodeStyleFixer.__fixW291"></a> |
|
1935 <h4>CodeStyleFixer.__fixW291</h4> |
|
1936 <b>__fixW291</b>(<i>code, line, pos</i>) |
|
1937 |
|
1938 <p> |
|
1939 Private method to fix trailing whitespace. |
|
1940 </p> |
|
1941 <p> |
|
1942 Codes: W291, W293 |
|
1943 </p> |
|
1944 <dl> |
|
1945 |
|
1946 <dt><i>code</i> (str)</dt> |
|
1947 <dd> |
|
1948 code of the issue |
|
1949 </dd> |
|
1950 <dt><i>line</i> (int)</dt> |
|
1951 <dd> |
|
1952 line number of the issue |
|
1953 </dd> |
|
1954 <dt><i>pos</i> (int)</dt> |
|
1955 <dd> |
|
1956 position inside line |
|
1957 </dd> |
|
1958 </dl> |
|
1959 <dl> |
|
1960 <dt>Return:</dt> |
|
1961 <dd> |
|
1962 value indicating an applied/deferred fix (-1, 0, 1), |
|
1963 a message code for the fix, a list of arguments for the |
|
1964 message and an ID for a deferred fix |
|
1965 </dd> |
|
1966 </dl> |
|
1967 <dl> |
|
1968 <dt>Return Type:</dt> |
|
1969 <dd> |
|
1970 tuple of (int, str, list or int, int) |
|
1971 </dd> |
|
1972 </dl> |
|
1973 <a NAME="CodeStyleFixer.__fixW292" ID="CodeStyleFixer.__fixW292"></a> |
|
1974 <h4>CodeStyleFixer.__fixW292</h4> |
|
1975 <b>__fixW292</b>(<i>code, line, pos</i>) |
|
1976 |
|
1977 <p> |
|
1978 Private method to fix a missing newline at the end of file. |
|
1979 </p> |
|
1980 <p> |
|
1981 Codes: W292 |
|
1982 </p> |
|
1983 <dl> |
|
1984 |
|
1985 <dt><i>code</i> (str)</dt> |
|
1986 <dd> |
|
1987 code of the issue |
|
1988 </dd> |
|
1989 <dt><i>line</i> (int)</dt> |
|
1990 <dd> |
|
1991 line number of the issue |
|
1992 </dd> |
|
1993 <dt><i>pos</i> (int)</dt> |
|
1994 <dd> |
|
1995 position inside line |
|
1996 </dd> |
|
1997 </dl> |
|
1998 <dl> |
|
1999 <dt>Return:</dt> |
|
2000 <dd> |
|
2001 value indicating an applied/deferred fix (-1, 0, 1), |
|
2002 a message code for the fix, a list of arguments for the |
|
2003 message and an ID for a deferred fix |
|
2004 </dd> |
|
2005 </dl> |
|
2006 <dl> |
|
2007 <dt>Return Type:</dt> |
|
2008 <dd> |
|
2009 tuple of (int, str, list or int, int) |
|
2010 </dd> |
|
2011 </dl> |
|
2012 <a NAME="CodeStyleFixer.__fixW391" ID="CodeStyleFixer.__fixW391"></a> |
|
2013 <h4>CodeStyleFixer.__fixW391</h4> |
|
2014 <b>__fixW391</b>(<i>code, line, pos</i>) |
|
2015 |
|
2016 <p> |
|
2017 Private method to fix trailing blank lines. |
|
2018 </p> |
|
2019 <p> |
|
2020 Codes: W391 |
|
2021 </p> |
|
2022 <dl> |
|
2023 |
|
2024 <dt><i>code</i> (str)</dt> |
|
2025 <dd> |
|
2026 code of the issue |
|
2027 </dd> |
|
2028 <dt><i>line</i> (int)</dt> |
|
2029 <dd> |
|
2030 line number of the issue |
|
2031 </dd> |
|
2032 <dt><i>pos</i> (int)</dt> |
|
2033 <dd> |
|
2034 position inside line |
|
2035 </dd> |
|
2036 </dl> |
|
2037 <dl> |
|
2038 <dt>Return:</dt> |
|
2039 <dd> |
|
2040 value indicating an applied/deferred fix (-1, 0, 1), |
|
2041 a message code for the fix, a list of arguments for the |
|
2042 message and an ID for a deferred fix |
|
2043 </dd> |
|
2044 </dl> |
|
2045 <dl> |
|
2046 <dt>Return Type:</dt> |
|
2047 <dd> |
|
2048 tuple of (int, str, list or int, int) |
|
2049 </dd> |
|
2050 </dl> |
|
2051 <a NAME="CodeStyleFixer.__fixW603" ID="CodeStyleFixer.__fixW603"></a> |
|
2052 <h4>CodeStyleFixer.__fixW603</h4> |
|
2053 <b>__fixW603</b>(<i>code, line, pos</i>) |
|
2054 |
|
2055 <p> |
|
2056 Private method to fix the not equal notation. |
|
2057 </p> |
|
2058 <p> |
|
2059 Codes: W603 |
|
2060 </p> |
|
2061 <dl> |
|
2062 |
|
2063 <dt><i>code</i> (str)</dt> |
|
2064 <dd> |
|
2065 code of the issue |
|
2066 </dd> |
|
2067 <dt><i>line</i> (int)</dt> |
|
2068 <dd> |
|
2069 line number of the issue |
|
2070 </dd> |
|
2071 <dt><i>pos</i> (int)</dt> |
|
2072 <dd> |
|
2073 position inside line |
|
2074 </dd> |
|
2075 </dl> |
|
2076 <dl> |
|
2077 <dt>Return:</dt> |
|
2078 <dd> |
|
2079 value indicating an applied/deferred fix (-1, 0, 1), |
|
2080 a message code for the fix, a list of arguments for the |
|
2081 message and an ID for a deferred fix |
|
2082 </dd> |
|
2083 </dl> |
|
2084 <dl> |
|
2085 <dt>Return Type:</dt> |
|
2086 <dd> |
|
2087 tuple of (int, str, list or int, int) |
|
2088 </dd> |
|
2089 </dl> |
|
2090 <a NAME="CodeStyleFixer.__fixWhitespace" ID="CodeStyleFixer.__fixWhitespace"></a> |
|
2091 <h4>CodeStyleFixer.__fixWhitespace</h4> |
|
2092 <b>__fixWhitespace</b>(<i>line, offset, replacement</i>) |
|
2093 |
|
2094 <p> |
|
2095 Private method to correct whitespace at the given offset. |
|
2096 </p> |
|
2097 <dl> |
|
2098 |
|
2099 <dt><i>line</i></dt> |
|
2100 <dd> |
|
2101 line to be corrected (string) |
|
2102 </dd> |
|
2103 <dt><i>offset</i></dt> |
|
2104 <dd> |
|
2105 offset within line (integer) |
|
2106 </dd> |
|
2107 <dt><i>replacement</i></dt> |
|
2108 <dd> |
|
2109 replacement string (string) |
|
2110 </dd> |
|
2111 </dl> |
|
2112 <dl> |
|
2113 <dt>Return:</dt> |
|
2114 <dd> |
|
2115 corrected line |
|
2116 </dd> |
|
2117 </dl> |
|
2118 <a NAME="CodeStyleFixer.__getID" ID="CodeStyleFixer.__getID"></a> |
|
2119 <h4>CodeStyleFixer.__getID</h4> |
|
2120 <b>__getID</b>(<i></i>) |
|
2121 |
|
2122 <p> |
|
2123 Private method to get the ID for a deferred fix. |
|
2124 </p> |
|
2125 <dl> |
|
2126 <dt>Return:</dt> |
|
2127 <dd> |
|
2128 ID for a deferred fix (integer) |
|
2129 </dd> |
|
2130 </dl> |
|
2131 <a NAME="CodeStyleFixer.__getIndent" ID="CodeStyleFixer.__getIndent"></a> |
|
2132 <h4>CodeStyleFixer.__getIndent</h4> |
|
2133 <b>__getIndent</b>(<i>line</i>) |
|
2134 |
|
2135 <p> |
|
2136 Private method to get the indentation string. |
|
2137 </p> |
|
2138 <dl> |
|
2139 |
|
2140 <dt><i>line</i></dt> |
|
2141 <dd> |
|
2142 line to determine the indentation string from (string) |
|
2143 </dd> |
|
2144 </dl> |
|
2145 <dl> |
|
2146 <dt>Return:</dt> |
|
2147 <dd> |
|
2148 indentation string (string) |
|
2149 </dd> |
|
2150 </dl> |
|
2151 <a NAME="CodeStyleFixer.__getIndentWord" ID="CodeStyleFixer.__getIndentWord"></a> |
|
2152 <h4>CodeStyleFixer.__getIndentWord</h4> |
|
2153 <b>__getIndentWord</b>(<i></i>) |
|
2154 |
|
2155 <p> |
|
2156 Private method to determine the indentation type. |
|
2157 </p> |
|
2158 <dl> |
|
2159 <dt>Return:</dt> |
|
2160 <dd> |
|
2161 string to be used for an indentation (string) |
|
2162 </dd> |
|
2163 </dl> |
|
2164 <a NAME="CodeStyleFixer.__getLogical" ID="CodeStyleFixer.__getLogical"></a> |
|
2165 <h4>CodeStyleFixer.__getLogical</h4> |
|
2166 <b>__getLogical</b>(<i>line, pos</i>) |
|
2167 |
|
2168 <p> |
|
2169 Private method to get the logical line corresponding to the given |
|
2170 position. |
|
2171 </p> |
|
2172 <dl> |
|
2173 |
|
2174 <dt><i>line</i></dt> |
|
2175 <dd> |
|
2176 line number of the issue (integer) |
|
2177 </dd> |
|
2178 <dt><i>pos</i></dt> |
|
2179 <dd> |
|
2180 position inside line (integer) |
|
2181 </dd> |
|
2182 </dl> |
|
2183 <dl> |
|
2184 <dt>Return:</dt> |
|
2185 <dd> |
|
2186 tuple of a tuple of two integers giving the start of the |
|
2187 logical line, another tuple of two integers giving the end |
|
2188 of the logical line and a list of strings with the original |
|
2189 source lines |
|
2190 </dd> |
|
2191 </dl> |
|
2192 <a NAME="CodeStyleFixer.__multilineStringLines" ID="CodeStyleFixer.__multilineStringLines"></a> |
|
2193 <h4>CodeStyleFixer.__multilineStringLines</h4> |
|
2194 <b>__multilineStringLines</b>(<i></i>) |
|
2195 |
|
2196 <p> |
|
2197 Private method to determine the line numbers that are within multi line |
|
2198 strings and these which are part of a documentation string. |
|
2199 </p> |
|
2200 <dl> |
|
2201 <dt>Return:</dt> |
|
2202 <dd> |
|
2203 tuple of a set of line numbers belonging to a multi line |
|
2204 string and a set of line numbers belonging to a multi line |
|
2205 documentation string (tuple of two set of integer) |
|
2206 </dd> |
|
2207 </dl> |
|
2208 <a NAME="CodeStyleFixer.finalize" ID="CodeStyleFixer.finalize"></a> |
|
2209 <h4>CodeStyleFixer.finalize</h4> |
|
2210 <b>finalize</b>(<i></i>) |
|
2211 |
|
2212 <p> |
|
2213 Public method to apply all deferred fixes. |
|
2214 </p> |
|
2215 <dl> |
|
2216 <dt>Return:</dt> |
|
2217 <dd> |
|
2218 dictionary containing the fix results |
|
2219 </dd> |
|
2220 </dl> |
|
2221 <a NAME="CodeStyleFixer.fixIssue" ID="CodeStyleFixer.fixIssue"></a> |
|
2222 <h4>CodeStyleFixer.fixIssue</h4> |
|
2223 <b>fixIssue</b>(<i>line, pos, code</i>) |
|
2224 |
|
2225 <p> |
|
2226 Public method to fix the fixable issues. |
|
2227 </p> |
|
2228 <dl> |
|
2229 |
|
2230 <dt><i>line</i> (int)</dt> |
|
2231 <dd> |
|
2232 line number of the issue |
|
2233 </dd> |
|
2234 <dt><i>pos</i> (int)</dt> |
|
2235 <dd> |
|
2236 position inside line |
|
2237 </dd> |
|
2238 <dt><i>code</i> (str)</dt> |
|
2239 <dd> |
|
2240 code of the issue |
|
2241 </dd> |
|
2242 </dl> |
|
2243 <dl> |
|
2244 <dt>Return:</dt> |
|
2245 <dd> |
|
2246 value indicating an applied/deferred fix (-1, 0, 1), |
|
2247 a message code for the fix, arguments list for the message |
|
2248 and an ID for a deferred fix |
|
2249 </dd> |
|
2250 </dl> |
|
2251 <dl> |
|
2252 <dt>Return Type:</dt> |
|
2253 <dd> |
|
2254 tuple of (int, str, list, int) |
|
2255 </dd> |
|
2256 </dl> |
|
2257 <a NAME="CodeStyleFixer.mutualStartswith" ID="CodeStyleFixer.mutualStartswith"></a> |
|
2258 <h4>CodeStyleFixer.mutualStartswith</h4> |
|
2259 <b>mutualStartswith</b>(<i>b</i>) |
|
2260 |
|
2261 <p> |
|
2262 Local helper method to compare the beginnings of two strings |
|
2263 against each other. |
|
2264 </p> |
|
2265 <dl> |
|
2266 <dt>Return:</dt> |
|
2267 <dd> |
|
2268 flag indicating that one string starts with the other |
|
2269 (boolean) |
|
2270 </dd> |
|
2271 </dl> |
|
2272 <a NAME="CodeStyleFixer.saveFile" ID="CodeStyleFixer.saveFile"></a> |
|
2273 <h4>CodeStyleFixer.saveFile</h4> |
|
2274 <b>saveFile</b>(<i>encoding</i>) |
|
2275 |
|
2276 <p> |
|
2277 Public method to save the modified file. |
|
2278 </p> |
|
2279 <dl> |
|
2280 |
|
2281 <dt><i>encoding</i></dt> |
|
2282 <dd> |
|
2283 encoding of the source file (string) |
|
2284 </dd> |
|
2285 </dl> |
|
2286 <dl> |
|
2287 <dt>Return:</dt> |
|
2288 <dd> |
|
2289 error message on failure (tuple of str) |
|
2290 </dd> |
|
2291 </dl> |
|
2292 <div align="right"><a href="#top">Up</a></div> |
|
2293 <hr /> |
|
2294 <hr /> |
|
2295 <a NAME="IndentationWrapper" ID="IndentationWrapper"></a> |
|
2296 <h2>IndentationWrapper</h2> |
|
2297 |
|
2298 <p> |
|
2299 Class used by fixers dealing with indentation. |
|
2300 </p> |
|
2301 <p> |
|
2302 Each instance operates on a single logical line. |
|
2303 </p> |
|
2304 <h3>Derived from</h3> |
|
2305 None |
|
2306 <h3>Class Attributes</h3> |
|
2307 |
|
2308 <table> |
|
2309 <tr><td>SKIP_TOKENS</td></tr> |
|
2310 </table> |
|
2311 <h3>Class Methods</h3> |
|
2312 |
|
2313 <table> |
|
2314 <tr><td>None</td></tr> |
|
2315 </table> |
|
2316 <h3>Methods</h3> |
|
2317 |
|
2318 <table> |
|
2319 |
|
2320 <tr> |
|
2321 <td><a href="#IndentationWrapper.__init__">IndentationWrapper</a></td> |
|
2322 <td>Constructor</td> |
|
2323 </tr> |
|
2324 <tr> |
|
2325 <td><a href="#IndentationWrapper.__buildTokensLogical">__buildTokensLogical</a></td> |
|
2326 <td>Private method to build a logical line from a list of tokens.</td> |
|
2327 </tr> |
|
2328 <tr> |
|
2329 <td><a href="#IndentationWrapper.pep8Expected">pep8Expected</a></td> |
|
2330 <td>Public method to replicate logic in pycodestyle.py, to know what level to indent things to.</td> |
|
2331 </tr> |
|
2332 </table> |
|
2333 <h3>Static Methods</h3> |
|
2334 |
|
2335 <table> |
|
2336 <tr><td>None</td></tr> |
|
2337 </table> |
|
2338 |
|
2339 <a NAME="IndentationWrapper.__init__" ID="IndentationWrapper.__init__"></a> |
|
2340 <h4>IndentationWrapper (Constructor)</h4> |
|
2341 <b>IndentationWrapper</b>(<i>physical_lines</i>) |
|
2342 |
|
2343 <p> |
|
2344 Constructor |
|
2345 </p> |
|
2346 <dl> |
|
2347 |
|
2348 <dt><i>physical_lines</i></dt> |
|
2349 <dd> |
|
2350 list of physical lines to operate on |
|
2351 (list of strings) |
|
2352 </dd> |
|
2353 </dl> |
|
2354 <a NAME="IndentationWrapper.__buildTokensLogical" ID="IndentationWrapper.__buildTokensLogical"></a> |
|
2355 <h4>IndentationWrapper.__buildTokensLogical</h4> |
|
2356 <b>__buildTokensLogical</b>(<i>tokens</i>) |
|
2357 |
|
2358 <p> |
|
2359 Private method to build a logical line from a list of tokens. |
|
2360 </p> |
|
2361 <dl> |
|
2362 |
|
2363 <dt><i>tokens</i></dt> |
|
2364 <dd> |
|
2365 list of tokens as generated by tokenize.generate_tokens |
|
2366 </dd> |
|
2367 </dl> |
|
2368 <dl> |
|
2369 <dt>Return:</dt> |
|
2370 <dd> |
|
2371 logical line (string) |
|
2372 </dd> |
|
2373 </dl> |
|
2374 <a NAME="IndentationWrapper.pep8Expected" ID="IndentationWrapper.pep8Expected"></a> |
|
2375 <h4>IndentationWrapper.pep8Expected</h4> |
|
2376 <b>pep8Expected</b>(<i></i>) |
|
2377 |
|
2378 <p> |
|
2379 Public method to replicate logic in pycodestyle.py, to know what level |
|
2380 to indent things to. |
|
2381 </p> |
|
2382 <dl> |
|
2383 <dt>Return:</dt> |
|
2384 <dd> |
|
2385 list of lists, where each list represents valid indent levels |
|
2386 for the line in question, relative from the initial indent. However, |
|
2387 the first entry is the indent level which was expected. |
|
2388 </dd> |
|
2389 </dl> |
|
2390 <div align="right"><a href="#top">Up</a></div> |
|
2391 <hr /> |
|
2392 <hr /> |
|
2393 <a NAME="LineShortener" ID="LineShortener"></a> |
|
2394 <h2>LineShortener</h2> |
|
2395 |
|
2396 <p> |
|
2397 Class used to shorten lines to a given maximum of characters. |
|
2398 </p> |
|
2399 <h3>Derived from</h3> |
|
2400 None |
|
2401 <h3>Class Attributes</h3> |
|
2402 |
|
2403 <table> |
|
2404 <tr><td>None</td></tr> |
|
2405 </table> |
|
2406 <h3>Class Methods</h3> |
|
2407 |
|
2408 <table> |
|
2409 <tr><td>None</td></tr> |
|
2410 </table> |
|
2411 <h3>Methods</h3> |
|
2412 |
|
2413 <table> |
|
2414 |
|
2415 <tr> |
|
2416 <td><a href="#LineShortener.__init__">LineShortener</a></td> |
|
2417 <td>Constructor</td> |
|
2418 </tr> |
|
2419 <tr> |
|
2420 <td><a href="#LineShortener.__breakMultiline">__breakMultiline</a></td> |
|
2421 <td>Private method to break multi line strings.</td> |
|
2422 </tr> |
|
2423 <tr> |
|
2424 <td><a href="#LineShortener.__checkSyntax">__checkSyntax</a></td> |
|
2425 <td>Private method to check the syntax of the given code fragment.</td> |
|
2426 </tr> |
|
2427 <tr> |
|
2428 <td><a href="#LineShortener.__countUnbalancedBrackets">__countUnbalancedBrackets</a></td> |
|
2429 <td>Private method to determine the number of unmatched open/close brackets.</td> |
|
2430 </tr> |
|
2431 <tr> |
|
2432 <td><a href="#LineShortener.__getIndent">__getIndent</a></td> |
|
2433 <td>Private method to get the indentation string.</td> |
|
2434 </tr> |
|
2435 <tr> |
|
2436 <td><a href="#LineShortener.__isProbablyInsideStringOrComment">__isProbablyInsideStringOrComment</a></td> |
|
2437 <td>Private method to check, if the given string might be inside a string or comment.</td> |
|
2438 </tr> |
|
2439 <tr> |
|
2440 <td><a href="#LineShortener.__lineShorteningRank">__lineShorteningRank</a></td> |
|
2441 <td>Private method to rank a candidate.</td> |
|
2442 </tr> |
|
2443 <tr> |
|
2444 <td><a href="#LineShortener.__normalizeMultiline">__normalizeMultiline</a></td> |
|
2445 <td>Private method to remove multiline-related code that will cause syntax error.</td> |
|
2446 </tr> |
|
2447 <tr> |
|
2448 <td><a href="#LineShortener.__shortenComment">__shortenComment</a></td> |
|
2449 <td>Private method to shorten a comment line.</td> |
|
2450 </tr> |
|
2451 <tr> |
|
2452 <td><a href="#LineShortener.__shortenLine">__shortenLine</a></td> |
|
2453 <td>Private method to shorten a line of code at an operator.</td> |
|
2454 </tr> |
|
2455 <tr> |
|
2456 <td><a href="#LineShortener.shorten">shorten</a></td> |
|
2457 <td>Public method to shorten the line wrapped by the class instance.</td> |
|
2458 </tr> |
|
2459 </table> |
|
2460 <h3>Static Methods</h3> |
|
2461 |
|
2462 <table> |
|
2463 <tr><td>None</td></tr> |
|
2464 </table> |
|
2465 |
|
2466 <a NAME="LineShortener.__init__" ID="LineShortener.__init__"></a> |
|
2467 <h4>LineShortener (Constructor)</h4> |
|
2468 <b>LineShortener</b>(<i>curLine, prevLine, nextLine, maxLength=88, eol="\n", indentWord=" ", isDocString=False</i>) |
|
2469 |
|
2470 <p> |
|
2471 Constructor |
|
2472 </p> |
|
2473 <dl> |
|
2474 |
|
2475 <dt><i>curLine</i></dt> |
|
2476 <dd> |
|
2477 text to work on (string) |
|
2478 </dd> |
|
2479 <dt><i>prevLine</i></dt> |
|
2480 <dd> |
|
2481 line before the text to work on (string) |
|
2482 </dd> |
|
2483 <dt><i>nextLine</i></dt> |
|
2484 <dd> |
|
2485 line after the text to work on (string) |
|
2486 </dd> |
|
2487 <dt><i>maxLength</i></dt> |
|
2488 <dd> |
|
2489 maximum allowed line length (integer) |
|
2490 </dd> |
|
2491 <dt><i>eol</i></dt> |
|
2492 <dd> |
|
2493 eond-of-line marker (string) |
|
2494 </dd> |
|
2495 <dt><i>indentWord</i></dt> |
|
2496 <dd> |
|
2497 string used for indentation (string) |
|
2498 </dd> |
|
2499 <dt><i>isDocString</i></dt> |
|
2500 <dd> |
|
2501 flag indicating that the line belongs to |
|
2502 a documentation string (boolean) |
|
2503 </dd> |
|
2504 </dl> |
|
2505 <a NAME="LineShortener.__breakMultiline" ID="LineShortener.__breakMultiline"></a> |
|
2506 <h4>LineShortener.__breakMultiline</h4> |
|
2507 <b>__breakMultiline</b>(<i></i>) |
|
2508 |
|
2509 <p> |
|
2510 Private method to break multi line strings. |
|
2511 </p> |
|
2512 <dl> |
|
2513 <dt>Return:</dt> |
|
2514 <dd> |
|
2515 tuple of the shortened line and the changed next line |
|
2516 (string, string) |
|
2517 </dd> |
|
2518 </dl> |
|
2519 <a NAME="LineShortener.__checkSyntax" ID="LineShortener.__checkSyntax"></a> |
|
2520 <h4>LineShortener.__checkSyntax</h4> |
|
2521 <b>__checkSyntax</b>(<i>code</i>) |
|
2522 |
|
2523 <p> |
|
2524 Private method to check the syntax of the given code fragment. |
|
2525 </p> |
|
2526 <dl> |
|
2527 |
|
2528 <dt><i>code</i></dt> |
|
2529 <dd> |
|
2530 code fragment to check (string) |
|
2531 </dd> |
|
2532 </dl> |
|
2533 <dl> |
|
2534 <dt>Return:</dt> |
|
2535 <dd> |
|
2536 flag indicating syntax is ok (boolean) |
|
2537 </dd> |
|
2538 </dl> |
|
2539 <a NAME="LineShortener.__countUnbalancedBrackets" ID="LineShortener.__countUnbalancedBrackets"></a> |
|
2540 <h4>LineShortener.__countUnbalancedBrackets</h4> |
|
2541 <b>__countUnbalancedBrackets</b>(<i>line</i>) |
|
2542 |
|
2543 <p> |
|
2544 Private method to determine the number of unmatched open/close |
|
2545 brackets. |
|
2546 </p> |
|
2547 <dl> |
|
2548 |
|
2549 <dt><i>line</i></dt> |
|
2550 <dd> |
|
2551 line to work at (string) |
|
2552 </dd> |
|
2553 </dl> |
|
2554 <dl> |
|
2555 <dt>Return:</dt> |
|
2556 <dd> |
|
2557 number of unmatched open/close brackets (integer) |
|
2558 </dd> |
|
2559 </dl> |
|
2560 <a NAME="LineShortener.__getIndent" ID="LineShortener.__getIndent"></a> |
|
2561 <h4>LineShortener.__getIndent</h4> |
|
2562 <b>__getIndent</b>(<i>line</i>) |
|
2563 |
|
2564 <p> |
|
2565 Private method to get the indentation string. |
|
2566 </p> |
|
2567 <dl> |
|
2568 |
|
2569 <dt><i>line</i></dt> |
|
2570 <dd> |
|
2571 line to determine the indentation string from (string) |
|
2572 </dd> |
|
2573 </dl> |
|
2574 <dl> |
|
2575 <dt>Return:</dt> |
|
2576 <dd> |
|
2577 indentation string (string) |
|
2578 </dd> |
|
2579 </dl> |
|
2580 <a NAME="LineShortener.__isProbablyInsideStringOrComment" ID="LineShortener.__isProbablyInsideStringOrComment"></a> |
|
2581 <h4>LineShortener.__isProbablyInsideStringOrComment</h4> |
|
2582 <b>__isProbablyInsideStringOrComment</b>(<i>line, index</i>) |
|
2583 |
|
2584 <p> |
|
2585 Private method to check, if the given string might be inside a string |
|
2586 or comment. |
|
2587 </p> |
|
2588 <dl> |
|
2589 |
|
2590 <dt><i>line</i></dt> |
|
2591 <dd> |
|
2592 line to check (string) |
|
2593 </dd> |
|
2594 <dt><i>index</i></dt> |
|
2595 <dd> |
|
2596 position inside line to check (integer) |
|
2597 </dd> |
|
2598 </dl> |
|
2599 <dl> |
|
2600 <dt>Return:</dt> |
|
2601 <dd> |
|
2602 flag indicating the possibility of being inside a string |
|
2603 or comment |
|
2604 </dd> |
|
2605 </dl> |
|
2606 <a NAME="LineShortener.__lineShorteningRank" ID="LineShortener.__lineShorteningRank"></a> |
|
2607 <h4>LineShortener.__lineShorteningRank</h4> |
|
2608 <b>__lineShorteningRank</b>(<i>candidate</i>) |
|
2609 |
|
2610 <p> |
|
2611 Private method to rank a candidate. |
|
2612 </p> |
|
2613 <dl> |
|
2614 |
|
2615 <dt><i>candidate</i></dt> |
|
2616 <dd> |
|
2617 candidate line to rank (string) |
|
2618 </dd> |
|
2619 </dl> |
|
2620 <dl> |
|
2621 <dt>Return:</dt> |
|
2622 <dd> |
|
2623 rank of the candidate (integer) |
|
2624 </dd> |
|
2625 </dl> |
|
2626 <a NAME="LineShortener.__normalizeMultiline" ID="LineShortener.__normalizeMultiline"></a> |
|
2627 <h4>LineShortener.__normalizeMultiline</h4> |
|
2628 <b>__normalizeMultiline</b>(<i>text</i>) |
|
2629 |
|
2630 <p> |
|
2631 Private method to remove multiline-related code that will cause syntax |
|
2632 error. |
|
2633 </p> |
|
2634 <dl> |
|
2635 |
|
2636 <dt><i>text</i></dt> |
|
2637 <dd> |
|
2638 code line to work on (string) |
|
2639 </dd> |
|
2640 </dl> |
|
2641 <dl> |
|
2642 <dt>Return:</dt> |
|
2643 <dd> |
|
2644 normalized code line (string) |
|
2645 </dd> |
|
2646 </dl> |
|
2647 <a NAME="LineShortener.__shortenComment" ID="LineShortener.__shortenComment"></a> |
|
2648 <h4>LineShortener.__shortenComment</h4> |
|
2649 <b>__shortenComment</b>(<i>isLast</i>) |
|
2650 |
|
2651 <p> |
|
2652 Private method to shorten a comment line. |
|
2653 </p> |
|
2654 <dl> |
|
2655 |
|
2656 <dt><i>isLast</i></dt> |
|
2657 <dd> |
|
2658 flag indicating, that the line is the last comment line |
|
2659 (boolean) |
|
2660 </dd> |
|
2661 </dl> |
|
2662 <dl> |
|
2663 <dt>Return:</dt> |
|
2664 <dd> |
|
2665 shortened comment line (string) |
|
2666 </dd> |
|
2667 </dl> |
|
2668 <a NAME="LineShortener.__shortenLine" ID="LineShortener.__shortenLine"></a> |
|
2669 <h4>LineShortener.__shortenLine</h4> |
|
2670 <b>__shortenLine</b>(<i>tokens, source, indent</i>) |
|
2671 |
|
2672 <p> |
|
2673 Private method to shorten a line of code at an operator. |
|
2674 </p> |
|
2675 <dl> |
|
2676 |
|
2677 <dt><i>tokens</i></dt> |
|
2678 <dd> |
|
2679 tokens of the line as generated by tokenize |
|
2680 (list of token) |
|
2681 </dd> |
|
2682 <dt><i>source</i></dt> |
|
2683 <dd> |
|
2684 code string to work at (string) |
|
2685 </dd> |
|
2686 <dt><i>indent</i></dt> |
|
2687 <dd> |
|
2688 indentation string of the code line (string) |
|
2689 </dd> |
|
2690 </dl> |
|
2691 <dl> |
|
2692 <dt>Return:</dt> |
|
2693 <dd> |
|
2694 list of candidates (list of string) |
|
2695 </dd> |
|
2696 </dl> |
|
2697 <a NAME="LineShortener.shorten" ID="LineShortener.shorten"></a> |
|
2698 <h4>LineShortener.shorten</h4> |
|
2699 <b>shorten</b>(<i></i>) |
|
2700 |
|
2701 <p> |
|
2702 Public method to shorten the line wrapped by the class instance. |
|
2703 </p> |
|
2704 <dl> |
|
2705 <dt>Return:</dt> |
|
2706 <dd> |
|
2707 tuple of a flag indicating successful shortening, the |
|
2708 shortened line and the changed next line (boolean, string, string) |
|
2709 </dd> |
|
2710 </dl> |
|
2711 <div align="right"><a href="#top">Up</a></div> |
|
2712 <hr /> |
|
2713 <hr /> |
|
2714 <a NAME="Reindenter" ID="Reindenter"></a> |
|
2715 <h2>Reindenter</h2> |
|
2716 |
|
2717 <p> |
|
2718 Class to reindent badly-indented code to uniformly use four-space |
|
2719 indentation. |
|
2720 </p> |
|
2721 <p> |
|
2722 Released to the public domain, by Tim Peters, 03 October 2000. |
|
2723 </p> |
|
2724 <h3>Derived from</h3> |
|
2725 None |
|
2726 <h3>Class Attributes</h3> |
|
2727 |
|
2728 <table> |
|
2729 <tr><td>None</td></tr> |
|
2730 </table> |
|
2731 <h3>Class Methods</h3> |
|
2732 |
|
2733 <table> |
|
2734 <tr><td>None</td></tr> |
|
2735 </table> |
|
2736 <h3>Methods</h3> |
|
2737 |
|
2738 <table> |
|
2739 |
|
2740 <tr> |
|
2741 <td><a href="#Reindenter.__init__">Reindenter</a></td> |
|
2742 <td>Constructor</td> |
|
2743 </tr> |
|
2744 <tr> |
|
2745 <td><a href="#Reindenter.__genStats">__genStats</a></td> |
|
2746 <td>Private method to generate the re-indent statistics.</td> |
|
2747 </tr> |
|
2748 <tr> |
|
2749 <td><a href="#Reindenter.__getlspace">__getlspace</a></td> |
|
2750 <td>Private method to count number of leading blanks.</td> |
|
2751 </tr> |
|
2752 <tr> |
|
2753 <td><a href="#Reindenter.fixedLine">fixedLine</a></td> |
|
2754 <td>Public method to get a fixed line.</td> |
|
2755 </tr> |
|
2756 <tr> |
|
2757 <td><a href="#Reindenter.getline">getline</a></td> |
|
2758 <td>Public method to get a line of text for tokenize.</td> |
|
2759 </tr> |
|
2760 <tr> |
|
2761 <td><a href="#Reindenter.run">run</a></td> |
|
2762 <td>Public method to run the re-indenter.</td> |
|
2763 </tr> |
|
2764 </table> |
|
2765 <h3>Static Methods</h3> |
|
2766 |
|
2767 <table> |
|
2768 <tr><td>None</td></tr> |
|
2769 </table> |
|
2770 |
|
2771 <a NAME="Reindenter.__init__" ID="Reindenter.__init__"></a> |
|
2772 <h4>Reindenter (Constructor)</h4> |
|
2773 <b>Reindenter</b>(<i>sourceLines</i>) |
|
2774 |
|
2775 <p> |
|
2776 Constructor |
|
2777 </p> |
|
2778 <dl> |
|
2779 |
|
2780 <dt><i>sourceLines</i></dt> |
|
2781 <dd> |
|
2782 list of source lines including eol marker |
|
2783 (list of string) |
|
2784 </dd> |
|
2785 </dl> |
|
2786 <a NAME="Reindenter.__genStats" ID="Reindenter.__genStats"></a> |
|
2787 <h4>Reindenter.__genStats</h4> |
|
2788 <b>__genStats</b>(<i>tokens</i>) |
|
2789 |
|
2790 <p> |
|
2791 Private method to generate the re-indent statistics. |
|
2792 </p> |
|
2793 <dl> |
|
2794 |
|
2795 <dt><i>tokens</i></dt> |
|
2796 <dd> |
|
2797 tokens generator (tokenize._tokenize) |
|
2798 </dd> |
|
2799 </dl> |
|
2800 <dl> |
|
2801 <dt>Return:</dt> |
|
2802 <dd> |
|
2803 reference to the generated statistics |
|
2804 </dd> |
|
2805 </dl> |
|
2806 <a NAME="Reindenter.__getlspace" ID="Reindenter.__getlspace"></a> |
|
2807 <h4>Reindenter.__getlspace</h4> |
|
2808 <b>__getlspace</b>(<i>line</i>) |
|
2809 |
|
2810 <p> |
|
2811 Private method to count number of leading blanks. |
|
2812 </p> |
|
2813 <dl> |
|
2814 |
|
2815 <dt><i>line</i></dt> |
|
2816 <dd> |
|
2817 line to check (string) |
|
2818 </dd> |
|
2819 </dl> |
|
2820 <dl> |
|
2821 <dt>Return:</dt> |
|
2822 <dd> |
|
2823 number of leading blanks (integer) |
|
2824 </dd> |
|
2825 </dl> |
|
2826 <a NAME="Reindenter.fixedLine" ID="Reindenter.fixedLine"></a> |
|
2827 <h4>Reindenter.fixedLine</h4> |
|
2828 <b>fixedLine</b>(<i>line</i>) |
|
2829 |
|
2830 <p> |
|
2831 Public method to get a fixed line. |
|
2832 </p> |
|
2833 <dl> |
|
2834 |
|
2835 <dt><i>line</i></dt> |
|
2836 <dd> |
|
2837 number of the line to retrieve (integer) |
|
2838 </dd> |
|
2839 </dl> |
|
2840 <dl> |
|
2841 <dt>Return:</dt> |
|
2842 <dd> |
|
2843 fixed line (string) |
|
2844 </dd> |
|
2845 </dl> |
|
2846 <a NAME="Reindenter.getline" ID="Reindenter.getline"></a> |
|
2847 <h4>Reindenter.getline</h4> |
|
2848 <b>getline</b>(<i></i>) |
|
2849 |
|
2850 <p> |
|
2851 Public method to get a line of text for tokenize. |
|
2852 </p> |
|
2853 <dl> |
|
2854 <dt>Return:</dt> |
|
2855 <dd> |
|
2856 line of text (string) |
|
2857 </dd> |
|
2858 </dl> |
|
2859 <a NAME="Reindenter.run" ID="Reindenter.run"></a> |
|
2860 <h4>Reindenter.run</h4> |
|
2861 <b>run</b>(<i></i>) |
|
2862 |
|
2863 <p> |
|
2864 Public method to run the re-indenter. |
|
2865 </p> |
|
2866 <dl> |
|
2867 <dt>Return:</dt> |
|
2868 <dd> |
|
2869 flag indicating that a change was done (boolean) |
|
2870 </dd> |
|
2871 </dl> |
|
2872 <div align="right"><a href="#top">Up</a></div> |
|
2873 <hr /> |
|
2874 </body></html> |