eric6/Documentation/Source/eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer.html

changeset 6942
2602857055c5
parent 6816
d1a6f7fc6dd2
child 7273
391d6b7b1eff
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer</h1>
23 <p>
24 Module implementing a class to fix certain code style issues.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>FixableCodeStyleIssues</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#CodeStyleFixer">CodeStyleFixer</a></td>
34 <td>Class implementing a fixer for certain code style issues.</td>
35 </tr><tr>
36 <td><a href="#IndentationWrapper">IndentationWrapper</a></td>
37 <td>Class used by fixers dealing with indentation.</td>
38 </tr><tr>
39 <td><a href="#LineShortener">LineShortener</a></td>
40 <td>Class used to shorten lines to a given maximum of characters.</td>
41 </tr><tr>
42 <td><a href="#Reindenter">Reindenter</a></td>
43 <td>Class to reindent badly-indented code to uniformly use four-space indentation.</td>
44 </tr>
45 </table>
46 <h3>Functions</h3>
47 <table>
48 <tr><td>None</td></tr>
49 </table>
50 <hr /><hr />
51 <a NAME="CodeStyleFixer" ID="CodeStyleFixer"></a>
52 <h2>CodeStyleFixer</h2>
53 <p>
54 Class implementing a fixer for certain code style issues.
55 </p>
56 <h3>Derived from</h3>
57 object
58 <h3>Class Attributes</h3>
59 <table>
60 <tr><td>None</td></tr>
61 </table>
62 <h3>Class Methods</h3>
63 <table>
64 <tr><td>None</td></tr>
65 </table>
66 <h3>Methods</h3>
67 <table>
68 <tr>
69 <td><a href="#CodeStyleFixer.__init__">CodeStyleFixer</a></td>
70 <td>Constructor</td>
71 </tr><tr>
72 <td><a href="#CodeStyleFixer.__codeMatch">__codeMatch</a></td>
73 <td>Private method to check, if the code should be fixed.</td>
74 </tr><tr>
75 <td><a href="#CodeStyleFixer.__findLogical">__findLogical</a></td>
76 <td>Private method to extract the index of all the starts and ends of lines.</td>
77 </tr><tr>
78 <td><a href="#CodeStyleFixer.__fixBlankLinesBefore">__fixBlankLinesBefore</a></td>
79 <td>Private method to fix the need for blank lines before class, function and method definitions.</td>
80 </tr><tr>
81 <td><a href="#CodeStyleFixer.__fixD111">__fixD111</a></td>
82 <td>Private method to fix docstring enclosed in wrong quotes.</td>
83 </tr><tr>
84 <td><a href="#CodeStyleFixer.__fixD112">__fixD112</a></td>
85 <td>Private method to fix docstring 'r' or 'u' in leading quotes.</td>
86 </tr><tr>
87 <td><a href="#CodeStyleFixer.__fixD121">__fixD121</a></td>
88 <td>Private method to fix a single line docstring on multiple lines.</td>
89 </tr><tr>
90 <td><a href="#CodeStyleFixer.__fixD131">__fixD131</a></td>
91 <td>Private method to fix a docstring summary not ending with a period.</td>
92 </tr><tr>
93 <td><a href="#CodeStyleFixer.__fixD141">__fixD141</a></td>
94 <td>Private method to fix a function/method docstring preceded by a blank line.</td>
95 </tr><tr>
96 <td><a href="#CodeStyleFixer.__fixD142">__fixD142</a></td>
97 <td>Private method to fix a class docstring not preceded by a blank line.</td>
98 </tr><tr>
99 <td><a href="#CodeStyleFixer.__fixD143">__fixD143</a></td>
100 <td>Private method to fix a class docstring not followed by a blank line.</td>
101 </tr><tr>
102 <td><a href="#CodeStyleFixer.__fixD144">__fixD144</a></td>
103 <td>Private method to fix a docstring summary not followed by a blank line.</td>
104 </tr><tr>
105 <td><a href="#CodeStyleFixer.__fixD145">__fixD145</a></td>
106 <td>Private method to fix the last paragraph of a multi-line docstring not followed by a blank line.</td>
107 </tr><tr>
108 <td><a href="#CodeStyleFixer.__fixD221">__fixD221</a></td>
109 <td>Private method to fix leading and trailing quotes of docstring not on separate lines.</td>
110 </tr><tr>
111 <td><a href="#CodeStyleFixer.__fixD242">__fixD242</a></td>
112 <td>Private method to fix a class or function/method docstring preceded by a blank line.</td>
113 </tr><tr>
114 <td><a href="#CodeStyleFixer.__fixD243">__fixD243</a></td>
115 <td>Private method to fix a class or function/method docstring followed by a blank line.</td>
116 </tr><tr>
117 <td><a href="#CodeStyleFixer.__fixD247">__fixD247</a></td>
118 <td>Private method to fix a last paragraph of a docstring followed by a blank line.</td>
119 </tr><tr>
120 <td><a href="#CodeStyleFixer.__fixE101">__fixE101</a></td>
121 <td>Private method to fix obsolete tab usage and indentation errors.</td>
122 </tr><tr>
123 <td><a href="#CodeStyleFixer.__fixE121">__fixE121</a></td>
124 <td>Private method to fix the indentation of continuation lines and closing brackets.</td>
125 </tr><tr>
126 <td><a href="#CodeStyleFixer.__fixE122">__fixE122</a></td>
127 <td>Private method to fix a missing indentation of continuation lines.</td>
128 </tr><tr>
129 <td><a href="#CodeStyleFixer.__fixE123">__fixE123</a></td>
130 <td>Private method to fix the indentation of a closing bracket lines.</td>
131 </tr><tr>
132 <td><a href="#CodeStyleFixer.__fixE125">__fixE125</a></td>
133 <td>Private method to fix the indentation of continuation lines not distinguishable from next logical line.</td>
134 </tr><tr>
135 <td><a href="#CodeStyleFixer.__fixE126">__fixE126</a></td>
136 <td>Private method to fix over-indented/under-indented hanging indentation.</td>
137 </tr><tr>
138 <td><a href="#CodeStyleFixer.__fixE127">__fixE127</a></td>
139 <td>Private method to fix over/under indented lines.</td>
140 </tr><tr>
141 <td><a href="#CodeStyleFixer.__fixE201">__fixE201</a></td>
142 <td>Private method to fix extraneous whitespace.</td>
143 </tr><tr>
144 <td><a href="#CodeStyleFixer.__fixE221">__fixE221</a></td>
145 <td>Private method to fix extraneous whitespace around operator or keyword.</td>
146 </tr><tr>
147 <td><a href="#CodeStyleFixer.__fixE225">__fixE225</a></td>
148 <td>Private method to fix extraneous whitespaces around operator.</td>
149 </tr><tr>
150 <td><a href="#CodeStyleFixer.__fixE231">__fixE231</a></td>
151 <td>Private method to fix missing whitespace after ',;:'.</td>
152 </tr><tr>
153 <td><a href="#CodeStyleFixer.__fixE251">__fixE251</a></td>
154 <td>Private method to fix extraneous whitespace around keyword and default parameter equals.</td>
155 </tr><tr>
156 <td><a href="#CodeStyleFixer.__fixE261">__fixE261</a></td>
157 <td>Private method to fix whitespace before or after inline comment.</td>
158 </tr><tr>
159 <td><a href="#CodeStyleFixer.__fixE304">__fixE304</a></td>
160 <td>Private method to fix superfluous blank lines after a function decorator.</td>
161 </tr><tr>
162 <td><a href="#CodeStyleFixer.__fixE401">__fixE401</a></td>
163 <td>Private method to fix multiple imports on one line.</td>
164 </tr><tr>
165 <td><a href="#CodeStyleFixer.__fixE501">__fixE501</a></td>
166 <td>Private method to fix the long lines by breaking them.</td>
167 </tr><tr>
168 <td><a href="#CodeStyleFixer.__fixE502">__fixE502</a></td>
169 <td>Private method to fix redundant backslash within brackets.</td>
170 </tr><tr>
171 <td><a href="#CodeStyleFixer.__fixE701">__fixE701</a></td>
172 <td>Private method to fix colon-separated compound statements.</td>
173 </tr><tr>
174 <td><a href="#CodeStyleFixer.__fixE702">__fixE702</a></td>
175 <td>Private method to fix semicolon-separated compound statements.</td>
176 </tr><tr>
177 <td><a href="#CodeStyleFixer.__fixE711">__fixE711</a></td>
178 <td>Private method to fix comparison with None.</td>
179 </tr><tr>
180 <td><a href="#CodeStyleFixer.__fixN804">__fixN804</a></td>
181 <td>Private method to fix a wrong first argument of normal and class methods.</td>
182 </tr><tr>
183 <td><a href="#CodeStyleFixer.__fixN806">__fixN806</a></td>
184 <td>Private method to fix a wrong first argument of static methods.</td>
185 </tr><tr>
186 <td><a href="#CodeStyleFixer.__fixReindent">__fixReindent</a></td>
187 <td>Private method to fix a badly indented line.</td>
188 </tr><tr>
189 <td><a href="#CodeStyleFixer.__fixW291">__fixW291</a></td>
190 <td>Private method to fix trailing whitespace.</td>
191 </tr><tr>
192 <td><a href="#CodeStyleFixer.__fixW292">__fixW292</a></td>
193 <td>Private method to fix a missing newline at the end of file.</td>
194 </tr><tr>
195 <td><a href="#CodeStyleFixer.__fixW391">__fixW391</a></td>
196 <td>Private method to fix trailing blank lines.</td>
197 </tr><tr>
198 <td><a href="#CodeStyleFixer.__fixW603">__fixW603</a></td>
199 <td>Private method to fix the not equal notation.</td>
200 </tr><tr>
201 <td><a href="#CodeStyleFixer.__fixWhitespace">__fixWhitespace</a></td>
202 <td>Private method to correct whitespace at the given offset.</td>
203 </tr><tr>
204 <td><a href="#CodeStyleFixer.__getID">__getID</a></td>
205 <td>Private method to get the ID for a deferred fix.</td>
206 </tr><tr>
207 <td><a href="#CodeStyleFixer.__getIndent">__getIndent</a></td>
208 <td>Private method to get the indentation string.</td>
209 </tr><tr>
210 <td><a href="#CodeStyleFixer.__getIndentWord">__getIndentWord</a></td>
211 <td>Private method to determine the indentation type.</td>
212 </tr><tr>
213 <td><a href="#CodeStyleFixer.__getLogical">__getLogical</a></td>
214 <td>Private method to get the logical line corresponding to the given position.</td>
215 </tr><tr>
216 <td><a href="#CodeStyleFixer.__multilineStringLines">__multilineStringLines</a></td>
217 <td>Private method to determine the line numbers that are within multi line strings and these which are part of a documentation string.</td>
218 </tr><tr>
219 <td><a href="#CodeStyleFixer.finalize">finalize</a></td>
220 <td>Public method to apply all deferred fixes.</td>
221 </tr><tr>
222 <td><a href="#CodeStyleFixer.fixIssue">fixIssue</a></td>
223 <td>Public method to fix the fixable issues.</td>
224 </tr><tr>
225 <td><a href="#CodeStyleFixer.mutualStartswith">mutualStartswith</a></td>
226 <td>Local helper method to compare the beginnings of two strings against each other.</td>
227 </tr><tr>
228 <td><a href="#CodeStyleFixer.saveFile">saveFile</a></td>
229 <td>Public method to save the modified file.</td>
230 </tr>
231 </table>
232 <h3>Static Methods</h3>
233 <table>
234 <tr><td>None</td></tr>
235 </table>
236 <a NAME="CodeStyleFixer.__init__" ID="CodeStyleFixer.__init__"></a>
237 <h4>CodeStyleFixer (Constructor)</h4>
238 <b>CodeStyleFixer</b>(<i>filename, sourceLines, fixCodes, noFixCodes, maxLineLength, blankLines, inPlace, eol, backup=False</i>)
239 <p>
240 Constructor
241 </p><dl>
242 <dt><i>filename</i> (str)</dt>
243 <dd>
244 name of the file to be fixed
245 </dd><dt><i>sourceLines</i> (list of str)</dt>
246 <dd>
247 list of source lines including eol marker
248 </dd><dt><i>fixCodes</i> (str)</dt>
249 <dd>
250 list of codes to be fixed as a comma separated
251 string
252 </dd><dt><i>noFixCodes</i> (str)</dt>
253 <dd>
254 list of codes not to be fixed as a comma
255 separated string
256 </dd><dt><i>maxLineLength</i> (int)</dt>
257 <dd>
258 maximum allowed line length
259 </dd><dt><i>blankLines</i> (tuple of (int, int))</dt>
260 <dd>
261 tuple containg the number of blank lines before
262 a top level class or function and before a method or nested class
263 or function
264 </dd><dt><i>inPlace</i> (bool)</dt>
265 <dd>
266 flag indicating to modify the file in place
267 </dd><dt><i>eol</i> (str)</dt>
268 <dd>
269 end of line character(s)
270 </dd><dt><i>backup</i> (bool)</dt>
271 <dd>
272 flag indicating to create a backup before fixing
273 anything
274 </dd>
275 </dl><a NAME="CodeStyleFixer.__codeMatch" ID="CodeStyleFixer.__codeMatch"></a>
276 <h4>CodeStyleFixer.__codeMatch</h4>
277 <b>__codeMatch</b>(<i>code</i>)
278 <p>
279 Private method to check, if the code should be fixed.
280 </p><dl>
281 <dt><i>code</i></dt>
282 <dd>
283 to check (string)
284 </dd>
285 </dl><dl>
286 <dt>Returns:</dt>
287 <dd>
288 flag indicating it should be fixed (boolean)
289 </dd>
290 </dl><a NAME="CodeStyleFixer.__findLogical" ID="CodeStyleFixer.__findLogical"></a>
291 <h4>CodeStyleFixer.__findLogical</h4>
292 <b>__findLogical</b>(<i></i>)
293 <p>
294 Private method to extract the index of all the starts and ends of
295 lines.
296 </p><dl>
297 <dt>Returns:</dt>
298 <dd>
299 tuple containing two lists of integer with start and end tuples
300 of lines
301 </dd>
302 </dl><a NAME="CodeStyleFixer.__fixBlankLinesBefore" ID="CodeStyleFixer.__fixBlankLinesBefore"></a>
303 <h4>CodeStyleFixer.__fixBlankLinesBefore</h4>
304 <b>__fixBlankLinesBefore</b>(<i>code, line, pos, apply=False</i>)
305 <p>
306 Private method to fix the need for blank lines before class, function
307 and method definitions.
308 </p><p>
309 Codes: E301, E302, E303, E305, E306, E307, E308
310 </p><dl>
311 <dt><i>code</i></dt>
312 <dd>
313 code of the issue (string)
314 </dd><dt><i>line</i></dt>
315 <dd>
316 line number of the issue (integer)
317 </dd><dt><i>pos</i></dt>
318 <dd>
319 position inside line (integer)
320 </dd><dt><i>apply=</i></dt>
321 <dd>
322 flag indicating, that the fix should be applied
323 (boolean)
324 </dd>
325 </dl><dl>
326 <dt>Returns:</dt>
327 <dd>
328 value indicating an applied/deferred fix (-1, 0, 1),
329 a message for the fix (string) and an ID for a deferred
330 fix (integer)
331 </dd>
332 </dl><a NAME="CodeStyleFixer.__fixD111" ID="CodeStyleFixer.__fixD111"></a>
333 <h4>CodeStyleFixer.__fixD111</h4>
334 <b>__fixD111</b>(<i>code, line, pos</i>)
335 <p>
336 Private method to fix docstring enclosed in wrong quotes.
337 </p><p>
338 Codes: D111
339 </p><dl>
340 <dt><i>code</i></dt>
341 <dd>
342 code of the issue (string)
343 </dd><dt><i>line</i></dt>
344 <dd>
345 line number of the issue (integer)
346 </dd><dt><i>pos</i></dt>
347 <dd>
348 position inside line (integer)
349 </dd>
350 </dl><dl>
351 <dt>Returns:</dt>
352 <dd>
353 value indicating an applied/deferred fix (-1, 0, 1),
354 a message for the fix (string) and an ID for a deferred
355 fix (integer)
356 </dd>
357 </dl><a NAME="CodeStyleFixer.__fixD112" ID="CodeStyleFixer.__fixD112"></a>
358 <h4>CodeStyleFixer.__fixD112</h4>
359 <b>__fixD112</b>(<i>code, line, pos</i>)
360 <p>
361 Private method to fix docstring 'r' or 'u' in leading quotes.
362 </p><p>
363 Codes: D112, D113
364 </p><dl>
365 <dt><i>code</i></dt>
366 <dd>
367 code of the issue (string)
368 </dd><dt><i>line</i></dt>
369 <dd>
370 line number of the issue (integer)
371 </dd><dt><i>pos</i></dt>
372 <dd>
373 position inside line (integer)
374 </dd>
375 </dl><dl>
376 <dt>Returns:</dt>
377 <dd>
378 value indicating an applied/deferred fix (-1, 0, 1),
379 a message for the fix (string) and an ID for a deferred
380 fix (integer)
381 </dd>
382 </dl><a NAME="CodeStyleFixer.__fixD121" ID="CodeStyleFixer.__fixD121"></a>
383 <h4>CodeStyleFixer.__fixD121</h4>
384 <b>__fixD121</b>(<i>code, line, pos, apply=False</i>)
385 <p>
386 Private method to fix a single line docstring on multiple lines.
387 </p><p>
388 Codes: D121
389 </p><dl>
390 <dt><i>code</i></dt>
391 <dd>
392 code of the issue (string)
393 </dd><dt><i>line</i></dt>
394 <dd>
395 line number of the issue (integer)
396 </dd><dt><i>pos</i></dt>
397 <dd>
398 position inside line (integer)
399 </dd><dt><i>apply=</i></dt>
400 <dd>
401 flag indicating, that the fix should be applied
402 (boolean)
403 </dd>
404 </dl><dl>
405 <dt>Returns:</dt>
406 <dd>
407 value indicating an applied/deferred fix (-1, 0, 1),
408 a message for the fix (string) and an ID for a deferred
409 fix (integer)
410 </dd>
411 </dl><a NAME="CodeStyleFixer.__fixD131" ID="CodeStyleFixer.__fixD131"></a>
412 <h4>CodeStyleFixer.__fixD131</h4>
413 <b>__fixD131</b>(<i>code, line, pos</i>)
414 <p>
415 Private method to fix a docstring summary not ending with a
416 period.
417 </p><p>
418 Codes: D131
419 </p><dl>
420 <dt><i>code</i></dt>
421 <dd>
422 code of the issue (string)
423 </dd><dt><i>line</i></dt>
424 <dd>
425 line number of the issue (integer)
426 </dd><dt><i>pos</i></dt>
427 <dd>
428 position inside line (integer)
429 </dd>
430 </dl><dl>
431 <dt>Returns:</dt>
432 <dd>
433 value indicating an applied/deferred fix (-1, 0, 1),
434 a message for the fix (string) and an ID for a deferred
435 fix (integer)
436 </dd>
437 </dl><a NAME="CodeStyleFixer.__fixD141" ID="CodeStyleFixer.__fixD141"></a>
438 <h4>CodeStyleFixer.__fixD141</h4>
439 <b>__fixD141</b>(<i>code, line, pos, apply=False</i>)
440 <p>
441 Private method to fix a function/method docstring preceded by a
442 blank line.
443 </p><p>
444 Codes: D141
445 </p><dl>
446 <dt><i>code</i></dt>
447 <dd>
448 code of the issue (string)
449 </dd><dt><i>line</i></dt>
450 <dd>
451 line number of the issue (integer)
452 </dd><dt><i>pos</i></dt>
453 <dd>
454 position inside line (integer)
455 </dd><dt><i>apply=</i></dt>
456 <dd>
457 flag indicating, that the fix should be applied
458 (boolean)
459 </dd>
460 </dl><dl>
461 <dt>Returns:</dt>
462 <dd>
463 value indicating an applied/deferred fix (-1, 0, 1),
464 a message for the fix (string) and an ID for a deferred
465 fix (integer)
466 </dd>
467 </dl><a NAME="CodeStyleFixer.__fixD142" ID="CodeStyleFixer.__fixD142"></a>
468 <h4>CodeStyleFixer.__fixD142</h4>
469 <b>__fixD142</b>(<i>code, line, pos, apply=False</i>)
470 <p>
471 Private method to fix a class docstring not preceded by a
472 blank line.
473 </p><p>
474 Codes: D142
475 </p><dl>
476 <dt><i>code</i></dt>
477 <dd>
478 code of the issue (string)
479 </dd><dt><i>line</i></dt>
480 <dd>
481 line number of the issue (integer)
482 </dd><dt><i>pos</i></dt>
483 <dd>
484 position inside line (integer)
485 </dd><dt><i>apply=</i></dt>
486 <dd>
487 flag indicating, that the fix should be applied
488 (boolean)
489 </dd>
490 </dl><dl>
491 <dt>Returns:</dt>
492 <dd>
493 value indicating an applied/deferred fix (-1, 0, 1),
494 a message for the fix (string) and an ID for a deferred
495 fix (integer)
496 </dd>
497 </dl><a NAME="CodeStyleFixer.__fixD143" ID="CodeStyleFixer.__fixD143"></a>
498 <h4>CodeStyleFixer.__fixD143</h4>
499 <b>__fixD143</b>(<i>code, line, pos, apply=False</i>)
500 <p>
501 Private method to fix a class docstring not followed by a
502 blank line.
503 </p><p>
504 Codes: D143
505 </p><dl>
506 <dt><i>code</i></dt>
507 <dd>
508 code of the issue (string)
509 </dd><dt><i>line</i></dt>
510 <dd>
511 line number of the issue (integer)
512 </dd><dt><i>pos</i></dt>
513 <dd>
514 position inside line (integer)
515 </dd><dt><i>apply=</i></dt>
516 <dd>
517 flag indicating, that the fix should be applied
518 (boolean)
519 </dd>
520 </dl><dl>
521 <dt>Returns:</dt>
522 <dd>
523 value indicating an applied/deferred fix (-1, 0, 1),
524 a message for the fix (string) and an ID for a deferred
525 fix (integer)
526 </dd>
527 </dl><a NAME="CodeStyleFixer.__fixD144" ID="CodeStyleFixer.__fixD144"></a>
528 <h4>CodeStyleFixer.__fixD144</h4>
529 <b>__fixD144</b>(<i>code, line, pos, apply=False</i>)
530 <p>
531 Private method to fix a docstring summary not followed by a
532 blank line.
533 </p><p>
534 Codes: D144
535 </p><dl>
536 <dt><i>code</i></dt>
537 <dd>
538 code of the issue (string)
539 </dd><dt><i>line</i></dt>
540 <dd>
541 line number of the issue (integer)
542 </dd><dt><i>pos</i></dt>
543 <dd>
544 position inside line (integer)
545 </dd><dt><i>apply=</i></dt>
546 <dd>
547 flag indicating, that the fix should be applied
548 (boolean)
549 </dd>
550 </dl><dl>
551 <dt>Returns:</dt>
552 <dd>
553 value indicating an applied/deferred fix (-1, 0, 1),
554 a message for the fix (string) and an ID for a deferred
555 fix (integer)
556 </dd>
557 </dl><a NAME="CodeStyleFixer.__fixD145" ID="CodeStyleFixer.__fixD145"></a>
558 <h4>CodeStyleFixer.__fixD145</h4>
559 <b>__fixD145</b>(<i>code, line, pos, apply=False</i>)
560 <p>
561 Private method to fix the last paragraph of a multi-line docstring
562 not followed by a blank line.
563 </p><p>
564 Codes: D143
565 </p><dl>
566 <dt><i>code</i></dt>
567 <dd>
568 code of the issue (string)
569 </dd><dt><i>line</i></dt>
570 <dd>
571 line number of the issue (integer)
572 </dd><dt><i>pos</i></dt>
573 <dd>
574 position inside line (integer)
575 </dd><dt><i>apply=</i></dt>
576 <dd>
577 flag indicating, that the fix should be applied
578 (boolean)
579 </dd>
580 </dl><dl>
581 <dt>Returns:</dt>
582 <dd>
583 value indicating an applied/deferred fix (-1, 0, 1),
584 a message for the fix (string) and an ID for a deferred
585 fix (integer)
586 </dd>
587 </dl><a NAME="CodeStyleFixer.__fixD221" ID="CodeStyleFixer.__fixD221"></a>
588 <h4>CodeStyleFixer.__fixD221</h4>
589 <b>__fixD221</b>(<i>code, line, pos, apply=False</i>)
590 <p>
591 Private method to fix leading and trailing quotes of docstring
592 not on separate lines.
593 </p><p>
594 Codes: D221, D222
595 </p><dl>
596 <dt><i>code</i></dt>
597 <dd>
598 code of the issue (string)
599 </dd><dt><i>line</i></dt>
600 <dd>
601 line number of the issue (integer)
602 </dd><dt><i>pos</i></dt>
603 <dd>
604 position inside line (integer)
605 </dd><dt><i>apply=</i></dt>
606 <dd>
607 flag indicating, that the fix should be applied
608 (boolean)
609 </dd>
610 </dl><dl>
611 <dt>Returns:</dt>
612 <dd>
613 value indicating an applied/deferred fix (-1, 0, 1),
614 a message for the fix (string) and an ID for a deferred
615 fix (integer)
616 </dd>
617 </dl><a NAME="CodeStyleFixer.__fixD242" ID="CodeStyleFixer.__fixD242"></a>
618 <h4>CodeStyleFixer.__fixD242</h4>
619 <b>__fixD242</b>(<i>code, line, pos, apply=False</i>)
620 <p>
621 Private method to fix a class or function/method docstring preceded
622 by a blank line.
623 </p><p>
624 Codes: D242, D244
625 </p><dl>
626 <dt><i>code</i></dt>
627 <dd>
628 code of the issue (string)
629 </dd><dt><i>line</i></dt>
630 <dd>
631 line number of the issue (integer)
632 </dd><dt><i>pos</i></dt>
633 <dd>
634 position inside line (integer)
635 </dd><dt><i>apply=</i></dt>
636 <dd>
637 flag indicating, that the fix should be applied
638 (boolean)
639 </dd>
640 </dl><dl>
641 <dt>Returns:</dt>
642 <dd>
643 value indicating an applied/deferred fix (-1, 0, 1),
644 a message for the fix (string) and an ID for a deferred
645 fix (integer)
646 </dd>
647 </dl><a NAME="CodeStyleFixer.__fixD243" ID="CodeStyleFixer.__fixD243"></a>
648 <h4>CodeStyleFixer.__fixD243</h4>
649 <b>__fixD243</b>(<i>code, line, pos, apply=False</i>)
650 <p>
651 Private method to fix a class or function/method docstring followed
652 by a blank line.
653 </p><p>
654 Codes: D243, D245
655 </p><dl>
656 <dt><i>code</i></dt>
657 <dd>
658 code of the issue (string)
659 </dd><dt><i>line</i></dt>
660 <dd>
661 line number of the issue (integer)
662 </dd><dt><i>pos</i></dt>
663 <dd>
664 position inside line (integer)
665 </dd><dt><i>apply=</i></dt>
666 <dd>
667 flag indicating, that the fix should be applied
668 (boolean)
669 </dd>
670 </dl><dl>
671 <dt>Returns:</dt>
672 <dd>
673 value indicating an applied/deferred fix (-1, 0, 1),
674 a message for the fix (string) and an ID for a deferred
675 fix (integer)
676 </dd>
677 </dl><a NAME="CodeStyleFixer.__fixD247" ID="CodeStyleFixer.__fixD247"></a>
678 <h4>CodeStyleFixer.__fixD247</h4>
679 <b>__fixD247</b>(<i>code, line, pos, apply=False</i>)
680 <p>
681 Private method to fix a last paragraph of a docstring followed
682 by a blank line.
683 </p><p>
684 Codes: D247
685 </p><dl>
686 <dt><i>code</i></dt>
687 <dd>
688 code of the issue (string)
689 </dd><dt><i>line</i></dt>
690 <dd>
691 line number of the issue (integer)
692 </dd><dt><i>pos</i></dt>
693 <dd>
694 position inside line (integer)
695 </dd><dt><i>apply=</i></dt>
696 <dd>
697 flag indicating, that the fix should be applied
698 (boolean)
699 </dd>
700 </dl><dl>
701 <dt>Returns:</dt>
702 <dd>
703 value indicating an applied/deferred fix (-1, 0, 1),
704 a message for the fix (string) and an ID for a deferred
705 fix (integer)
706 </dd>
707 </dl><a NAME="CodeStyleFixer.__fixE101" ID="CodeStyleFixer.__fixE101"></a>
708 <h4>CodeStyleFixer.__fixE101</h4>
709 <b>__fixE101</b>(<i>code, line, pos</i>)
710 <p>
711 Private method to fix obsolete tab usage and indentation errors.
712 </p><p>
713 Codes: E101, E111, W191
714 </p><dl>
715 <dt><i>code</i></dt>
716 <dd>
717 code of the issue (string)
718 </dd><dt><i>line</i></dt>
719 <dd>
720 line number of the issue (integer)
721 </dd><dt><i>pos</i></dt>
722 <dd>
723 position inside line (integer)
724 </dd>
725 </dl><dl>
726 <dt>Returns:</dt>
727 <dd>
728 value indicating an applied/deferred fix (-1, 0, 1),
729 a message for the fix (string) and an ID for a deferred
730 fix (integer)
731 </dd>
732 </dl><a NAME="CodeStyleFixer.__fixE121" ID="CodeStyleFixer.__fixE121"></a>
733 <h4>CodeStyleFixer.__fixE121</h4>
734 <b>__fixE121</b>(<i>code, line, pos, apply=False</i>)
735 <p>
736 Private method to fix the indentation of continuation lines and
737 closing brackets.
738 </p><p>
739 Codes: E121, E124
740 </p><dl>
741 <dt><i>code</i></dt>
742 <dd>
743 code of the issue (string)
744 </dd><dt><i>line</i></dt>
745 <dd>
746 line number of the issue (integer)
747 </dd><dt><i>pos</i></dt>
748 <dd>
749 position inside line (integer)
750 </dd><dt><i>apply=</i></dt>
751 <dd>
752 flag indicating, that the fix should be applied
753 (boolean)
754 </dd>
755 </dl><dl>
756 <dt>Returns:</dt>
757 <dd>
758 value indicating an applied/deferred fix (-1, 0, 1),
759 a message for the fix (string) and an ID for a deferred
760 fix (integer)
761 </dd>
762 </dl><a NAME="CodeStyleFixer.__fixE122" ID="CodeStyleFixer.__fixE122"></a>
763 <h4>CodeStyleFixer.__fixE122</h4>
764 <b>__fixE122</b>(<i>code, line, pos, apply=False</i>)
765 <p>
766 Private method to fix a missing indentation of continuation lines.
767 </p><p>
768 Codes: E122
769 </p><dl>
770 <dt><i>code</i></dt>
771 <dd>
772 code of the issue (string)
773 </dd><dt><i>line</i></dt>
774 <dd>
775 line number of the issue (integer)
776 </dd><dt><i>pos</i></dt>
777 <dd>
778 position inside line (integer)
779 </dd><dt><i>apply=</i></dt>
780 <dd>
781 flag indicating, that the fix should be applied
782 (boolean)
783 </dd>
784 </dl><dl>
785 <dt>Returns:</dt>
786 <dd>
787 value indicating an applied/deferred fix (-1, 0, 1),
788 a message for the fix (string) and an ID for a deferred
789 fix (integer)
790 </dd>
791 </dl><a NAME="CodeStyleFixer.__fixE123" ID="CodeStyleFixer.__fixE123"></a>
792 <h4>CodeStyleFixer.__fixE123</h4>
793 <b>__fixE123</b>(<i>code, line, pos, apply=False</i>)
794 <p>
795 Private method to fix the indentation of a closing bracket lines.
796 </p><p>
797 Codes: E123
798 </p><dl>
799 <dt><i>code</i></dt>
800 <dd>
801 code of the issue (string)
802 </dd><dt><i>line</i></dt>
803 <dd>
804 line number of the issue (integer)
805 </dd><dt><i>pos</i></dt>
806 <dd>
807 position inside line (integer)
808 </dd><dt><i>apply=</i></dt>
809 <dd>
810 flag indicating, that the fix should be applied
811 (boolean)
812 </dd>
813 </dl><dl>
814 <dt>Returns:</dt>
815 <dd>
816 value indicating an applied/deferred fix (-1, 0, 1),
817 a message for the fix (string) and an ID for a deferred
818 fix (integer)
819 </dd>
820 </dl><a NAME="CodeStyleFixer.__fixE125" ID="CodeStyleFixer.__fixE125"></a>
821 <h4>CodeStyleFixer.__fixE125</h4>
822 <b>__fixE125</b>(<i>code, line, pos, apply=False</i>)
823 <p>
824 Private method to fix the indentation of continuation lines not
825 distinguishable from next logical line.
826 </p><p>
827 Codes: E125
828 </p><dl>
829 <dt><i>code</i></dt>
830 <dd>
831 code of the issue (string)
832 </dd><dt><i>line</i></dt>
833 <dd>
834 line number of the issue (integer)
835 </dd><dt><i>pos</i></dt>
836 <dd>
837 position inside line (integer)
838 </dd><dt><i>apply=</i></dt>
839 <dd>
840 flag indicating, that the fix should be applied
841 (boolean)
842 </dd>
843 </dl><dl>
844 <dt>Returns:</dt>
845 <dd>
846 value indicating an applied/deferred fix (-1, 0, 1),
847 a message for the fix (string) and an ID for a deferred
848 fix (integer)
849 </dd>
850 </dl><a NAME="CodeStyleFixer.__fixE126" ID="CodeStyleFixer.__fixE126"></a>
851 <h4>CodeStyleFixer.__fixE126</h4>
852 <b>__fixE126</b>(<i>code, line, pos, apply=False</i>)
853 <p>
854 Private method to fix over-indented/under-indented hanging
855 indentation.
856 </p><p>
857 Codes: E126, E133
858 </p><dl>
859 <dt><i>code</i></dt>
860 <dd>
861 code of the issue (string)
862 </dd><dt><i>line</i></dt>
863 <dd>
864 line number of the issue (integer)
865 </dd><dt><i>pos</i></dt>
866 <dd>
867 position inside line (integer)
868 </dd><dt><i>apply=</i></dt>
869 <dd>
870 flag indicating, that the fix should be applied
871 (boolean)
872 </dd>
873 </dl><dl>
874 <dt>Returns:</dt>
875 <dd>
876 value indicating an applied/deferred fix (-1, 0, 1),
877 a message for the fix (string) and an ID for a deferred
878 fix (integer)
879 </dd>
880 </dl><a NAME="CodeStyleFixer.__fixE127" ID="CodeStyleFixer.__fixE127"></a>
881 <h4>CodeStyleFixer.__fixE127</h4>
882 <b>__fixE127</b>(<i>code, line, pos, apply=False</i>)
883 <p>
884 Private method to fix over/under indented lines.
885 </p><p>
886 Codes: E127, E128
887 </p><dl>
888 <dt><i>code</i></dt>
889 <dd>
890 code of the issue (string)
891 </dd><dt><i>line</i></dt>
892 <dd>
893 line number of the issue (integer)
894 </dd><dt><i>pos</i></dt>
895 <dd>
896 position inside line (integer)
897 </dd><dt><i>apply=</i></dt>
898 <dd>
899 flag indicating, that the fix should be applied
900 (boolean)
901 </dd>
902 </dl><dl>
903 <dt>Returns:</dt>
904 <dd>
905 value indicating an applied/deferred fix (-1, 0, 1),
906 a message for the fix (string) and an ID for a deferred
907 fix (integer)
908 </dd>
909 </dl><a NAME="CodeStyleFixer.__fixE201" ID="CodeStyleFixer.__fixE201"></a>
910 <h4>CodeStyleFixer.__fixE201</h4>
911 <b>__fixE201</b>(<i>code, line, pos</i>)
912 <p>
913 Private method to fix extraneous whitespace.
914 </p><p>
915 Codes: E201, E202, E203, E211
916 </p><dl>
917 <dt><i>code</i></dt>
918 <dd>
919 code of the issue (string)
920 </dd><dt><i>line</i></dt>
921 <dd>
922 line number of the issue (integer)
923 </dd><dt><i>pos</i></dt>
924 <dd>
925 position inside line (integer)
926 </dd>
927 </dl><dl>
928 <dt>Returns:</dt>
929 <dd>
930 value indicating an applied/deferred fix (-1, 0, 1),
931 a message for the fix (string) and an ID for a deferred
932 fix (integer)
933 </dd>
934 </dl><a NAME="CodeStyleFixer.__fixE221" ID="CodeStyleFixer.__fixE221"></a>
935 <h4>CodeStyleFixer.__fixE221</h4>
936 <b>__fixE221</b>(<i>code, line, pos</i>)
937 <p>
938 Private method to fix extraneous whitespace around operator or
939 keyword.
940 </p><p>
941 Codes: E221, E222, E223, E224, E241, E242, E271, E272, E273, E274
942 </p><dl>
943 <dt><i>code</i></dt>
944 <dd>
945 code of the issue (string)
946 </dd><dt><i>line</i></dt>
947 <dd>
948 line number of the issue (integer)
949 </dd><dt><i>pos</i></dt>
950 <dd>
951 position inside line (integer)
952 </dd>
953 </dl><dl>
954 <dt>Returns:</dt>
955 <dd>
956 value indicating an applied/deferred fix (-1, 0, 1),
957 a message for the fix (string) and an ID for a deferred
958 fix (integer)
959 </dd>
960 </dl><a NAME="CodeStyleFixer.__fixE225" ID="CodeStyleFixer.__fixE225"></a>
961 <h4>CodeStyleFixer.__fixE225</h4>
962 <b>__fixE225</b>(<i>code, line, pos</i>)
963 <p>
964 Private method to fix extraneous whitespaces around operator.
965 </p><p>
966 Codes: E225, E226, E227, E228
967 </p><dl>
968 <dt><i>code</i></dt>
969 <dd>
970 code of the issue (string)
971 </dd><dt><i>line</i></dt>
972 <dd>
973 line number of the issue (integer)
974 </dd><dt><i>pos</i></dt>
975 <dd>
976 position inside line (integer)
977 </dd>
978 </dl><dl>
979 <dt>Returns:</dt>
980 <dd>
981 value indicating an applied/deferred fix (-1, 0, 1),
982 a message for the fix (string) and an ID for a deferred
983 fix (integer)
984 </dd>
985 </dl><a NAME="CodeStyleFixer.__fixE231" ID="CodeStyleFixer.__fixE231"></a>
986 <h4>CodeStyleFixer.__fixE231</h4>
987 <b>__fixE231</b>(<i>code, line, pos</i>)
988 <p>
989 Private method to fix missing whitespace after ',;:'.
990 </p><p>
991 Codes: E231
992 </p><dl>
993 <dt><i>code</i></dt>
994 <dd>
995 code of the issue (string)
996 </dd><dt><i>line</i></dt>
997 <dd>
998 line number of the issue (integer)
999 </dd><dt><i>pos</i></dt>
1000 <dd>
1001 position inside line (integer)
1002 </dd>
1003 </dl><dl>
1004 <dt>Returns:</dt>
1005 <dd>
1006 value indicating an applied/deferred fix (-1, 0, 1),
1007 a message for the fix (string) and an ID for a deferred
1008 fix (integer)
1009 </dd>
1010 </dl><a NAME="CodeStyleFixer.__fixE251" ID="CodeStyleFixer.__fixE251"></a>
1011 <h4>CodeStyleFixer.__fixE251</h4>
1012 <b>__fixE251</b>(<i>code, line, pos</i>)
1013 <p>
1014 Private method to fix extraneous whitespace around keyword and
1015 default parameter equals.
1016 </p><p>
1017 Codes: E251
1018 </p><dl>
1019 <dt><i>code</i></dt>
1020 <dd>
1021 code of the issue (string)
1022 </dd><dt><i>line</i></dt>
1023 <dd>
1024 line number of the issue (integer)
1025 </dd><dt><i>pos</i></dt>
1026 <dd>
1027 position inside line (integer)
1028 </dd>
1029 </dl><dl>
1030 <dt>Returns:</dt>
1031 <dd>
1032 value indicating an applied/deferred fix (-1, 0, 1),
1033 a message for the fix (string) and an ID for a deferred
1034 fix (integer)
1035 </dd>
1036 </dl><a NAME="CodeStyleFixer.__fixE261" ID="CodeStyleFixer.__fixE261"></a>
1037 <h4>CodeStyleFixer.__fixE261</h4>
1038 <b>__fixE261</b>(<i>code, line, pos</i>)
1039 <p>
1040 Private method to fix whitespace before or after inline comment.
1041 </p><p>
1042 Codes: E261, E262
1043 </p><dl>
1044 <dt><i>code</i></dt>
1045 <dd>
1046 code of the issue (string)
1047 </dd><dt><i>line</i></dt>
1048 <dd>
1049 line number of the issue (integer)
1050 </dd><dt><i>pos</i></dt>
1051 <dd>
1052 position inside line (integer)
1053 </dd>
1054 </dl><dl>
1055 <dt>Returns:</dt>
1056 <dd>
1057 value indicating an applied/deferred fix (-1, 0, 1),
1058 a message for the fix (string) and an ID for a deferred
1059 fix (integer)
1060 </dd>
1061 </dl><a NAME="CodeStyleFixer.__fixE304" ID="CodeStyleFixer.__fixE304"></a>
1062 <h4>CodeStyleFixer.__fixE304</h4>
1063 <b>__fixE304</b>(<i>code, line, pos, apply=False</i>)
1064 <p>
1065 Private method to fix superfluous blank lines after a function
1066 decorator.
1067 </p><p>
1068 Codes: E304
1069 </p><dl>
1070 <dt><i>code</i></dt>
1071 <dd>
1072 code of the issue (string)
1073 </dd><dt><i>line</i></dt>
1074 <dd>
1075 line number of the issue (integer)
1076 </dd><dt><i>pos</i></dt>
1077 <dd>
1078 position inside line (integer)
1079 </dd><dt><i>apply=</i></dt>
1080 <dd>
1081 flag indicating, that the fix should be applied
1082 (boolean)
1083 </dd>
1084 </dl><dl>
1085 <dt>Returns:</dt>
1086 <dd>
1087 value indicating an applied/deferred fix (-1, 0, 1),
1088 a message for the fix (string) and an ID for a deferred
1089 fix (integer)
1090 </dd>
1091 </dl><a NAME="CodeStyleFixer.__fixE401" ID="CodeStyleFixer.__fixE401"></a>
1092 <h4>CodeStyleFixer.__fixE401</h4>
1093 <b>__fixE401</b>(<i>code, line, pos, apply=False</i>)
1094 <p>
1095 Private method to fix multiple imports on one line.
1096 </p><p>
1097 Codes: E401
1098 </p><dl>
1099 <dt><i>code</i></dt>
1100 <dd>
1101 code of the issue (string)
1102 </dd><dt><i>line</i></dt>
1103 <dd>
1104 line number of the issue (integer)
1105 </dd><dt><i>pos</i></dt>
1106 <dd>
1107 position inside line (integer)
1108 </dd><dt><i>apply=</i></dt>
1109 <dd>
1110 flag indicating, that the fix should be applied
1111 (boolean)
1112 </dd>
1113 </dl><dl>
1114 <dt>Returns:</dt>
1115 <dd>
1116 value indicating an applied/deferred fix (-1, 0, 1),
1117 a message for the fix (string) and an ID for a deferred
1118 fix (integer)
1119 </dd>
1120 </dl><a NAME="CodeStyleFixer.__fixE501" ID="CodeStyleFixer.__fixE501"></a>
1121 <h4>CodeStyleFixer.__fixE501</h4>
1122 <b>__fixE501</b>(<i>code, line, pos, apply=False</i>)
1123 <p>
1124 Private method to fix the long lines by breaking them.
1125 </p><p>
1126 Codes: E501
1127 </p><dl>
1128 <dt><i>code</i></dt>
1129 <dd>
1130 code of the issue (string)
1131 </dd><dt><i>line</i></dt>
1132 <dd>
1133 line number of the issue (integer)
1134 </dd><dt><i>pos</i></dt>
1135 <dd>
1136 position inside line (integer)
1137 </dd><dt><i>apply=</i></dt>
1138 <dd>
1139 flag indicating, that the fix should be applied
1140 (boolean)
1141 </dd>
1142 </dl><dl>
1143 <dt>Returns:</dt>
1144 <dd>
1145 value indicating an applied/deferred fix (-1, 0, 1),
1146 a message for the fix (string) and an ID for a deferred
1147 fix (integer)
1148 </dd>
1149 </dl><a NAME="CodeStyleFixer.__fixE502" ID="CodeStyleFixer.__fixE502"></a>
1150 <h4>CodeStyleFixer.__fixE502</h4>
1151 <b>__fixE502</b>(<i>code, line, pos</i>)
1152 <p>
1153 Private method to fix redundant backslash within brackets.
1154 </p><p>
1155 Codes: E502
1156 </p><dl>
1157 <dt><i>code</i></dt>
1158 <dd>
1159 code of the issue (string)
1160 </dd><dt><i>line</i></dt>
1161 <dd>
1162 line number of the issue (integer)
1163 </dd><dt><i>pos</i></dt>
1164 <dd>
1165 position inside line (integer)
1166 </dd>
1167 </dl><dl>
1168 <dt>Returns:</dt>
1169 <dd>
1170 value indicating an applied/deferred fix (-1, 0, 1),
1171 a message for the fix (string) and an ID for a deferred
1172 fix (integer)
1173 </dd>
1174 </dl><a NAME="CodeStyleFixer.__fixE701" ID="CodeStyleFixer.__fixE701"></a>
1175 <h4>CodeStyleFixer.__fixE701</h4>
1176 <b>__fixE701</b>(<i>code, line, pos, apply=False</i>)
1177 <p>
1178 Private method to fix colon-separated compound statements.
1179 </p><p>
1180 Codes: E701
1181 </p><dl>
1182 <dt><i>code</i></dt>
1183 <dd>
1184 code of the issue (string)
1185 </dd><dt><i>line</i></dt>
1186 <dd>
1187 line number of the issue (integer)
1188 </dd><dt><i>pos</i></dt>
1189 <dd>
1190 position inside line (integer)
1191 </dd><dt><i>apply=</i></dt>
1192 <dd>
1193 flag indicating, that the fix should be applied
1194 (boolean)
1195 </dd>
1196 </dl><dl>
1197 <dt>Returns:</dt>
1198 <dd>
1199 value indicating an applied/deferred fix (-1, 0, 1),
1200 a message for the fix (string) and an ID for a deferred
1201 fix (integer)
1202 </dd>
1203 </dl><a NAME="CodeStyleFixer.__fixE702" ID="CodeStyleFixer.__fixE702"></a>
1204 <h4>CodeStyleFixer.__fixE702</h4>
1205 <b>__fixE702</b>(<i>code, line, pos, apply=False</i>)
1206 <p>
1207 Private method to fix semicolon-separated compound statements.
1208 </p><p>
1209 Codes: E702, E703
1210 </p><dl>
1211 <dt><i>code</i></dt>
1212 <dd>
1213 code of the issue (string)
1214 </dd><dt><i>line</i></dt>
1215 <dd>
1216 line number of the issue (integer)
1217 </dd><dt><i>pos</i></dt>
1218 <dd>
1219 position inside line (integer)
1220 </dd><dt><i>apply=</i></dt>
1221 <dd>
1222 flag indicating, that the fix should be applied
1223 (boolean)
1224 </dd>
1225 </dl><dl>
1226 <dt>Returns:</dt>
1227 <dd>
1228 value indicating an applied/deferred fix (-1, 0, 1),
1229 a message for the fix (string) and an ID for a deferred
1230 fix (integer)
1231 </dd>
1232 </dl><a NAME="CodeStyleFixer.__fixE711" ID="CodeStyleFixer.__fixE711"></a>
1233 <h4>CodeStyleFixer.__fixE711</h4>
1234 <b>__fixE711</b>(<i>code, line, pos</i>)
1235 <p>
1236 Private method to fix comparison with None.
1237 </p><p>
1238 Codes: E711, E712
1239 </p><dl>
1240 <dt><i>code</i></dt>
1241 <dd>
1242 code of the issue (string)
1243 </dd><dt><i>line</i></dt>
1244 <dd>
1245 line number of the issue (integer)
1246 </dd><dt><i>pos</i></dt>
1247 <dd>
1248 position inside line (integer)
1249 </dd>
1250 </dl><dl>
1251 <dt>Returns:</dt>
1252 <dd>
1253 value indicating an applied/deferred fix (-1, 0, 1),
1254 a message for the fix (string) and an ID for a deferred
1255 fix (integer)
1256 </dd>
1257 </dl><a NAME="CodeStyleFixer.__fixN804" ID="CodeStyleFixer.__fixN804"></a>
1258 <h4>CodeStyleFixer.__fixN804</h4>
1259 <b>__fixN804</b>(<i>code, line, pos, apply=False</i>)
1260 <p>
1261 Private method to fix a wrong first argument of normal and
1262 class methods.
1263 </p><p>
1264 Codes: N804, N805
1265 </p><dl>
1266 <dt><i>code</i></dt>
1267 <dd>
1268 code of the issue (string)
1269 </dd><dt><i>line</i></dt>
1270 <dd>
1271 line number of the issue (integer)
1272 </dd><dt><i>pos</i></dt>
1273 <dd>
1274 position inside line (integer)
1275 </dd><dt><i>apply=</i></dt>
1276 <dd>
1277 flag indicating, that the fix should be applied
1278 (boolean)
1279 </dd>
1280 </dl><dl>
1281 <dt>Returns:</dt>
1282 <dd>
1283 value indicating an applied/deferred fix (-1, 0, 1),
1284 a message for the fix (string) and an ID for a deferred
1285 fix (integer)
1286 </dd>
1287 </dl><a NAME="CodeStyleFixer.__fixN806" ID="CodeStyleFixer.__fixN806"></a>
1288 <h4>CodeStyleFixer.__fixN806</h4>
1289 <b>__fixN806</b>(<i>code, line, pos, apply=False</i>)
1290 <p>
1291 Private method to fix a wrong first argument of static methods.
1292 </p><p>
1293 Codes: N806
1294 </p><dl>
1295 <dt><i>code</i></dt>
1296 <dd>
1297 code of the issue (string)
1298 </dd><dt><i>line</i></dt>
1299 <dd>
1300 line number of the issue (integer)
1301 </dd><dt><i>pos</i></dt>
1302 <dd>
1303 position inside line (integer)
1304 </dd><dt><i>apply=</i></dt>
1305 <dd>
1306 flag indicating, that the fix should be applied
1307 (boolean)
1308 </dd>
1309 </dl><dl>
1310 <dt>Returns:</dt>
1311 <dd>
1312 value indicating an applied/deferred fix (-1, 0, 1),
1313 a message for the fix (string) and an ID for a deferred
1314 fix (integer)
1315 </dd>
1316 </dl><a NAME="CodeStyleFixer.__fixReindent" ID="CodeStyleFixer.__fixReindent"></a>
1317 <h4>CodeStyleFixer.__fixReindent</h4>
1318 <b>__fixReindent</b>(<i>line, pos, logical</i>)
1319 <p>
1320 Private method to fix a badly indented line.
1321 </p><p>
1322 This is done by adding or removing from its initial indent only.
1323 </p><dl>
1324 <dt><i>line</i></dt>
1325 <dd>
1326 line number of the issue (integer)
1327 </dd><dt><i>pos</i></dt>
1328 <dd>
1329 position inside line (integer)
1330 </dd><dt><i>logical</i></dt>
1331 <dd>
1332 logical line structure
1333 </dd>
1334 </dl><dl>
1335 <dt>Returns:</dt>
1336 <dd>
1337 flag indicating a change was done (boolean)
1338 </dd>
1339 </dl><a NAME="CodeStyleFixer.__fixW291" ID="CodeStyleFixer.__fixW291"></a>
1340 <h4>CodeStyleFixer.__fixW291</h4>
1341 <b>__fixW291</b>(<i>code, line, pos</i>)
1342 <p>
1343 Private method to fix trailing whitespace.
1344 </p><p>
1345 Codes: W291, W293
1346 </p><dl>
1347 <dt><i>code</i></dt>
1348 <dd>
1349 code of the issue (string)
1350 </dd><dt><i>line</i></dt>
1351 <dd>
1352 line number of the issue (integer)
1353 </dd><dt><i>pos</i></dt>
1354 <dd>
1355 position inside line (integer)
1356 </dd>
1357 </dl><dl>
1358 <dt>Returns:</dt>
1359 <dd>
1360 value indicating an applied/deferred fix (-1, 0, 1),
1361 a message for the fix (string) and an ID for a deferred
1362 fix (integer)
1363 </dd>
1364 </dl><a NAME="CodeStyleFixer.__fixW292" ID="CodeStyleFixer.__fixW292"></a>
1365 <h4>CodeStyleFixer.__fixW292</h4>
1366 <b>__fixW292</b>(<i>code, line, pos</i>)
1367 <p>
1368 Private method to fix a missing newline at the end of file.
1369 </p><p>
1370 Codes: W292
1371 </p><dl>
1372 <dt><i>code</i></dt>
1373 <dd>
1374 code of the issue (string)
1375 </dd><dt><i>line</i></dt>
1376 <dd>
1377 line number of the issue (integer)
1378 </dd><dt><i>pos</i></dt>
1379 <dd>
1380 position inside line (integer)
1381 </dd>
1382 </dl><dl>
1383 <dt>Returns:</dt>
1384 <dd>
1385 value indicating an applied/deferred fix (-1, 0, 1),
1386 a message for the fix (string) and an ID for a deferred
1387 fix (integer)
1388 </dd>
1389 </dl><a NAME="CodeStyleFixer.__fixW391" ID="CodeStyleFixer.__fixW391"></a>
1390 <h4>CodeStyleFixer.__fixW391</h4>
1391 <b>__fixW391</b>(<i>code, line, pos</i>)
1392 <p>
1393 Private method to fix trailing blank lines.
1394 </p><p>
1395 Codes: W391
1396 </p><dl>
1397 <dt><i>code</i></dt>
1398 <dd>
1399 code of the issue (string)
1400 </dd><dt><i>line</i></dt>
1401 <dd>
1402 line number of the issue (integer)
1403 </dd><dt><i>pos</i></dt>
1404 <dd>
1405 position inside line (integer)
1406 </dd>
1407 </dl><dl>
1408 <dt>Returns:</dt>
1409 <dd>
1410 value indicating an applied/deferred fix (-1, 0, 1),
1411 a message for the fix (string) and an ID for a deferred
1412 fix (integer)
1413 </dd>
1414 </dl><a NAME="CodeStyleFixer.__fixW603" ID="CodeStyleFixer.__fixW603"></a>
1415 <h4>CodeStyleFixer.__fixW603</h4>
1416 <b>__fixW603</b>(<i>code, line, pos</i>)
1417 <p>
1418 Private method to fix the not equal notation.
1419 </p><p>
1420 Codes: W603
1421 </p><dl>
1422 <dt><i>code</i></dt>
1423 <dd>
1424 code of the issue (string)
1425 </dd><dt><i>line</i></dt>
1426 <dd>
1427 line number of the issue (integer)
1428 </dd><dt><i>pos</i></dt>
1429 <dd>
1430 position inside line (integer)
1431 </dd>
1432 </dl><dl>
1433 <dt>Returns:</dt>
1434 <dd>
1435 value indicating an applied/deferred fix (-1, 0, 1),
1436 a message for the fix (string) and an ID for a deferred
1437 fix (integer)
1438 </dd>
1439 </dl><a NAME="CodeStyleFixer.__fixWhitespace" ID="CodeStyleFixer.__fixWhitespace"></a>
1440 <h4>CodeStyleFixer.__fixWhitespace</h4>
1441 <b>__fixWhitespace</b>(<i>line, offset, replacement</i>)
1442 <p>
1443 Private method to correct whitespace at the given offset.
1444 </p><dl>
1445 <dt><i>line</i></dt>
1446 <dd>
1447 line to be corrected (string)
1448 </dd><dt><i>offset</i></dt>
1449 <dd>
1450 offset within line (integer)
1451 </dd><dt><i>replacement</i></dt>
1452 <dd>
1453 replacement string (string)
1454 </dd>
1455 </dl><dl>
1456 <dt>Returns:</dt>
1457 <dd>
1458 corrected line
1459 </dd>
1460 </dl><a NAME="CodeStyleFixer.__getID" ID="CodeStyleFixer.__getID"></a>
1461 <h4>CodeStyleFixer.__getID</h4>
1462 <b>__getID</b>(<i></i>)
1463 <p>
1464 Private method to get the ID for a deferred fix.
1465 </p><dl>
1466 <dt>Returns:</dt>
1467 <dd>
1468 ID for a deferred fix (integer)
1469 </dd>
1470 </dl><a NAME="CodeStyleFixer.__getIndent" ID="CodeStyleFixer.__getIndent"></a>
1471 <h4>CodeStyleFixer.__getIndent</h4>
1472 <b>__getIndent</b>(<i>line</i>)
1473 <p>
1474 Private method to get the indentation string.
1475 </p><dl>
1476 <dt><i>line</i></dt>
1477 <dd>
1478 line to determine the indentation string from (string)
1479 </dd>
1480 </dl><dl>
1481 <dt>Returns:</dt>
1482 <dd>
1483 indentation string (string)
1484 </dd>
1485 </dl><a NAME="CodeStyleFixer.__getIndentWord" ID="CodeStyleFixer.__getIndentWord"></a>
1486 <h4>CodeStyleFixer.__getIndentWord</h4>
1487 <b>__getIndentWord</b>(<i></i>)
1488 <p>
1489 Private method to determine the indentation type.
1490 </p><dl>
1491 <dt>Returns:</dt>
1492 <dd>
1493 string to be used for an indentation (string)
1494 </dd>
1495 </dl><a NAME="CodeStyleFixer.__getLogical" ID="CodeStyleFixer.__getLogical"></a>
1496 <h4>CodeStyleFixer.__getLogical</h4>
1497 <b>__getLogical</b>(<i>line, pos</i>)
1498 <p>
1499 Private method to get the logical line corresponding to the given
1500 position.
1501 </p><dl>
1502 <dt><i>line</i></dt>
1503 <dd>
1504 line number of the issue (integer)
1505 </dd><dt><i>pos</i></dt>
1506 <dd>
1507 position inside line (integer)
1508 </dd>
1509 </dl><dl>
1510 <dt>Returns:</dt>
1511 <dd>
1512 tuple of a tuple of two integers giving the start of the
1513 logical line, another tuple of two integers giving the end
1514 of the logical line and a list of strings with the original
1515 source lines
1516 </dd>
1517 </dl><a NAME="CodeStyleFixer.__multilineStringLines" ID="CodeStyleFixer.__multilineStringLines"></a>
1518 <h4>CodeStyleFixer.__multilineStringLines</h4>
1519 <b>__multilineStringLines</b>(<i></i>)
1520 <p>
1521 Private method to determine the line numbers that are within multi line
1522 strings and these which are part of a documentation string.
1523 </p><dl>
1524 <dt>Returns:</dt>
1525 <dd>
1526 tuple of a set of line numbers belonging to a multi line
1527 string and a set of line numbers belonging to a multi line
1528 documentation string (tuple of two set of integer)
1529 </dd>
1530 </dl><a NAME="CodeStyleFixer.finalize" ID="CodeStyleFixer.finalize"></a>
1531 <h4>CodeStyleFixer.finalize</h4>
1532 <b>finalize</b>(<i></i>)
1533 <p>
1534 Public method to apply all deferred fixes.
1535 </p><dl>
1536 <dt>Returns:</dt>
1537 <dd>
1538 dictionary containing the fix results
1539 </dd>
1540 </dl><a NAME="CodeStyleFixer.fixIssue" ID="CodeStyleFixer.fixIssue"></a>
1541 <h4>CodeStyleFixer.fixIssue</h4>
1542 <b>fixIssue</b>(<i>line, pos, message</i>)
1543 <p>
1544 Public method to fix the fixable issues.
1545 </p><dl>
1546 <dt><i>line</i></dt>
1547 <dd>
1548 line number of issue (integer)
1549 </dd><dt><i>pos</i></dt>
1550 <dd>
1551 character position of issue (integer)
1552 </dd><dt><i>message</i></dt>
1553 <dd>
1554 message text (string)
1555 </dd>
1556 </dl><dl>
1557 <dt>Returns:</dt>
1558 <dd>
1559 value indicating an applied/deferred fix (-1, 0, 1),
1560 a message for the fix (string) and an ID for a deferred
1561 fix (integer)
1562 </dd>
1563 </dl><a NAME="CodeStyleFixer.mutualStartswith" ID="CodeStyleFixer.mutualStartswith"></a>
1564 <h4>CodeStyleFixer.mutualStartswith</h4>
1565 <b>mutualStartswith</b>(<i>b</i>)
1566 <p>
1567 Local helper method to compare the beginnings of two strings
1568 against each other.
1569 </p><dl>
1570 <dt>Returns:</dt>
1571 <dd>
1572 flag indicating that one string starts with the other
1573 (boolean)
1574 </dd>
1575 </dl><a NAME="CodeStyleFixer.saveFile" ID="CodeStyleFixer.saveFile"></a>
1576 <h4>CodeStyleFixer.saveFile</h4>
1577 <b>saveFile</b>(<i>encoding</i>)
1578 <p>
1579 Public method to save the modified file.
1580 </p><dl>
1581 <dt><i>encoding</i></dt>
1582 <dd>
1583 encoding of the source file (string)
1584 </dd>
1585 </dl><dl>
1586 <dt>Returns:</dt>
1587 <dd>
1588 error message on failure (tuple of str)
1589 </dd>
1590 </dl>
1591 <div align="right"><a href="#top">Up</a></div>
1592 <hr /><hr />
1593 <a NAME="IndentationWrapper" ID="IndentationWrapper"></a>
1594 <h2>IndentationWrapper</h2>
1595 <p>
1596 Class used by fixers dealing with indentation.
1597 </p><p>
1598 Each instance operates on a single logical line.
1599 </p>
1600 <h3>Derived from</h3>
1601 object
1602 <h3>Class Attributes</h3>
1603 <table>
1604 <tr><td>SKIP_TOKENS</td></tr>
1605 </table>
1606 <h3>Class Methods</h3>
1607 <table>
1608 <tr><td>None</td></tr>
1609 </table>
1610 <h3>Methods</h3>
1611 <table>
1612 <tr>
1613 <td><a href="#IndentationWrapper.__init__">IndentationWrapper</a></td>
1614 <td>Constructor</td>
1615 </tr><tr>
1616 <td><a href="#IndentationWrapper.__buildTokensLogical">__buildTokensLogical</a></td>
1617 <td>Private method to build a logical line from a list of tokens.</td>
1618 </tr><tr>
1619 <td><a href="#IndentationWrapper.pep8Expected">pep8Expected</a></td>
1620 <td>Public method to replicate logic in pycodestyle.py, to know what level to indent things to.</td>
1621 </tr>
1622 </table>
1623 <h3>Static Methods</h3>
1624 <table>
1625 <tr><td>None</td></tr>
1626 </table>
1627 <a NAME="IndentationWrapper.__init__" ID="IndentationWrapper.__init__"></a>
1628 <h4>IndentationWrapper (Constructor)</h4>
1629 <b>IndentationWrapper</b>(<i>physical_lines</i>)
1630 <p>
1631 Constructor
1632 </p><dl>
1633 <dt><i>physical_lines</i></dt>
1634 <dd>
1635 list of physical lines to operate on
1636 (list of strings)
1637 </dd>
1638 </dl><a NAME="IndentationWrapper.__buildTokensLogical" ID="IndentationWrapper.__buildTokensLogical"></a>
1639 <h4>IndentationWrapper.__buildTokensLogical</h4>
1640 <b>__buildTokensLogical</b>(<i>tokens</i>)
1641 <p>
1642 Private method to build a logical line from a list of tokens.
1643 </p><dl>
1644 <dt><i>tokens</i></dt>
1645 <dd>
1646 list of tokens as generated by tokenize.generate_tokens
1647 </dd>
1648 </dl><dl>
1649 <dt>Returns:</dt>
1650 <dd>
1651 logical line (string)
1652 </dd>
1653 </dl><a NAME="IndentationWrapper.pep8Expected" ID="IndentationWrapper.pep8Expected"></a>
1654 <h4>IndentationWrapper.pep8Expected</h4>
1655 <b>pep8Expected</b>(<i></i>)
1656 <p>
1657 Public method to replicate logic in pycodestyle.py, to know what level
1658 to indent things to.
1659 </p><dl>
1660 <dt>Returns:</dt>
1661 <dd>
1662 list of lists, where each list represents valid indent levels
1663 for the line in question, relative from the initial indent. However,
1664 the first entry is the indent level which was expected.
1665 </dd>
1666 </dl>
1667 <div align="right"><a href="#top">Up</a></div>
1668 <hr /><hr />
1669 <a NAME="LineShortener" ID="LineShortener"></a>
1670 <h2>LineShortener</h2>
1671 <p>
1672 Class used to shorten lines to a given maximum of characters.
1673 </p>
1674 <h3>Derived from</h3>
1675 object
1676 <h3>Class Attributes</h3>
1677 <table>
1678 <tr><td>None</td></tr>
1679 </table>
1680 <h3>Class Methods</h3>
1681 <table>
1682 <tr><td>None</td></tr>
1683 </table>
1684 <h3>Methods</h3>
1685 <table>
1686 <tr>
1687 <td><a href="#LineShortener.__init__">LineShortener</a></td>
1688 <td>Constructor</td>
1689 </tr><tr>
1690 <td><a href="#LineShortener.__breakMultiline">__breakMultiline</a></td>
1691 <td>Private method to break multi line strings.</td>
1692 </tr><tr>
1693 <td><a href="#LineShortener.__checkSyntax">__checkSyntax</a></td>
1694 <td>Private method to check the syntax of the given code fragment.</td>
1695 </tr><tr>
1696 <td><a href="#LineShortener.__countUnbalancedBrackets">__countUnbalancedBrackets</a></td>
1697 <td>Private method to determine the number of unmatched open/close brackets.</td>
1698 </tr><tr>
1699 <td><a href="#LineShortener.__getIndent">__getIndent</a></td>
1700 <td>Private method to get the indentation string.</td>
1701 </tr><tr>
1702 <td><a href="#LineShortener.__isProbablyInsideStringOrComment">__isProbablyInsideStringOrComment</a></td>
1703 <td>Private method to check, if the given string might be inside a string or comment.</td>
1704 </tr><tr>
1705 <td><a href="#LineShortener.__lineShorteningRank">__lineShorteningRank</a></td>
1706 <td>Private method to rank a candidate.</td>
1707 </tr><tr>
1708 <td><a href="#LineShortener.__normalizeMultiline">__normalizeMultiline</a></td>
1709 <td>Private method to remove multiline-related code that will cause syntax error.</td>
1710 </tr><tr>
1711 <td><a href="#LineShortener.__shortenComment">__shortenComment</a></td>
1712 <td>Private method to shorten a comment line.</td>
1713 </tr><tr>
1714 <td><a href="#LineShortener.__shortenLine">__shortenLine</a></td>
1715 <td>Private method to shorten a line of code at an operator.</td>
1716 </tr><tr>
1717 <td><a href="#LineShortener.shorten">shorten</a></td>
1718 <td>Public method to shorten the line wrapped by the class instance.</td>
1719 </tr>
1720 </table>
1721 <h3>Static Methods</h3>
1722 <table>
1723 <tr><td>None</td></tr>
1724 </table>
1725 <a NAME="LineShortener.__init__" ID="LineShortener.__init__"></a>
1726 <h4>LineShortener (Constructor)</h4>
1727 <b>LineShortener</b>(<i>curLine, prevLine, nextLine, maxLength=79, eol="\n", indentWord=" ", isDocString=False</i>)
1728 <p>
1729 Constructor
1730 </p><dl>
1731 <dt><i>curLine</i></dt>
1732 <dd>
1733 text to work on (string)
1734 </dd><dt><i>prevLine</i></dt>
1735 <dd>
1736 line before the text to work on (string)
1737 </dd><dt><i>nextLine</i></dt>
1738 <dd>
1739 line after the text to work on (string)
1740 </dd><dt><i>maxLength=</i></dt>
1741 <dd>
1742 maximum allowed line length (integer)
1743 </dd><dt><i>eol=</i></dt>
1744 <dd>
1745 eond-of-line marker (string)
1746 </dd><dt><i>indentWord=</i></dt>
1747 <dd>
1748 string used for indentation (string)
1749 </dd><dt><i>isDocString=</i></dt>
1750 <dd>
1751 flag indicating that the line belongs to
1752 a documentation string (boolean)
1753 </dd>
1754 </dl><a NAME="LineShortener.__breakMultiline" ID="LineShortener.__breakMultiline"></a>
1755 <h4>LineShortener.__breakMultiline</h4>
1756 <b>__breakMultiline</b>(<i></i>)
1757 <p>
1758 Private method to break multi line strings.
1759 </p><dl>
1760 <dt>Returns:</dt>
1761 <dd>
1762 tuple of the shortened line and the changed next line
1763 (string, string)
1764 </dd>
1765 </dl><a NAME="LineShortener.__checkSyntax" ID="LineShortener.__checkSyntax"></a>
1766 <h4>LineShortener.__checkSyntax</h4>
1767 <b>__checkSyntax</b>(<i>code</i>)
1768 <p>
1769 Private method to check the syntax of the given code fragment.
1770 </p><dl>
1771 <dt><i>code</i></dt>
1772 <dd>
1773 code fragment to check (string)
1774 </dd>
1775 </dl><dl>
1776 <dt>Returns:</dt>
1777 <dd>
1778 flag indicating syntax is ok (boolean)
1779 </dd>
1780 </dl><a NAME="LineShortener.__countUnbalancedBrackets" ID="LineShortener.__countUnbalancedBrackets"></a>
1781 <h4>LineShortener.__countUnbalancedBrackets</h4>
1782 <b>__countUnbalancedBrackets</b>(<i>line</i>)
1783 <p>
1784 Private method to determine the number of unmatched open/close
1785 brackets.
1786 </p><dl>
1787 <dt><i>line</i></dt>
1788 <dd>
1789 line to work at (string)
1790 </dd>
1791 </dl><dl>
1792 <dt>Returns:</dt>
1793 <dd>
1794 number of unmatched open/close brackets (integer)
1795 </dd>
1796 </dl><a NAME="LineShortener.__getIndent" ID="LineShortener.__getIndent"></a>
1797 <h4>LineShortener.__getIndent</h4>
1798 <b>__getIndent</b>(<i>line</i>)
1799 <p>
1800 Private method to get the indentation string.
1801 </p><dl>
1802 <dt><i>line</i></dt>
1803 <dd>
1804 line to determine the indentation string from (string)
1805 </dd>
1806 </dl><dl>
1807 <dt>Returns:</dt>
1808 <dd>
1809 indentation string (string)
1810 </dd>
1811 </dl><a NAME="LineShortener.__isProbablyInsideStringOrComment" ID="LineShortener.__isProbablyInsideStringOrComment"></a>
1812 <h4>LineShortener.__isProbablyInsideStringOrComment</h4>
1813 <b>__isProbablyInsideStringOrComment</b>(<i>line, index</i>)
1814 <p>
1815 Private method to check, if the given string might be inside a string
1816 or comment.
1817 </p><dl>
1818 <dt><i>line</i></dt>
1819 <dd>
1820 line to check (string)
1821 </dd><dt><i>index</i></dt>
1822 <dd>
1823 position inside line to check (integer)
1824 </dd>
1825 </dl><dl>
1826 <dt>Returns:</dt>
1827 <dd>
1828 flag indicating the possibility of being inside a string
1829 or comment
1830 </dd>
1831 </dl><a NAME="LineShortener.__lineShorteningRank" ID="LineShortener.__lineShorteningRank"></a>
1832 <h4>LineShortener.__lineShorteningRank</h4>
1833 <b>__lineShorteningRank</b>(<i>candidate</i>)
1834 <p>
1835 Private method to rank a candidate.
1836 </p><dl>
1837 <dt><i>candidate</i></dt>
1838 <dd>
1839 candidate line to rank (string)
1840 </dd>
1841 </dl><dl>
1842 <dt>Returns:</dt>
1843 <dd>
1844 rank of the candidate (integer)
1845 </dd>
1846 </dl><a NAME="LineShortener.__normalizeMultiline" ID="LineShortener.__normalizeMultiline"></a>
1847 <h4>LineShortener.__normalizeMultiline</h4>
1848 <b>__normalizeMultiline</b>(<i>text</i>)
1849 <p>
1850 Private method to remove multiline-related code that will cause syntax
1851 error.
1852 </p><dl>
1853 <dt><i>text</i></dt>
1854 <dd>
1855 code line to work on (string)
1856 </dd>
1857 </dl><dl>
1858 <dt>Returns:</dt>
1859 <dd>
1860 normalized code line (string)
1861 </dd>
1862 </dl><a NAME="LineShortener.__shortenComment" ID="LineShortener.__shortenComment"></a>
1863 <h4>LineShortener.__shortenComment</h4>
1864 <b>__shortenComment</b>(<i>isLast</i>)
1865 <p>
1866 Private method to shorten a comment line.
1867 </p><dl>
1868 <dt><i>isLast</i></dt>
1869 <dd>
1870 flag indicating, that the line is the last comment line
1871 (boolean)
1872 </dd>
1873 </dl><dl>
1874 <dt>Returns:</dt>
1875 <dd>
1876 shortened comment line (string)
1877 </dd>
1878 </dl><a NAME="LineShortener.__shortenLine" ID="LineShortener.__shortenLine"></a>
1879 <h4>LineShortener.__shortenLine</h4>
1880 <b>__shortenLine</b>(<i>tokens, source, indent</i>)
1881 <p>
1882 Private method to shorten a line of code at an operator.
1883 </p><dl>
1884 <dt><i>tokens</i></dt>
1885 <dd>
1886 tokens of the line as generated by tokenize
1887 (list of token)
1888 </dd><dt><i>source</i></dt>
1889 <dd>
1890 code string to work at (string)
1891 </dd><dt><i>indent</i></dt>
1892 <dd>
1893 indentation string of the code line (string)
1894 </dd>
1895 </dl><dl>
1896 <dt>Returns:</dt>
1897 <dd>
1898 list of candidates (list of string)
1899 </dd>
1900 </dl><a NAME="LineShortener.shorten" ID="LineShortener.shorten"></a>
1901 <h4>LineShortener.shorten</h4>
1902 <b>shorten</b>(<i></i>)
1903 <p>
1904 Public method to shorten the line wrapped by the class instance.
1905 </p><dl>
1906 <dt>Returns:</dt>
1907 <dd>
1908 tuple of a flag indicating successful shortening, the
1909 shortened line and the changed next line (boolean, string, string)
1910 </dd>
1911 </dl>
1912 <div align="right"><a href="#top">Up</a></div>
1913 <hr /><hr />
1914 <a NAME="Reindenter" ID="Reindenter"></a>
1915 <h2>Reindenter</h2>
1916 <p>
1917 Class to reindent badly-indented code to uniformly use four-space
1918 indentation.
1919 </p><p>
1920 Released to the public domain, by Tim Peters, 03 October 2000.
1921 </p>
1922 <h3>Derived from</h3>
1923 object
1924 <h3>Class Attributes</h3>
1925 <table>
1926 <tr><td>None</td></tr>
1927 </table>
1928 <h3>Class Methods</h3>
1929 <table>
1930 <tr><td>None</td></tr>
1931 </table>
1932 <h3>Methods</h3>
1933 <table>
1934 <tr>
1935 <td><a href="#Reindenter.__init__">Reindenter</a></td>
1936 <td>Constructor</td>
1937 </tr><tr>
1938 <td><a href="#Reindenter.__genStats">__genStats</a></td>
1939 <td>Private method to generate the re-indent statistics.</td>
1940 </tr><tr>
1941 <td><a href="#Reindenter.__getlspace">__getlspace</a></td>
1942 <td>Private method to count number of leading blanks.</td>
1943 </tr><tr>
1944 <td><a href="#Reindenter.fixedLine">fixedLine</a></td>
1945 <td>Public method to get a fixed line.</td>
1946 </tr><tr>
1947 <td><a href="#Reindenter.getline">getline</a></td>
1948 <td>Public method to get a line of text for tokenize.</td>
1949 </tr><tr>
1950 <td><a href="#Reindenter.run">run</a></td>
1951 <td>Public method to run the re-indenter.</td>
1952 </tr>
1953 </table>
1954 <h3>Static Methods</h3>
1955 <table>
1956 <tr><td>None</td></tr>
1957 </table>
1958 <a NAME="Reindenter.__init__" ID="Reindenter.__init__"></a>
1959 <h4>Reindenter (Constructor)</h4>
1960 <b>Reindenter</b>(<i>sourceLines</i>)
1961 <p>
1962 Constructor
1963 </p><dl>
1964 <dt><i>sourceLines</i></dt>
1965 <dd>
1966 list of source lines including eol marker
1967 (list of string)
1968 </dd>
1969 </dl><a NAME="Reindenter.__genStats" ID="Reindenter.__genStats"></a>
1970 <h4>Reindenter.__genStats</h4>
1971 <b>__genStats</b>(<i>tokens</i>)
1972 <p>
1973 Private method to generate the re-indent statistics.
1974 </p><dl>
1975 <dt><i>tokens</i></dt>
1976 <dd>
1977 tokens generator (tokenize._tokenize)
1978 </dd>
1979 </dl><dl>
1980 <dt>Returns:</dt>
1981 <dd>
1982 reference to the generated statistics
1983 </dd>
1984 </dl><a NAME="Reindenter.__getlspace" ID="Reindenter.__getlspace"></a>
1985 <h4>Reindenter.__getlspace</h4>
1986 <b>__getlspace</b>(<i>line</i>)
1987 <p>
1988 Private method to count number of leading blanks.
1989 </p><dl>
1990 <dt><i>line</i></dt>
1991 <dd>
1992 line to check (string)
1993 </dd>
1994 </dl><dl>
1995 <dt>Returns:</dt>
1996 <dd>
1997 number of leading blanks (integer)
1998 </dd>
1999 </dl><a NAME="Reindenter.fixedLine" ID="Reindenter.fixedLine"></a>
2000 <h4>Reindenter.fixedLine</h4>
2001 <b>fixedLine</b>(<i>line</i>)
2002 <p>
2003 Public method to get a fixed line.
2004 </p><dl>
2005 <dt><i>line</i></dt>
2006 <dd>
2007 number of the line to retrieve (integer)
2008 </dd>
2009 </dl><dl>
2010 <dt>Returns:</dt>
2011 <dd>
2012 fixed line (string)
2013 </dd>
2014 </dl><a NAME="Reindenter.getline" ID="Reindenter.getline"></a>
2015 <h4>Reindenter.getline</h4>
2016 <b>getline</b>(<i></i>)
2017 <p>
2018 Public method to get a line of text for tokenize.
2019 </p><dl>
2020 <dt>Returns:</dt>
2021 <dd>
2022 line of text (string)
2023 </dd>
2024 </dl><a NAME="Reindenter.run" ID="Reindenter.run"></a>
2025 <h4>Reindenter.run</h4>
2026 <b>run</b>(<i></i>)
2027 <p>
2028 Public method to run the re-indenter.
2029 </p><dl>
2030 <dt>Returns:</dt>
2031 <dd>
2032 flag indicating that a change was done (boolean)
2033 </dd>
2034 </dl>
2035 <div align="right"><a href="#top">Up</a></div>
2036 <hr />
2037 </body></html>

eric ide

mercurial