5 <link rel="stylesheet" href="styles.css"> |
5 <link rel="stylesheet" href="styles.css"> |
6 </head> |
6 </head> |
7 <body> |
7 <body> |
8 <a NAME="top" ID="top"></a> |
8 <a NAME="top" ID="top"></a> |
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer</h1> |
9 <h1>eric7.Plugins.CheckerPlugins.CodeStyleChecker.CodeStyleFixer</h1> |
10 |
|
11 <p> |
10 <p> |
12 Module implementing a class to fix certain code style issues. |
11 Module implementing a class to fix certain code style issues. |
13 </p> |
12 </p> |
|
13 |
14 <h3>Global Attributes</h3> |
14 <h3>Global Attributes</h3> |
15 |
|
16 <table> |
15 <table> |
17 <tr><td>FixableCodeStyleIssues</td></tr> |
16 <tr><td>FixableCodeStyleIssues</td></tr> |
18 </table> |
17 </table> |
|
18 |
19 <h3>Classes</h3> |
19 <h3>Classes</h3> |
20 |
|
21 <table> |
20 <table> |
22 |
|
23 <tr> |
21 <tr> |
24 <td><a href="#CodeStyleFixer">CodeStyleFixer</a></td> |
22 <td><a href="#CodeStyleFixer">CodeStyleFixer</a></td> |
25 <td>Class implementing a fixer for certain code style issues.</td> |
23 <td>Class implementing a fixer for certain code style issues.</td> |
26 </tr> |
24 </tr> |
27 <tr> |
25 <tr> |
35 <tr> |
33 <tr> |
36 <td><a href="#Reindenter">Reindenter</a></td> |
34 <td><a href="#Reindenter">Reindenter</a></td> |
37 <td>Class to reindent badly-indented code to uniformly use four-space indentation.</td> |
35 <td>Class to reindent badly-indented code to uniformly use four-space indentation.</td> |
38 </tr> |
36 </tr> |
39 </table> |
37 </table> |
|
38 |
40 <h3>Functions</h3> |
39 <h3>Functions</h3> |
41 |
|
42 <table> |
40 <table> |
43 <tr><td>None</td></tr> |
41 <tr><td>None</td></tr> |
44 </table> |
42 </table> |
|
43 |
45 <hr /> |
44 <hr /> |
46 <hr /> |
45 <hr /> |
47 <a NAME="CodeStyleFixer" ID="CodeStyleFixer"></a> |
46 <a NAME="CodeStyleFixer" ID="CodeStyleFixer"></a> |
48 <h2>CodeStyleFixer</h2> |
47 <h2>CodeStyleFixer</h2> |
49 |
|
50 <p> |
48 <p> |
51 Class implementing a fixer for certain code style issues. |
49 Class implementing a fixer for certain code style issues. |
52 </p> |
50 </p> |
|
51 |
53 <h3>Derived from</h3> |
52 <h3>Derived from</h3> |
54 None |
53 None |
55 <h3>Class Attributes</h3> |
54 <h3>Class Attributes</h3> |
56 |
|
57 <table> |
55 <table> |
58 <tr><td>None</td></tr> |
56 <tr><td>None</td></tr> |
59 </table> |
57 </table> |
|
58 |
60 <h3>Class Methods</h3> |
59 <h3>Class Methods</h3> |
61 |
|
62 <table> |
60 <table> |
63 <tr><td>None</td></tr> |
61 <tr><td>None</td></tr> |
64 </table> |
62 </table> |
|
63 |
65 <h3>Methods</h3> |
64 <h3>Methods</h3> |
66 |
|
67 <table> |
65 <table> |
68 |
|
69 <tr> |
66 <tr> |
70 <td><a href="#CodeStyleFixer.__init__">CodeStyleFixer</a></td> |
67 <td><a href="#CodeStyleFixer.__init__">CodeStyleFixer</a></td> |
71 <td>Constructor</td> |
68 <td>Constructor</td> |
72 </tr> |
69 </tr> |
73 <tr> |
70 <tr> |
281 <tr> |
278 <tr> |
282 <td><a href="#CodeStyleFixer.saveFile">saveFile</a></td> |
279 <td><a href="#CodeStyleFixer.saveFile">saveFile</a></td> |
283 <td>Public method to save the modified file.</td> |
280 <td>Public method to save the modified file.</td> |
284 </tr> |
281 </tr> |
285 </table> |
282 </table> |
|
283 |
286 <h3>Static Methods</h3> |
284 <h3>Static Methods</h3> |
287 |
|
288 <table> |
285 <table> |
289 <tr><td>None</td></tr> |
286 <tr><td>None</td></tr> |
290 </table> |
287 </table> |
291 |
288 |
|
289 |
292 <a NAME="CodeStyleFixer.__init__" ID="CodeStyleFixer.__init__"></a> |
290 <a NAME="CodeStyleFixer.__init__" ID="CodeStyleFixer.__init__"></a> |
293 <h4>CodeStyleFixer (Constructor)</h4> |
291 <h4>CodeStyleFixer (Constructor)</h4> |
294 <b>CodeStyleFixer</b>(<i>filename, sourceLines, fixCodes, noFixCodes, maxLineLength, blankLines, inPlace, eol, backup=False, </i>) |
292 <b>CodeStyleFixer</b>(<i>filename, sourceLines, fixCodes, noFixCodes, maxLineLength, blankLines, inPlace, eol, backup=False, </i>) |
295 |
|
296 <p> |
293 <p> |
297 Constructor |
294 Constructor |
298 </p> |
295 </p> |
|
296 |
299 <dl> |
297 <dl> |
300 |
298 |
301 <dt><i>filename</i> (str)</dt> |
299 <dt><i>filename</i> (str)</dt> |
302 <dd> |
300 <dd> |
303 name of the file to be fixed |
301 name of the file to be fixed |
341 </dd> |
339 </dd> |
342 </dl> |
340 </dl> |
343 <a NAME="CodeStyleFixer.__codeMatch" ID="CodeStyleFixer.__codeMatch"></a> |
341 <a NAME="CodeStyleFixer.__codeMatch" ID="CodeStyleFixer.__codeMatch"></a> |
344 <h4>CodeStyleFixer.__codeMatch</h4> |
342 <h4>CodeStyleFixer.__codeMatch</h4> |
345 <b>__codeMatch</b>(<i>code</i>) |
343 <b>__codeMatch</b>(<i>code</i>) |
346 |
|
347 <p> |
344 <p> |
348 Private method to check, if the code should be fixed. |
345 Private method to check, if the code should be fixed. |
349 </p> |
346 </p> |
|
347 |
350 <dl> |
348 <dl> |
351 |
349 |
352 <dt><i>code</i> (str)</dt> |
350 <dt><i>code</i> (str)</dt> |
353 <dd> |
351 <dd> |
354 to check |
352 to check |
367 </dd> |
365 </dd> |
368 </dl> |
366 </dl> |
369 <a NAME="CodeStyleFixer.__findLogical" ID="CodeStyleFixer.__findLogical"></a> |
367 <a NAME="CodeStyleFixer.__findLogical" ID="CodeStyleFixer.__findLogical"></a> |
370 <h4>CodeStyleFixer.__findLogical</h4> |
368 <h4>CodeStyleFixer.__findLogical</h4> |
371 <b>__findLogical</b>(<i></i>) |
369 <b>__findLogical</b>(<i></i>) |
372 |
|
373 <p> |
370 <p> |
374 Private method to extract the index of all the starts and ends of |
371 Private method to extract the index of all the starts and ends of |
375 lines. |
372 lines. |
376 </p> |
373 </p> |
|
374 |
377 <dl> |
375 <dl> |
378 <dt>Return:</dt> |
376 <dt>Return:</dt> |
379 <dd> |
377 <dd> |
380 tuple containing two lists of integer with start and end tuples |
378 tuple containing two lists of integer with start and end tuples |
381 of lines |
379 of lines |
388 </dd> |
386 </dd> |
389 </dl> |
387 </dl> |
390 <a NAME="CodeStyleFixer.__fixBlankLinesBefore" ID="CodeStyleFixer.__fixBlankLinesBefore"></a> |
388 <a NAME="CodeStyleFixer.__fixBlankLinesBefore" ID="CodeStyleFixer.__fixBlankLinesBefore"></a> |
391 <h4>CodeStyleFixer.__fixBlankLinesBefore</h4> |
389 <h4>CodeStyleFixer.__fixBlankLinesBefore</h4> |
392 <b>__fixBlankLinesBefore</b>(<i>code, line, pos, apply=False</i>) |
390 <b>__fixBlankLinesBefore</b>(<i>code, line, pos, apply=False</i>) |
393 |
|
394 <p> |
391 <p> |
395 Private method to fix the need for blank lines before class, function |
392 Private method to fix the need for blank lines before class, function |
396 and method definitions. |
393 and method definitions. |
397 </p> |
394 </p> |
398 <p> |
395 <p> |
399 Codes: E301, E302, E303, E305, E306, E307, E308 |
396 Codes: E301, E302, E303, E305, E306, E307, E308 |
400 </p> |
397 </p> |
|
398 |
401 <dl> |
399 <dl> |
402 |
400 |
403 <dt><i>code</i> (str)</dt> |
401 <dt><i>code</i> (str)</dt> |
404 <dd> |
402 <dd> |
405 code of the issue |
403 code of the issue |
432 </dd> |
430 </dd> |
433 </dl> |
431 </dl> |
434 <a NAME="CodeStyleFixer.__fixD111" ID="CodeStyleFixer.__fixD111"></a> |
432 <a NAME="CodeStyleFixer.__fixD111" ID="CodeStyleFixer.__fixD111"></a> |
435 <h4>CodeStyleFixer.__fixD111</h4> |
433 <h4>CodeStyleFixer.__fixD111</h4> |
436 <b>__fixD111</b>(<i>code, line, pos</i>) |
434 <b>__fixD111</b>(<i>code, line, pos</i>) |
437 |
|
438 <p> |
435 <p> |
439 Private method to fix docstring enclosed in wrong quotes. |
436 Private method to fix docstring enclosed in wrong quotes. |
440 </p> |
437 </p> |
441 <p> |
438 <p> |
442 Codes: D111 |
439 Codes: D111 |
443 </p> |
440 </p> |
|
441 |
444 <dl> |
442 <dl> |
445 |
443 |
446 <dt><i>code</i> (str)</dt> |
444 <dt><i>code</i> (str)</dt> |
447 <dd> |
445 <dd> |
448 code of the issue |
446 code of the issue |
471 </dd> |
469 </dd> |
472 </dl> |
470 </dl> |
473 <a NAME="CodeStyleFixer.__fixD112" ID="CodeStyleFixer.__fixD112"></a> |
471 <a NAME="CodeStyleFixer.__fixD112" ID="CodeStyleFixer.__fixD112"></a> |
474 <h4>CodeStyleFixer.__fixD112</h4> |
472 <h4>CodeStyleFixer.__fixD112</h4> |
475 <b>__fixD112</b>(<i>code, line, pos</i>) |
473 <b>__fixD112</b>(<i>code, line, pos</i>) |
476 |
|
477 <p> |
474 <p> |
478 Private method to fix docstring 'r' in leading quotes. |
475 Private method to fix docstring 'r' in leading quotes. |
479 </p> |
476 </p> |
480 <p> |
477 <p> |
481 Codes: D112 |
478 Codes: D112 |
482 </p> |
479 </p> |
|
480 |
483 <dl> |
481 <dl> |
484 |
482 |
485 <dt><i>code</i> (str)</dt> |
483 <dt><i>code</i> (str)</dt> |
486 <dd> |
484 <dd> |
487 code of the issue |
485 code of the issue |
510 </dd> |
508 </dd> |
511 </dl> |
509 </dl> |
512 <a NAME="CodeStyleFixer.__fixD121" ID="CodeStyleFixer.__fixD121"></a> |
510 <a NAME="CodeStyleFixer.__fixD121" ID="CodeStyleFixer.__fixD121"></a> |
513 <h4>CodeStyleFixer.__fixD121</h4> |
511 <h4>CodeStyleFixer.__fixD121</h4> |
514 <b>__fixD121</b>(<i>code, line, pos, apply=False</i>) |
512 <b>__fixD121</b>(<i>code, line, pos, apply=False</i>) |
515 |
|
516 <p> |
513 <p> |
517 Private method to fix a single line docstring on multiple lines. |
514 Private method to fix a single line docstring on multiple lines. |
518 </p> |
515 </p> |
519 <p> |
516 <p> |
520 Codes: D121 |
517 Codes: D121 |
521 </p> |
518 </p> |
|
519 |
522 <dl> |
520 <dl> |
523 |
521 |
524 <dt><i>code</i> (str)</dt> |
522 <dt><i>code</i> (str)</dt> |
525 <dd> |
523 <dd> |
526 code of the issue |
524 code of the issue |
553 </dd> |
551 </dd> |
554 </dl> |
552 </dl> |
555 <a NAME="CodeStyleFixer.__fixD131" ID="CodeStyleFixer.__fixD131"></a> |
553 <a NAME="CodeStyleFixer.__fixD131" ID="CodeStyleFixer.__fixD131"></a> |
556 <h4>CodeStyleFixer.__fixD131</h4> |
554 <h4>CodeStyleFixer.__fixD131</h4> |
557 <b>__fixD131</b>(<i>code, line, pos</i>) |
555 <b>__fixD131</b>(<i>code, line, pos</i>) |
558 |
|
559 <p> |
556 <p> |
560 Private method to fix a docstring summary not ending with a |
557 Private method to fix a docstring summary not ending with a |
561 period. |
558 period. |
562 </p> |
559 </p> |
563 <p> |
560 <p> |
564 Codes: D131 |
561 Codes: D131 |
565 </p> |
562 </p> |
|
563 |
566 <dl> |
564 <dl> |
567 |
565 |
568 <dt><i>code</i> (str)</dt> |
566 <dt><i>code</i> (str)</dt> |
569 <dd> |
567 <dd> |
570 code of the issue |
568 code of the issue |
593 </dd> |
591 </dd> |
594 </dl> |
592 </dl> |
595 <a NAME="CodeStyleFixer.__fixD141" ID="CodeStyleFixer.__fixD141"></a> |
593 <a NAME="CodeStyleFixer.__fixD141" ID="CodeStyleFixer.__fixD141"></a> |
596 <h4>CodeStyleFixer.__fixD141</h4> |
594 <h4>CodeStyleFixer.__fixD141</h4> |
597 <b>__fixD141</b>(<i>code, line, pos, apply=False</i>) |
595 <b>__fixD141</b>(<i>code, line, pos, apply=False</i>) |
598 |
|
599 <p> |
596 <p> |
600 Private method to fix a function/method docstring preceded by a |
597 Private method to fix a function/method docstring preceded by a |
601 blank line. |
598 blank line. |
602 </p> |
599 </p> |
603 <p> |
600 <p> |
604 Codes: D141 |
601 Codes: D141 |
605 </p> |
602 </p> |
|
603 |
606 <dl> |
604 <dl> |
607 |
605 |
608 <dt><i>code</i> (str)</dt> |
606 <dt><i>code</i> (str)</dt> |
609 <dd> |
607 <dd> |
610 code of the issue |
608 code of the issue |
637 </dd> |
635 </dd> |
638 </dl> |
636 </dl> |
639 <a NAME="CodeStyleFixer.__fixD142" ID="CodeStyleFixer.__fixD142"></a> |
637 <a NAME="CodeStyleFixer.__fixD142" ID="CodeStyleFixer.__fixD142"></a> |
640 <h4>CodeStyleFixer.__fixD142</h4> |
638 <h4>CodeStyleFixer.__fixD142</h4> |
641 <b>__fixD142</b>(<i>code, line, pos, apply=False</i>) |
639 <b>__fixD142</b>(<i>code, line, pos, apply=False</i>) |
642 |
|
643 <p> |
640 <p> |
644 Private method to fix a class docstring not preceded by a |
641 Private method to fix a class docstring not preceded by a |
645 blank line. |
642 blank line. |
646 </p> |
643 </p> |
647 <p> |
644 <p> |
648 Codes: D142 |
645 Codes: D142 |
649 </p> |
646 </p> |
|
647 |
650 <dl> |
648 <dl> |
651 |
649 |
652 <dt><i>code</i> (str)</dt> |
650 <dt><i>code</i> (str)</dt> |
653 <dd> |
651 <dd> |
654 code of the issue |
652 code of the issue |
681 </dd> |
679 </dd> |
682 </dl> |
680 </dl> |
683 <a NAME="CodeStyleFixer.__fixD143" ID="CodeStyleFixer.__fixD143"></a> |
681 <a NAME="CodeStyleFixer.__fixD143" ID="CodeStyleFixer.__fixD143"></a> |
684 <h4>CodeStyleFixer.__fixD143</h4> |
682 <h4>CodeStyleFixer.__fixD143</h4> |
685 <b>__fixD143</b>(<i>code, line, pos, apply=False</i>) |
683 <b>__fixD143</b>(<i>code, line, pos, apply=False</i>) |
686 |
|
687 <p> |
684 <p> |
688 Private method to fix a class docstring not followed by a |
685 Private method to fix a class docstring not followed by a |
689 blank line. |
686 blank line. |
690 </p> |
687 </p> |
691 <p> |
688 <p> |
692 Codes: D143 |
689 Codes: D143 |
693 </p> |
690 </p> |
|
691 |
694 <dl> |
692 <dl> |
695 |
693 |
696 <dt><i>code</i> (str)</dt> |
694 <dt><i>code</i> (str)</dt> |
697 <dd> |
695 <dd> |
698 code of the issue |
696 code of the issue |
725 </dd> |
723 </dd> |
726 </dl> |
724 </dl> |
727 <a NAME="CodeStyleFixer.__fixD144" ID="CodeStyleFixer.__fixD144"></a> |
725 <a NAME="CodeStyleFixer.__fixD144" ID="CodeStyleFixer.__fixD144"></a> |
728 <h4>CodeStyleFixer.__fixD144</h4> |
726 <h4>CodeStyleFixer.__fixD144</h4> |
729 <b>__fixD144</b>(<i>code, line, pos, apply=False</i>) |
727 <b>__fixD144</b>(<i>code, line, pos, apply=False</i>) |
730 |
|
731 <p> |
728 <p> |
732 Private method to fix a docstring summary not followed by a |
729 Private method to fix a docstring summary not followed by a |
733 blank line. |
730 blank line. |
734 </p> |
731 </p> |
735 <p> |
732 <p> |
736 Codes: D144 |
733 Codes: D144 |
737 </p> |
734 </p> |
|
735 |
738 <dl> |
736 <dl> |
739 |
737 |
740 <dt><i>code</i> (str)</dt> |
738 <dt><i>code</i> (str)</dt> |
741 <dd> |
739 <dd> |
742 code of the issue |
740 code of the issue |
769 </dd> |
767 </dd> |
770 </dl> |
768 </dl> |
771 <a NAME="CodeStyleFixer.__fixD145" ID="CodeStyleFixer.__fixD145"></a> |
769 <a NAME="CodeStyleFixer.__fixD145" ID="CodeStyleFixer.__fixD145"></a> |
772 <h4>CodeStyleFixer.__fixD145</h4> |
770 <h4>CodeStyleFixer.__fixD145</h4> |
773 <b>__fixD145</b>(<i>code, line, pos, apply=False</i>) |
771 <b>__fixD145</b>(<i>code, line, pos, apply=False</i>) |
774 |
|
775 <p> |
772 <p> |
776 Private method to fix the last paragraph of a multi-line docstring |
773 Private method to fix the last paragraph of a multi-line docstring |
777 not followed by a blank line. |
774 not followed by a blank line. |
778 </p> |
775 </p> |
779 <p> |
776 <p> |
780 Codes: D143 |
777 Codes: D143 |
781 </p> |
778 </p> |
|
779 |
782 <dl> |
780 <dl> |
783 |
781 |
784 <dt><i>code</i> (str)</dt> |
782 <dt><i>code</i> (str)</dt> |
785 <dd> |
783 <dd> |
786 code of the issue |
784 code of the issue |
813 </dd> |
811 </dd> |
814 </dl> |
812 </dl> |
815 <a NAME="CodeStyleFixer.__fixD221" ID="CodeStyleFixer.__fixD221"></a> |
813 <a NAME="CodeStyleFixer.__fixD221" ID="CodeStyleFixer.__fixD221"></a> |
816 <h4>CodeStyleFixer.__fixD221</h4> |
814 <h4>CodeStyleFixer.__fixD221</h4> |
817 <b>__fixD221</b>(<i>code, line, pos, apply=False</i>) |
815 <b>__fixD221</b>(<i>code, line, pos, apply=False</i>) |
818 |
|
819 <p> |
816 <p> |
820 Private method to fix leading and trailing quotes of docstring |
817 Private method to fix leading and trailing quotes of docstring |
821 not on separate lines. |
818 not on separate lines. |
822 </p> |
819 </p> |
823 <p> |
820 <p> |
824 Codes: D221, D222 |
821 Codes: D221, D222 |
825 </p> |
822 </p> |
|
823 |
826 <dl> |
824 <dl> |
827 |
825 |
828 <dt><i>code</i> (str)</dt> |
826 <dt><i>code</i> (str)</dt> |
829 <dd> |
827 <dd> |
830 code of the issue |
828 code of the issue |
857 </dd> |
855 </dd> |
858 </dl> |
856 </dl> |
859 <a NAME="CodeStyleFixer.__fixD242" ID="CodeStyleFixer.__fixD242"></a> |
857 <a NAME="CodeStyleFixer.__fixD242" ID="CodeStyleFixer.__fixD242"></a> |
860 <h4>CodeStyleFixer.__fixD242</h4> |
858 <h4>CodeStyleFixer.__fixD242</h4> |
861 <b>__fixD242</b>(<i>code, line, pos, apply=False</i>) |
859 <b>__fixD242</b>(<i>code, line, pos, apply=False</i>) |
862 |
|
863 <p> |
860 <p> |
864 Private method to fix a class or function/method docstring preceded |
861 Private method to fix a class or function/method docstring preceded |
865 by a blank line. |
862 by a blank line. |
866 </p> |
863 </p> |
867 <p> |
864 <p> |
868 Codes: D242, D244 |
865 Codes: D242, D244 |
869 </p> |
866 </p> |
|
867 |
870 <dl> |
868 <dl> |
871 |
869 |
872 <dt><i>code</i> (str)</dt> |
870 <dt><i>code</i> (str)</dt> |
873 <dd> |
871 <dd> |
874 code of the issue |
872 code of the issue |
901 </dd> |
899 </dd> |
902 </dl> |
900 </dl> |
903 <a NAME="CodeStyleFixer.__fixD243" ID="CodeStyleFixer.__fixD243"></a> |
901 <a NAME="CodeStyleFixer.__fixD243" ID="CodeStyleFixer.__fixD243"></a> |
904 <h4>CodeStyleFixer.__fixD243</h4> |
902 <h4>CodeStyleFixer.__fixD243</h4> |
905 <b>__fixD243</b>(<i>code, line, pos, apply=False</i>) |
903 <b>__fixD243</b>(<i>code, line, pos, apply=False</i>) |
906 |
|
907 <p> |
904 <p> |
908 Private method to fix a class or function/method docstring followed |
905 Private method to fix a class or function/method docstring followed |
909 by a blank line. |
906 by a blank line. |
910 </p> |
907 </p> |
911 <p> |
908 <p> |
912 Codes: D243, D245 |
909 Codes: D243, D245 |
913 </p> |
910 </p> |
|
911 |
914 <dl> |
912 <dl> |
915 |
913 |
916 <dt><i>code</i> (str)</dt> |
914 <dt><i>code</i> (str)</dt> |
917 <dd> |
915 <dd> |
918 code of the issue |
916 code of the issue |
945 </dd> |
943 </dd> |
946 </dl> |
944 </dl> |
947 <a NAME="CodeStyleFixer.__fixD247" ID="CodeStyleFixer.__fixD247"></a> |
945 <a NAME="CodeStyleFixer.__fixD247" ID="CodeStyleFixer.__fixD247"></a> |
948 <h4>CodeStyleFixer.__fixD247</h4> |
946 <h4>CodeStyleFixer.__fixD247</h4> |
949 <b>__fixD247</b>(<i>code, line, pos, apply=False</i>) |
947 <b>__fixD247</b>(<i>code, line, pos, apply=False</i>) |
950 |
|
951 <p> |
948 <p> |
952 Private method to fix a last paragraph of a docstring followed |
949 Private method to fix a last paragraph of a docstring followed |
953 by a blank line. |
950 by a blank line. |
954 </p> |
951 </p> |
955 <p> |
952 <p> |
956 Codes: D247 |
953 Codes: D247 |
957 </p> |
954 </p> |
|
955 |
958 <dl> |
956 <dl> |
959 |
957 |
960 <dt><i>code</i> (str)</dt> |
958 <dt><i>code</i> (str)</dt> |
961 <dd> |
959 <dd> |
962 code of the issue |
960 code of the issue |
989 </dd> |
987 </dd> |
990 </dl> |
988 </dl> |
991 <a NAME="CodeStyleFixer.__fixE101" ID="CodeStyleFixer.__fixE101"></a> |
989 <a NAME="CodeStyleFixer.__fixE101" ID="CodeStyleFixer.__fixE101"></a> |
992 <h4>CodeStyleFixer.__fixE101</h4> |
990 <h4>CodeStyleFixer.__fixE101</h4> |
993 <b>__fixE101</b>(<i>code, line, pos</i>) |
991 <b>__fixE101</b>(<i>code, line, pos</i>) |
994 |
|
995 <p> |
992 <p> |
996 Private method to fix obsolete tab usage and indentation errors. |
993 Private method to fix obsolete tab usage and indentation errors. |
997 </p> |
994 </p> |
998 <p> |
995 <p> |
999 Codes: E101, E111, W191 |
996 Codes: E101, E111, W191 |
1000 </p> |
997 </p> |
|
998 |
1001 <dl> |
999 <dl> |
1002 |
1000 |
1003 <dt><i>code</i> (str)</dt> |
1001 <dt><i>code</i> (str)</dt> |
1004 <dd> |
1002 <dd> |
1005 code of the issue |
1003 code of the issue |
1028 </dd> |
1026 </dd> |
1029 </dl> |
1027 </dl> |
1030 <a NAME="CodeStyleFixer.__fixE121" ID="CodeStyleFixer.__fixE121"></a> |
1028 <a NAME="CodeStyleFixer.__fixE121" ID="CodeStyleFixer.__fixE121"></a> |
1031 <h4>CodeStyleFixer.__fixE121</h4> |
1029 <h4>CodeStyleFixer.__fixE121</h4> |
1032 <b>__fixE121</b>(<i>code, line, pos, apply=False</i>) |
1030 <b>__fixE121</b>(<i>code, line, pos, apply=False</i>) |
1033 |
|
1034 <p> |
1031 <p> |
1035 Private method to fix the indentation of continuation lines and |
1032 Private method to fix the indentation of continuation lines and |
1036 closing brackets. |
1033 closing brackets. |
1037 </p> |
1034 </p> |
1038 <p> |
1035 <p> |
1039 Codes: E121, E124 |
1036 Codes: E121, E124 |
1040 </p> |
1037 </p> |
|
1038 |
1041 <dl> |
1039 <dl> |
1042 |
1040 |
1043 <dt><i>code</i> (str)</dt> |
1041 <dt><i>code</i> (str)</dt> |
1044 <dd> |
1042 <dd> |
1045 code of the issue |
1043 code of the issue |
1072 </dd> |
1070 </dd> |
1073 </dl> |
1071 </dl> |
1074 <a NAME="CodeStyleFixer.__fixE122" ID="CodeStyleFixer.__fixE122"></a> |
1072 <a NAME="CodeStyleFixer.__fixE122" ID="CodeStyleFixer.__fixE122"></a> |
1075 <h4>CodeStyleFixer.__fixE122</h4> |
1073 <h4>CodeStyleFixer.__fixE122</h4> |
1076 <b>__fixE122</b>(<i>code, line, pos, apply=False</i>) |
1074 <b>__fixE122</b>(<i>code, line, pos, apply=False</i>) |
1077 |
|
1078 <p> |
1075 <p> |
1079 Private method to fix a missing indentation of continuation lines. |
1076 Private method to fix a missing indentation of continuation lines. |
1080 </p> |
1077 </p> |
1081 <p> |
1078 <p> |
1082 Codes: E122 |
1079 Codes: E122 |
1083 </p> |
1080 </p> |
|
1081 |
1084 <dl> |
1082 <dl> |
1085 |
1083 |
1086 <dt><i>code</i> (str)</dt> |
1084 <dt><i>code</i> (str)</dt> |
1087 <dd> |
1085 <dd> |
1088 code of the issue |
1086 code of the issue |
1115 </dd> |
1113 </dd> |
1116 </dl> |
1114 </dl> |
1117 <a NAME="CodeStyleFixer.__fixE123" ID="CodeStyleFixer.__fixE123"></a> |
1115 <a NAME="CodeStyleFixer.__fixE123" ID="CodeStyleFixer.__fixE123"></a> |
1118 <h4>CodeStyleFixer.__fixE123</h4> |
1116 <h4>CodeStyleFixer.__fixE123</h4> |
1119 <b>__fixE123</b>(<i>code, line, pos, apply=False</i>) |
1117 <b>__fixE123</b>(<i>code, line, pos, apply=False</i>) |
1120 |
|
1121 <p> |
1118 <p> |
1122 Private method to fix the indentation of a closing bracket lines. |
1119 Private method to fix the indentation of a closing bracket lines. |
1123 </p> |
1120 </p> |
1124 <p> |
1121 <p> |
1125 Codes: E123 |
1122 Codes: E123 |
1126 </p> |
1123 </p> |
|
1124 |
1127 <dl> |
1125 <dl> |
1128 |
1126 |
1129 <dt><i>code</i> (str)</dt> |
1127 <dt><i>code</i> (str)</dt> |
1130 <dd> |
1128 <dd> |
1131 code of the issue |
1129 code of the issue |
1158 </dd> |
1156 </dd> |
1159 </dl> |
1157 </dl> |
1160 <a NAME="CodeStyleFixer.__fixE125" ID="CodeStyleFixer.__fixE125"></a> |
1158 <a NAME="CodeStyleFixer.__fixE125" ID="CodeStyleFixer.__fixE125"></a> |
1161 <h4>CodeStyleFixer.__fixE125</h4> |
1159 <h4>CodeStyleFixer.__fixE125</h4> |
1162 <b>__fixE125</b>(<i>code, line, pos, apply=False</i>) |
1160 <b>__fixE125</b>(<i>code, line, pos, apply=False</i>) |
1163 |
|
1164 <p> |
1161 <p> |
1165 Private method to fix the indentation of continuation lines not |
1162 Private method to fix the indentation of continuation lines not |
1166 distinguishable from next logical line. |
1163 distinguishable from next logical line. |
1167 </p> |
1164 </p> |
1168 <p> |
1165 <p> |
1169 Codes: E125 |
1166 Codes: E125 |
1170 </p> |
1167 </p> |
|
1168 |
1171 <dl> |
1169 <dl> |
1172 |
1170 |
1173 <dt><i>code</i> (str)</dt> |
1171 <dt><i>code</i> (str)</dt> |
1174 <dd> |
1172 <dd> |
1175 code of the issue |
1173 code of the issue |
1202 </dd> |
1200 </dd> |
1203 </dl> |
1201 </dl> |
1204 <a NAME="CodeStyleFixer.__fixE126" ID="CodeStyleFixer.__fixE126"></a> |
1202 <a NAME="CodeStyleFixer.__fixE126" ID="CodeStyleFixer.__fixE126"></a> |
1205 <h4>CodeStyleFixer.__fixE126</h4> |
1203 <h4>CodeStyleFixer.__fixE126</h4> |
1206 <b>__fixE126</b>(<i>code, line, pos, apply=False</i>) |
1204 <b>__fixE126</b>(<i>code, line, pos, apply=False</i>) |
1207 |
|
1208 <p> |
1205 <p> |
1209 Private method to fix over-indented/under-indented hanging |
1206 Private method to fix over-indented/under-indented hanging |
1210 indentation. |
1207 indentation. |
1211 </p> |
1208 </p> |
1212 <p> |
1209 <p> |
1213 Codes: E126, E133 |
1210 Codes: E126, E133 |
1214 </p> |
1211 </p> |
|
1212 |
1215 <dl> |
1213 <dl> |
1216 |
1214 |
1217 <dt><i>code</i> (str)</dt> |
1215 <dt><i>code</i> (str)</dt> |
1218 <dd> |
1216 <dd> |
1219 code of the issue |
1217 code of the issue |
1246 </dd> |
1244 </dd> |
1247 </dl> |
1245 </dl> |
1248 <a NAME="CodeStyleFixer.__fixE127" ID="CodeStyleFixer.__fixE127"></a> |
1246 <a NAME="CodeStyleFixer.__fixE127" ID="CodeStyleFixer.__fixE127"></a> |
1249 <h4>CodeStyleFixer.__fixE127</h4> |
1247 <h4>CodeStyleFixer.__fixE127</h4> |
1250 <b>__fixE127</b>(<i>code, line, pos, apply=False</i>) |
1248 <b>__fixE127</b>(<i>code, line, pos, apply=False</i>) |
1251 |
|
1252 <p> |
1249 <p> |
1253 Private method to fix over/under indented lines. |
1250 Private method to fix over/under indented lines. |
1254 </p> |
1251 </p> |
1255 <p> |
1252 <p> |
1256 Codes: E127, E128 |
1253 Codes: E127, E128 |
1257 </p> |
1254 </p> |
|
1255 |
1258 <dl> |
1256 <dl> |
1259 |
1257 |
1260 <dt><i>code</i> (str)</dt> |
1258 <dt><i>code</i> (str)</dt> |
1261 <dd> |
1259 <dd> |
1262 code of the issue |
1260 code of the issue |
1289 </dd> |
1287 </dd> |
1290 </dl> |
1288 </dl> |
1291 <a NAME="CodeStyleFixer.__fixE201" ID="CodeStyleFixer.__fixE201"></a> |
1289 <a NAME="CodeStyleFixer.__fixE201" ID="CodeStyleFixer.__fixE201"></a> |
1292 <h4>CodeStyleFixer.__fixE201</h4> |
1290 <h4>CodeStyleFixer.__fixE201</h4> |
1293 <b>__fixE201</b>(<i>code, line, pos</i>) |
1291 <b>__fixE201</b>(<i>code, line, pos</i>) |
1294 |
|
1295 <p> |
1292 <p> |
1296 Private method to fix extraneous whitespace. |
1293 Private method to fix extraneous whitespace. |
1297 </p> |
1294 </p> |
1298 <p> |
1295 <p> |
1299 Codes: E201, E202, E203, E211 |
1296 Codes: E201, E202, E203, E211 |
1300 </p> |
1297 </p> |
|
1298 |
1301 <dl> |
1299 <dl> |
1302 |
1300 |
1303 <dt><i>code</i> (str)</dt> |
1301 <dt><i>code</i> (str)</dt> |
1304 <dd> |
1302 <dd> |
1305 code of the issue |
1303 code of the issue |
1328 </dd> |
1326 </dd> |
1329 </dl> |
1327 </dl> |
1330 <a NAME="CodeStyleFixer.__fixE221" ID="CodeStyleFixer.__fixE221"></a> |
1328 <a NAME="CodeStyleFixer.__fixE221" ID="CodeStyleFixer.__fixE221"></a> |
1331 <h4>CodeStyleFixer.__fixE221</h4> |
1329 <h4>CodeStyleFixer.__fixE221</h4> |
1332 <b>__fixE221</b>(<i>code, line, pos</i>) |
1330 <b>__fixE221</b>(<i>code, line, pos</i>) |
1333 |
|
1334 <p> |
1331 <p> |
1335 Private method to fix extraneous whitespace around operator or |
1332 Private method to fix extraneous whitespace around operator or |
1336 keyword. |
1333 keyword. |
1337 </p> |
1334 </p> |
1338 <p> |
1335 <p> |
1339 Codes: E221, E222, E223, E224, E241, E242, E271, E272, E273, E274 |
1336 Codes: E221, E222, E223, E224, E241, E242, E271, E272, E273, E274 |
1340 </p> |
1337 </p> |
|
1338 |
1341 <dl> |
1339 <dl> |
1342 |
1340 |
1343 <dt><i>code</i> (str)</dt> |
1341 <dt><i>code</i> (str)</dt> |
1344 <dd> |
1342 <dd> |
1345 code of the issue |
1343 code of the issue |
1368 </dd> |
1366 </dd> |
1369 </dl> |
1367 </dl> |
1370 <a NAME="CodeStyleFixer.__fixE225" ID="CodeStyleFixer.__fixE225"></a> |
1368 <a NAME="CodeStyleFixer.__fixE225" ID="CodeStyleFixer.__fixE225"></a> |
1371 <h4>CodeStyleFixer.__fixE225</h4> |
1369 <h4>CodeStyleFixer.__fixE225</h4> |
1372 <b>__fixE225</b>(<i>code, line, pos</i>) |
1370 <b>__fixE225</b>(<i>code, line, pos</i>) |
1373 |
|
1374 <p> |
1371 <p> |
1375 Private method to fix extraneous whitespaces around operator. |
1372 Private method to fix extraneous whitespaces around operator. |
1376 </p> |
1373 </p> |
1377 <p> |
1374 <p> |
1378 Codes: E225, E226, E227, E228 |
1375 Codes: E225, E226, E227, E228 |
1379 </p> |
1376 </p> |
|
1377 |
1380 <dl> |
1378 <dl> |
1381 |
1379 |
1382 <dt><i>code</i> (str)</dt> |
1380 <dt><i>code</i> (str)</dt> |
1383 <dd> |
1381 <dd> |
1384 code of the issue |
1382 code of the issue |
1407 </dd> |
1405 </dd> |
1408 </dl> |
1406 </dl> |
1409 <a NAME="CodeStyleFixer.__fixE231" ID="CodeStyleFixer.__fixE231"></a> |
1407 <a NAME="CodeStyleFixer.__fixE231" ID="CodeStyleFixer.__fixE231"></a> |
1410 <h4>CodeStyleFixer.__fixE231</h4> |
1408 <h4>CodeStyleFixer.__fixE231</h4> |
1411 <b>__fixE231</b>(<i>code, line, pos</i>) |
1409 <b>__fixE231</b>(<i>code, line, pos</i>) |
1412 |
|
1413 <p> |
1410 <p> |
1414 Private method to fix missing whitespace after ',;:'. |
1411 Private method to fix missing whitespace after ',;:'. |
1415 </p> |
1412 </p> |
1416 <p> |
1413 <p> |
1417 Codes: E231 |
1414 Codes: E231 |
1418 </p> |
1415 </p> |
|
1416 |
1419 <dl> |
1417 <dl> |
1420 |
1418 |
1421 <dt><i>code</i> (str)</dt> |
1419 <dt><i>code</i> (str)</dt> |
1422 <dd> |
1420 <dd> |
1423 code of the issue |
1421 code of the issue |
1446 </dd> |
1444 </dd> |
1447 </dl> |
1445 </dl> |
1448 <a NAME="CodeStyleFixer.__fixE251" ID="CodeStyleFixer.__fixE251"></a> |
1446 <a NAME="CodeStyleFixer.__fixE251" ID="CodeStyleFixer.__fixE251"></a> |
1449 <h4>CodeStyleFixer.__fixE251</h4> |
1447 <h4>CodeStyleFixer.__fixE251</h4> |
1450 <b>__fixE251</b>(<i>code, line, pos</i>) |
1448 <b>__fixE251</b>(<i>code, line, pos</i>) |
1451 |
|
1452 <p> |
1449 <p> |
1453 Private method to fix extraneous whitespace around keyword and |
1450 Private method to fix extraneous whitespace around keyword and |
1454 default parameter equals. |
1451 default parameter equals. |
1455 </p> |
1452 </p> |
1456 <p> |
1453 <p> |
1457 Codes: E251 |
1454 Codes: E251 |
1458 </p> |
1455 </p> |
|
1456 |
1459 <dl> |
1457 <dl> |
1460 |
1458 |
1461 <dt><i>code</i> (str)</dt> |
1459 <dt><i>code</i> (str)</dt> |
1462 <dd> |
1460 <dd> |
1463 code of the issue |
1461 code of the issue |
1486 </dd> |
1484 </dd> |
1487 </dl> |
1485 </dl> |
1488 <a NAME="CodeStyleFixer.__fixE261" ID="CodeStyleFixer.__fixE261"></a> |
1486 <a NAME="CodeStyleFixer.__fixE261" ID="CodeStyleFixer.__fixE261"></a> |
1489 <h4>CodeStyleFixer.__fixE261</h4> |
1487 <h4>CodeStyleFixer.__fixE261</h4> |
1490 <b>__fixE261</b>(<i>code, line, pos</i>) |
1488 <b>__fixE261</b>(<i>code, line, pos</i>) |
1491 |
|
1492 <p> |
1489 <p> |
1493 Private method to fix whitespace before or after inline comment. |
1490 Private method to fix whitespace before or after inline comment. |
1494 </p> |
1491 </p> |
1495 <p> |
1492 <p> |
1496 Codes: E261, E262 |
1493 Codes: E261, E262 |
1497 </p> |
1494 </p> |
|
1495 |
1498 <dl> |
1496 <dl> |
1499 |
1497 |
1500 <dt><i>code</i> (str)</dt> |
1498 <dt><i>code</i> (str)</dt> |
1501 <dd> |
1499 <dd> |
1502 code of the issue |
1500 code of the issue |
1525 </dd> |
1523 </dd> |
1526 </dl> |
1524 </dl> |
1527 <a NAME="CodeStyleFixer.__fixE304" ID="CodeStyleFixer.__fixE304"></a> |
1525 <a NAME="CodeStyleFixer.__fixE304" ID="CodeStyleFixer.__fixE304"></a> |
1528 <h4>CodeStyleFixer.__fixE304</h4> |
1526 <h4>CodeStyleFixer.__fixE304</h4> |
1529 <b>__fixE304</b>(<i>code, line, pos, apply=False</i>) |
1527 <b>__fixE304</b>(<i>code, line, pos, apply=False</i>) |
1530 |
|
1531 <p> |
1528 <p> |
1532 Private method to fix superfluous blank lines after a function |
1529 Private method to fix superfluous blank lines after a function |
1533 decorator. |
1530 decorator. |
1534 </p> |
1531 </p> |
1535 <p> |
1532 <p> |
1536 Codes: E304 |
1533 Codes: E304 |
1537 </p> |
1534 </p> |
|
1535 |
1538 <dl> |
1536 <dl> |
1539 |
1537 |
1540 <dt><i>code</i> (str)</dt> |
1538 <dt><i>code</i> (str)</dt> |
1541 <dd> |
1539 <dd> |
1542 code of the issue |
1540 code of the issue |
1569 </dd> |
1567 </dd> |
1570 </dl> |
1568 </dl> |
1571 <a NAME="CodeStyleFixer.__fixE401" ID="CodeStyleFixer.__fixE401"></a> |
1569 <a NAME="CodeStyleFixer.__fixE401" ID="CodeStyleFixer.__fixE401"></a> |
1572 <h4>CodeStyleFixer.__fixE401</h4> |
1570 <h4>CodeStyleFixer.__fixE401</h4> |
1573 <b>__fixE401</b>(<i>code, line, pos, apply=False</i>) |
1571 <b>__fixE401</b>(<i>code, line, pos, apply=False</i>) |
1574 |
|
1575 <p> |
1572 <p> |
1576 Private method to fix multiple imports on one line. |
1573 Private method to fix multiple imports on one line. |
1577 </p> |
1574 </p> |
1578 <p> |
1575 <p> |
1579 Codes: E401 |
1576 Codes: E401 |
1580 </p> |
1577 </p> |
|
1578 |
1581 <dl> |
1579 <dl> |
1582 |
1580 |
1583 <dt><i>code</i> (str)</dt> |
1581 <dt><i>code</i> (str)</dt> |
1584 <dd> |
1582 <dd> |
1585 code of the issue |
1583 code of the issue |
1612 </dd> |
1610 </dd> |
1613 </dl> |
1611 </dl> |
1614 <a NAME="CodeStyleFixer.__fixE501" ID="CodeStyleFixer.__fixE501"></a> |
1612 <a NAME="CodeStyleFixer.__fixE501" ID="CodeStyleFixer.__fixE501"></a> |
1615 <h4>CodeStyleFixer.__fixE501</h4> |
1613 <h4>CodeStyleFixer.__fixE501</h4> |
1616 <b>__fixE501</b>(<i>code, line, pos, apply=False</i>) |
1614 <b>__fixE501</b>(<i>code, line, pos, apply=False</i>) |
1617 |
|
1618 <p> |
1615 <p> |
1619 Private method to fix the long lines by breaking them. |
1616 Private method to fix the long lines by breaking them. |
1620 </p> |
1617 </p> |
1621 <p> |
1618 <p> |
1622 Codes: E501 |
1619 Codes: E501 |
1623 </p> |
1620 </p> |
|
1621 |
1624 <dl> |
1622 <dl> |
1625 |
1623 |
1626 <dt><i>code</i> (str)</dt> |
1624 <dt><i>code</i> (str)</dt> |
1627 <dd> |
1625 <dd> |
1628 code of the issue |
1626 code of the issue |
1655 </dd> |
1653 </dd> |
1656 </dl> |
1654 </dl> |
1657 <a NAME="CodeStyleFixer.__fixE502" ID="CodeStyleFixer.__fixE502"></a> |
1655 <a NAME="CodeStyleFixer.__fixE502" ID="CodeStyleFixer.__fixE502"></a> |
1658 <h4>CodeStyleFixer.__fixE502</h4> |
1656 <h4>CodeStyleFixer.__fixE502</h4> |
1659 <b>__fixE502</b>(<i>code, line, pos</i>) |
1657 <b>__fixE502</b>(<i>code, line, pos</i>) |
1660 |
|
1661 <p> |
1658 <p> |
1662 Private method to fix redundant backslash within brackets. |
1659 Private method to fix redundant backslash within brackets. |
1663 </p> |
1660 </p> |
1664 <p> |
1661 <p> |
1665 Codes: E502 |
1662 Codes: E502 |
1666 </p> |
1663 </p> |
|
1664 |
1667 <dl> |
1665 <dl> |
1668 |
1666 |
1669 <dt><i>code</i> (str)</dt> |
1667 <dt><i>code</i> (str)</dt> |
1670 <dd> |
1668 <dd> |
1671 code of the issue |
1669 code of the issue |
1694 </dd> |
1692 </dd> |
1695 </dl> |
1693 </dl> |
1696 <a NAME="CodeStyleFixer.__fixE701" ID="CodeStyleFixer.__fixE701"></a> |
1694 <a NAME="CodeStyleFixer.__fixE701" ID="CodeStyleFixer.__fixE701"></a> |
1697 <h4>CodeStyleFixer.__fixE701</h4> |
1695 <h4>CodeStyleFixer.__fixE701</h4> |
1698 <b>__fixE701</b>(<i>code, line, pos, apply=False</i>) |
1696 <b>__fixE701</b>(<i>code, line, pos, apply=False</i>) |
1699 |
|
1700 <p> |
1697 <p> |
1701 Private method to fix colon-separated compound statements. |
1698 Private method to fix colon-separated compound statements. |
1702 </p> |
1699 </p> |
1703 <p> |
1700 <p> |
1704 Codes: E701 |
1701 Codes: E701 |
1705 </p> |
1702 </p> |
|
1703 |
1706 <dl> |
1704 <dl> |
1707 |
1705 |
1708 <dt><i>code</i> (str)</dt> |
1706 <dt><i>code</i> (str)</dt> |
1709 <dd> |
1707 <dd> |
1710 code of the issue |
1708 code of the issue |
1737 </dd> |
1735 </dd> |
1738 </dl> |
1736 </dl> |
1739 <a NAME="CodeStyleFixer.__fixE702" ID="CodeStyleFixer.__fixE702"></a> |
1737 <a NAME="CodeStyleFixer.__fixE702" ID="CodeStyleFixer.__fixE702"></a> |
1740 <h4>CodeStyleFixer.__fixE702</h4> |
1738 <h4>CodeStyleFixer.__fixE702</h4> |
1741 <b>__fixE702</b>(<i>code, line, pos, apply=False</i>) |
1739 <b>__fixE702</b>(<i>code, line, pos, apply=False</i>) |
1742 |
|
1743 <p> |
1740 <p> |
1744 Private method to fix semicolon-separated compound statements. |
1741 Private method to fix semicolon-separated compound statements. |
1745 </p> |
1742 </p> |
1746 <p> |
1743 <p> |
1747 Codes: E702, E703 |
1744 Codes: E702, E703 |
1748 </p> |
1745 </p> |
|
1746 |
1749 <dl> |
1747 <dl> |
1750 |
1748 |
1751 <dt><i>code</i> (str)</dt> |
1749 <dt><i>code</i> (str)</dt> |
1752 <dd> |
1750 <dd> |
1753 code of the issue |
1751 code of the issue |
1780 </dd> |
1778 </dd> |
1781 </dl> |
1779 </dl> |
1782 <a NAME="CodeStyleFixer.__fixE711" ID="CodeStyleFixer.__fixE711"></a> |
1780 <a NAME="CodeStyleFixer.__fixE711" ID="CodeStyleFixer.__fixE711"></a> |
1783 <h4>CodeStyleFixer.__fixE711</h4> |
1781 <h4>CodeStyleFixer.__fixE711</h4> |
1784 <b>__fixE711</b>(<i>code, line, pos</i>) |
1782 <b>__fixE711</b>(<i>code, line, pos</i>) |
1785 |
|
1786 <p> |
1783 <p> |
1787 Private method to fix comparison with None. |
1784 Private method to fix comparison with None. |
1788 </p> |
1785 </p> |
1789 <p> |
1786 <p> |
1790 Codes: E711, E712 |
1787 Codes: E711, E712 |
1791 </p> |
1788 </p> |
|
1789 |
1792 <dl> |
1790 <dl> |
1793 |
1791 |
1794 <dt><i>code</i> (str)</dt> |
1792 <dt><i>code</i> (str)</dt> |
1795 <dd> |
1793 <dd> |
1796 code of the issue |
1794 code of the issue |
1819 </dd> |
1817 </dd> |
1820 </dl> |
1818 </dl> |
1821 <a NAME="CodeStyleFixer.__fixN804" ID="CodeStyleFixer.__fixN804"></a> |
1819 <a NAME="CodeStyleFixer.__fixN804" ID="CodeStyleFixer.__fixN804"></a> |
1822 <h4>CodeStyleFixer.__fixN804</h4> |
1820 <h4>CodeStyleFixer.__fixN804</h4> |
1823 <b>__fixN804</b>(<i>code, line, pos, apply=False</i>) |
1821 <b>__fixN804</b>(<i>code, line, pos, apply=False</i>) |
1824 |
|
1825 <p> |
1822 <p> |
1826 Private method to fix a wrong first argument of normal and |
1823 Private method to fix a wrong first argument of normal and |
1827 class methods. |
1824 class methods. |
1828 </p> |
1825 </p> |
1829 <p> |
1826 <p> |
1830 Codes: N804, N805 |
1827 Codes: N804, N805 |
1831 </p> |
1828 </p> |
|
1829 |
1832 <dl> |
1830 <dl> |
1833 |
1831 |
1834 <dt><i>code</i> (str)</dt> |
1832 <dt><i>code</i> (str)</dt> |
1835 <dd> |
1833 <dd> |
1836 code of the issue |
1834 code of the issue |
1863 </dd> |
1861 </dd> |
1864 </dl> |
1862 </dl> |
1865 <a NAME="CodeStyleFixer.__fixN806" ID="CodeStyleFixer.__fixN806"></a> |
1863 <a NAME="CodeStyleFixer.__fixN806" ID="CodeStyleFixer.__fixN806"></a> |
1866 <h4>CodeStyleFixer.__fixN806</h4> |
1864 <h4>CodeStyleFixer.__fixN806</h4> |
1867 <b>__fixN806</b>(<i>code, line, pos, apply=False</i>) |
1865 <b>__fixN806</b>(<i>code, line, pos, apply=False</i>) |
1868 |
|
1869 <p> |
1866 <p> |
1870 Private method to fix a wrong first argument of static methods. |
1867 Private method to fix a wrong first argument of static methods. |
1871 </p> |
1868 </p> |
1872 <p> |
1869 <p> |
1873 Codes: N806 |
1870 Codes: N806 |
1874 </p> |
1871 </p> |
|
1872 |
1875 <dl> |
1873 <dl> |
1876 |
1874 |
1877 <dt><i>code</i> (str)</dt> |
1875 <dt><i>code</i> (str)</dt> |
1878 <dd> |
1876 <dd> |
1879 code of the issue |
1877 code of the issue |
1906 </dd> |
1904 </dd> |
1907 </dl> |
1905 </dl> |
1908 <a NAME="CodeStyleFixer.__fixReindent" ID="CodeStyleFixer.__fixReindent"></a> |
1906 <a NAME="CodeStyleFixer.__fixReindent" ID="CodeStyleFixer.__fixReindent"></a> |
1909 <h4>CodeStyleFixer.__fixReindent</h4> |
1907 <h4>CodeStyleFixer.__fixReindent</h4> |
1910 <b>__fixReindent</b>(<i>line, pos, logical</i>) |
1908 <b>__fixReindent</b>(<i>line, pos, logical</i>) |
1911 |
|
1912 <p> |
1909 <p> |
1913 Private method to fix a badly indented line. |
1910 Private method to fix a badly indented line. |
1914 </p> |
1911 </p> |
1915 <p> |
1912 <p> |
1916 This is done by adding or removing from its initial indent only. |
1913 This is done by adding or removing from its initial indent only. |
1917 </p> |
1914 </p> |
|
1915 |
1918 <dl> |
1916 <dl> |
1919 |
1917 |
1920 <dt><i>line</i> (int)</dt> |
1918 <dt><i>line</i> (int)</dt> |
1921 <dd> |
1919 <dd> |
1922 line number of the issue |
1920 line number of the issue |
1950 </dd> |
1948 </dd> |
1951 </dl> |
1949 </dl> |
1952 <a NAME="CodeStyleFixer.__fixW291" ID="CodeStyleFixer.__fixW291"></a> |
1950 <a NAME="CodeStyleFixer.__fixW291" ID="CodeStyleFixer.__fixW291"></a> |
1953 <h4>CodeStyleFixer.__fixW291</h4> |
1951 <h4>CodeStyleFixer.__fixW291</h4> |
1954 <b>__fixW291</b>(<i>code, line, pos</i>) |
1952 <b>__fixW291</b>(<i>code, line, pos</i>) |
1955 |
|
1956 <p> |
1953 <p> |
1957 Private method to fix trailing whitespace. |
1954 Private method to fix trailing whitespace. |
1958 </p> |
1955 </p> |
1959 <p> |
1956 <p> |
1960 Codes: W291, W293 |
1957 Codes: W291, W293 |
1961 </p> |
1958 </p> |
|
1959 |
1962 <dl> |
1960 <dl> |
1963 |
1961 |
1964 <dt><i>code</i> (str)</dt> |
1962 <dt><i>code</i> (str)</dt> |
1965 <dd> |
1963 <dd> |
1966 code of the issue |
1964 code of the issue |
1989 </dd> |
1987 </dd> |
1990 </dl> |
1988 </dl> |
1991 <a NAME="CodeStyleFixer.__fixW292" ID="CodeStyleFixer.__fixW292"></a> |
1989 <a NAME="CodeStyleFixer.__fixW292" ID="CodeStyleFixer.__fixW292"></a> |
1992 <h4>CodeStyleFixer.__fixW292</h4> |
1990 <h4>CodeStyleFixer.__fixW292</h4> |
1993 <b>__fixW292</b>(<i>code, line, pos</i>) |
1991 <b>__fixW292</b>(<i>code, line, pos</i>) |
1994 |
|
1995 <p> |
1992 <p> |
1996 Private method to fix a missing newline at the end of file. |
1993 Private method to fix a missing newline at the end of file. |
1997 </p> |
1994 </p> |
1998 <p> |
1995 <p> |
1999 Codes: W292 |
1996 Codes: W292 |
2000 </p> |
1997 </p> |
|
1998 |
2001 <dl> |
1999 <dl> |
2002 |
2000 |
2003 <dt><i>code</i> (str)</dt> |
2001 <dt><i>code</i> (str)</dt> |
2004 <dd> |
2002 <dd> |
2005 code of the issue |
2003 code of the issue |
2028 </dd> |
2026 </dd> |
2029 </dl> |
2027 </dl> |
2030 <a NAME="CodeStyleFixer.__fixW391" ID="CodeStyleFixer.__fixW391"></a> |
2028 <a NAME="CodeStyleFixer.__fixW391" ID="CodeStyleFixer.__fixW391"></a> |
2031 <h4>CodeStyleFixer.__fixW391</h4> |
2029 <h4>CodeStyleFixer.__fixW391</h4> |
2032 <b>__fixW391</b>(<i>code, line, pos</i>) |
2030 <b>__fixW391</b>(<i>code, line, pos</i>) |
2033 |
|
2034 <p> |
2031 <p> |
2035 Private method to fix trailing blank lines. |
2032 Private method to fix trailing blank lines. |
2036 </p> |
2033 </p> |
2037 <p> |
2034 <p> |
2038 Codes: W391 |
2035 Codes: W391 |
2039 </p> |
2036 </p> |
|
2037 |
2040 <dl> |
2038 <dl> |
2041 |
2039 |
2042 <dt><i>code</i> (str)</dt> |
2040 <dt><i>code</i> (str)</dt> |
2043 <dd> |
2041 <dd> |
2044 code of the issue |
2042 code of the issue |
2067 </dd> |
2065 </dd> |
2068 </dl> |
2066 </dl> |
2069 <a NAME="CodeStyleFixer.__fixW603" ID="CodeStyleFixer.__fixW603"></a> |
2067 <a NAME="CodeStyleFixer.__fixW603" ID="CodeStyleFixer.__fixW603"></a> |
2070 <h4>CodeStyleFixer.__fixW603</h4> |
2068 <h4>CodeStyleFixer.__fixW603</h4> |
2071 <b>__fixW603</b>(<i>code, line, pos</i>) |
2069 <b>__fixW603</b>(<i>code, line, pos</i>) |
2072 |
|
2073 <p> |
2070 <p> |
2074 Private method to fix the not equal notation. |
2071 Private method to fix the not equal notation. |
2075 </p> |
2072 </p> |
2076 <p> |
2073 <p> |
2077 Codes: W603 |
2074 Codes: W603 |
2078 </p> |
2075 </p> |
|
2076 |
2079 <dl> |
2077 <dl> |
2080 |
2078 |
2081 <dt><i>code</i> (str)</dt> |
2079 <dt><i>code</i> (str)</dt> |
2082 <dd> |
2080 <dd> |
2083 code of the issue |
2081 code of the issue |
2106 </dd> |
2104 </dd> |
2107 </dl> |
2105 </dl> |
2108 <a NAME="CodeStyleFixer.__fixWhitespace" ID="CodeStyleFixer.__fixWhitespace"></a> |
2106 <a NAME="CodeStyleFixer.__fixWhitespace" ID="CodeStyleFixer.__fixWhitespace"></a> |
2109 <h4>CodeStyleFixer.__fixWhitespace</h4> |
2107 <h4>CodeStyleFixer.__fixWhitespace</h4> |
2110 <b>__fixWhitespace</b>(<i>line, offset, replacement</i>) |
2108 <b>__fixWhitespace</b>(<i>line, offset, replacement</i>) |
2111 |
|
2112 <p> |
2109 <p> |
2113 Private method to correct whitespace at the given offset. |
2110 Private method to correct whitespace at the given offset. |
2114 </p> |
2111 </p> |
|
2112 |
2115 <dl> |
2113 <dl> |
2116 |
2114 |
2117 <dt><i>line</i> (str)</dt> |
2115 <dt><i>line</i> (str)</dt> |
2118 <dd> |
2116 <dd> |
2119 line to be corrected |
2117 line to be corrected |
2159 </dd> |
2157 </dd> |
2160 </dl> |
2158 </dl> |
2161 <a NAME="CodeStyleFixer.__getIndent" ID="CodeStyleFixer.__getIndent"></a> |
2159 <a NAME="CodeStyleFixer.__getIndent" ID="CodeStyleFixer.__getIndent"></a> |
2162 <h4>CodeStyleFixer.__getIndent</h4> |
2160 <h4>CodeStyleFixer.__getIndent</h4> |
2163 <b>__getIndent</b>(<i>line</i>) |
2161 <b>__getIndent</b>(<i>line</i>) |
2164 |
|
2165 <p> |
2162 <p> |
2166 Private method to get the indentation string. |
2163 Private method to get the indentation string. |
2167 </p> |
2164 </p> |
|
2165 |
2168 <dl> |
2166 <dl> |
2169 |
2167 |
2170 <dt><i>line</i> (str)</dt> |
2168 <dt><i>line</i> (str)</dt> |
2171 <dd> |
2169 <dd> |
2172 line to determine the indentation string from |
2170 line to determine the indentation string from |
2185 </dd> |
2183 </dd> |
2186 </dl> |
2184 </dl> |
2187 <a NAME="CodeStyleFixer.__getIndentWord" ID="CodeStyleFixer.__getIndentWord"></a> |
2185 <a NAME="CodeStyleFixer.__getIndentWord" ID="CodeStyleFixer.__getIndentWord"></a> |
2188 <h4>CodeStyleFixer.__getIndentWord</h4> |
2186 <h4>CodeStyleFixer.__getIndentWord</h4> |
2189 <b>__getIndentWord</b>(<i></i>) |
2187 <b>__getIndentWord</b>(<i></i>) |
2190 |
|
2191 <p> |
2188 <p> |
2192 Private method to determine the indentation type. |
2189 Private method to determine the indentation type. |
2193 </p> |
2190 </p> |
|
2191 |
2194 <dl> |
2192 <dl> |
2195 <dt>Return:</dt> |
2193 <dt>Return:</dt> |
2196 <dd> |
2194 <dd> |
2197 string to be used for an indentation |
2195 string to be used for an indentation |
2198 </dd> |
2196 </dd> |
2204 </dd> |
2202 </dd> |
2205 </dl> |
2203 </dl> |
2206 <a NAME="CodeStyleFixer.__getLogical" ID="CodeStyleFixer.__getLogical"></a> |
2204 <a NAME="CodeStyleFixer.__getLogical" ID="CodeStyleFixer.__getLogical"></a> |
2207 <h4>CodeStyleFixer.__getLogical</h4> |
2205 <h4>CodeStyleFixer.__getLogical</h4> |
2208 <b>__getLogical</b>(<i>line, pos</i>) |
2206 <b>__getLogical</b>(<i>line, pos</i>) |
2209 |
|
2210 <p> |
2207 <p> |
2211 Private method to get the logical line corresponding to the given |
2208 Private method to get the logical line corresponding to the given |
2212 position. |
2209 position. |
2213 </p> |
2210 </p> |
|
2211 |
2214 <dl> |
2212 <dl> |
2215 |
2213 |
2216 <dt><i>line</i> (int)</dt> |
2214 <dt><i>line</i> (int)</dt> |
2217 <dd> |
2215 <dd> |
2218 line number of the issue |
2216 line number of the issue |
2238 </dd> |
2236 </dd> |
2239 </dl> |
2237 </dl> |
2240 <a NAME="CodeStyleFixer.__multilineStringLines" ID="CodeStyleFixer.__multilineStringLines"></a> |
2238 <a NAME="CodeStyleFixer.__multilineStringLines" ID="CodeStyleFixer.__multilineStringLines"></a> |
2241 <h4>CodeStyleFixer.__multilineStringLines</h4> |
2239 <h4>CodeStyleFixer.__multilineStringLines</h4> |
2242 <b>__multilineStringLines</b>(<i></i>) |
2240 <b>__multilineStringLines</b>(<i></i>) |
2243 |
|
2244 <p> |
2241 <p> |
2245 Private method to determine the line numbers that are within multi line |
2242 Private method to determine the line numbers that are within multi line |
2246 strings and these which are part of a documentation string. |
2243 strings and these which are part of a documentation string. |
2247 </p> |
2244 </p> |
|
2245 |
2248 <dl> |
2246 <dl> |
2249 <dt>Return:</dt> |
2247 <dt>Return:</dt> |
2250 <dd> |
2248 <dd> |
2251 tuple of a set of line numbers belonging to a multi line |
2249 tuple of a set of line numbers belonging to a multi line |
2252 string and a set of line numbers belonging to a multi line |
2250 string and a set of line numbers belonging to a multi line |
2260 </dd> |
2258 </dd> |
2261 </dl> |
2259 </dl> |
2262 <a NAME="CodeStyleFixer.finalize" ID="CodeStyleFixer.finalize"></a> |
2260 <a NAME="CodeStyleFixer.finalize" ID="CodeStyleFixer.finalize"></a> |
2263 <h4>CodeStyleFixer.finalize</h4> |
2261 <h4>CodeStyleFixer.finalize</h4> |
2264 <b>finalize</b>(<i></i>) |
2262 <b>finalize</b>(<i></i>) |
2265 |
|
2266 <p> |
2263 <p> |
2267 Public method to apply all deferred fixes. |
2264 Public method to apply all deferred fixes. |
2268 </p> |
2265 </p> |
|
2266 |
2269 <dl> |
2267 <dl> |
2270 <dt>Return:</dt> |
2268 <dt>Return:</dt> |
2271 <dd> |
2269 <dd> |
2272 dictionary containing the fix results |
2270 dictionary containing the fix results |
2273 </dd> |
2271 </dd> |
2279 </dd> |
2277 </dd> |
2280 </dl> |
2278 </dl> |
2281 <a NAME="CodeStyleFixer.fixIssue" ID="CodeStyleFixer.fixIssue"></a> |
2279 <a NAME="CodeStyleFixer.fixIssue" ID="CodeStyleFixer.fixIssue"></a> |
2282 <h4>CodeStyleFixer.fixIssue</h4> |
2280 <h4>CodeStyleFixer.fixIssue</h4> |
2283 <b>fixIssue</b>(<i>line, pos, code</i>) |
2281 <b>fixIssue</b>(<i>line, pos, code</i>) |
2284 |
|
2285 <p> |
2282 <p> |
2286 Public method to fix the fixable issues. |
2283 Public method to fix the fixable issues. |
2287 </p> |
2284 </p> |
|
2285 |
2288 <dl> |
2286 <dl> |
2289 |
2287 |
2290 <dt><i>line</i> (int)</dt> |
2288 <dt><i>line</i> (int)</dt> |
2291 <dd> |
2289 <dd> |
2292 line number of the issue |
2290 line number of the issue |
2315 </dd> |
2313 </dd> |
2316 </dl> |
2314 </dl> |
2317 <a NAME="CodeStyleFixer.mutualStartswith" ID="CodeStyleFixer.mutualStartswith"></a> |
2315 <a NAME="CodeStyleFixer.mutualStartswith" ID="CodeStyleFixer.mutualStartswith"></a> |
2318 <h4>CodeStyleFixer.mutualStartswith</h4> |
2316 <h4>CodeStyleFixer.mutualStartswith</h4> |
2319 <b>mutualStartswith</b>(<i>b</i>) |
2317 <b>mutualStartswith</b>(<i>b</i>) |
2320 |
|
2321 <p> |
2318 <p> |
2322 Local helper method to compare the beginnings of two strings |
2319 Local helper method to compare the beginnings of two strings |
2323 against each other. |
2320 against each other. |
2324 </p> |
2321 </p> |
|
2322 |
2325 <dl> |
2323 <dl> |
2326 <dt>Return:</dt> |
2324 <dt>Return:</dt> |
2327 <dd> |
2325 <dd> |
2328 flag indicating that one string starts with the other |
2326 flag indicating that one string starts with the other |
2329 </dd> |
2327 </dd> |
2335 </dd> |
2333 </dd> |
2336 </dl> |
2334 </dl> |
2337 <a NAME="CodeStyleFixer.saveFile" ID="CodeStyleFixer.saveFile"></a> |
2335 <a NAME="CodeStyleFixer.saveFile" ID="CodeStyleFixer.saveFile"></a> |
2338 <h4>CodeStyleFixer.saveFile</h4> |
2336 <h4>CodeStyleFixer.saveFile</h4> |
2339 <b>saveFile</b>(<i>encoding</i>) |
2337 <b>saveFile</b>(<i>encoding</i>) |
2340 |
|
2341 <p> |
2338 <p> |
2342 Public method to save the modified file. |
2339 Public method to save the modified file. |
2343 </p> |
2340 </p> |
|
2341 |
2344 <dl> |
2342 <dl> |
2345 |
2343 |
2346 <dt><i>encoding</i> (str)</dt> |
2344 <dt><i>encoding</i> (str)</dt> |
2347 <dd> |
2345 <dd> |
2348 encoding of the source file |
2346 encoding of the source file |
2363 <div align="right"><a href="#top">Up</a></div> |
2361 <div align="right"><a href="#top">Up</a></div> |
2364 <hr /> |
2362 <hr /> |
2365 <hr /> |
2363 <hr /> |
2366 <a NAME="IndentationWrapper" ID="IndentationWrapper"></a> |
2364 <a NAME="IndentationWrapper" ID="IndentationWrapper"></a> |
2367 <h2>IndentationWrapper</h2> |
2365 <h2>IndentationWrapper</h2> |
2368 |
|
2369 <p> |
2366 <p> |
2370 Class used by fixers dealing with indentation. |
2367 Class used by fixers dealing with indentation. |
2371 </p> |
2368 </p> |
2372 <p> |
2369 <p> |
2373 Each instance operates on a single logical line. |
2370 Each instance operates on a single logical line. |
2374 </p> |
2371 </p> |
|
2372 |
2375 <h3>Derived from</h3> |
2373 <h3>Derived from</h3> |
2376 None |
2374 None |
2377 <h3>Class Attributes</h3> |
2375 <h3>Class Attributes</h3> |
2378 |
|
2379 <table> |
2376 <table> |
2380 <tr><td>SKIP_TOKENS</td></tr> |
2377 <tr><td>SKIP_TOKENS</td></tr> |
2381 </table> |
2378 </table> |
|
2379 |
2382 <h3>Class Methods</h3> |
2380 <h3>Class Methods</h3> |
2383 |
|
2384 <table> |
2381 <table> |
2385 <tr><td>None</td></tr> |
2382 <tr><td>None</td></tr> |
2386 </table> |
2383 </table> |
|
2384 |
2387 <h3>Methods</h3> |
2385 <h3>Methods</h3> |
2388 |
|
2389 <table> |
2386 <table> |
2390 |
|
2391 <tr> |
2387 <tr> |
2392 <td><a href="#IndentationWrapper.__init__">IndentationWrapper</a></td> |
2388 <td><a href="#IndentationWrapper.__init__">IndentationWrapper</a></td> |
2393 <td>Constructor</td> |
2389 <td>Constructor</td> |
2394 </tr> |
2390 </tr> |
2395 <tr> |
2391 <tr> |
2399 <tr> |
2395 <tr> |
2400 <td><a href="#IndentationWrapper.pep8Expected">pep8Expected</a></td> |
2396 <td><a href="#IndentationWrapper.pep8Expected">pep8Expected</a></td> |
2401 <td>Public method to replicate logic in pycodestyle.py, to know what level to indent things to.</td> |
2397 <td>Public method to replicate logic in pycodestyle.py, to know what level to indent things to.</td> |
2402 </tr> |
2398 </tr> |
2403 </table> |
2399 </table> |
|
2400 |
2404 <h3>Static Methods</h3> |
2401 <h3>Static Methods</h3> |
2405 |
|
2406 <table> |
2402 <table> |
2407 <tr><td>None</td></tr> |
2403 <tr><td>None</td></tr> |
2408 </table> |
2404 </table> |
2409 |
2405 |
|
2406 |
2410 <a NAME="IndentationWrapper.__init__" ID="IndentationWrapper.__init__"></a> |
2407 <a NAME="IndentationWrapper.__init__" ID="IndentationWrapper.__init__"></a> |
2411 <h4>IndentationWrapper (Constructor)</h4> |
2408 <h4>IndentationWrapper (Constructor)</h4> |
2412 <b>IndentationWrapper</b>(<i>physical_lines</i>) |
2409 <b>IndentationWrapper</b>(<i>physical_lines</i>) |
2413 |
|
2414 <p> |
2410 <p> |
2415 Constructor |
2411 Constructor |
2416 </p> |
2412 </p> |
|
2413 |
2417 <dl> |
2414 <dl> |
2418 |
2415 |
2419 <dt><i>physical_lines</i> (list of str)</dt> |
2416 <dt><i>physical_lines</i> (list of str)</dt> |
2420 <dd> |
2417 <dd> |
2421 list of physical lines to operate on |
2418 list of physical lines to operate on |
2422 </dd> |
2419 </dd> |
2423 </dl> |
2420 </dl> |
2424 <a NAME="IndentationWrapper.__buildTokensLogical" ID="IndentationWrapper.__buildTokensLogical"></a> |
2421 <a NAME="IndentationWrapper.__buildTokensLogical" ID="IndentationWrapper.__buildTokensLogical"></a> |
2425 <h4>IndentationWrapper.__buildTokensLogical</h4> |
2422 <h4>IndentationWrapper.__buildTokensLogical</h4> |
2426 <b>__buildTokensLogical</b>(<i>tokens</i>) |
2423 <b>__buildTokensLogical</b>(<i>tokens</i>) |
2427 |
|
2428 <p> |
2424 <p> |
2429 Private method to build a logical line from a list of tokens. |
2425 Private method to build a logical line from a list of tokens. |
2430 </p> |
2426 </p> |
|
2427 |
2431 <dl> |
2428 <dl> |
2432 |
2429 |
2433 <dt><i>tokens</i> (list of Token)</dt> |
2430 <dt><i>tokens</i> (list of Token)</dt> |
2434 <dd> |
2431 <dd> |
2435 list of tokens as generated by tokenize.generate_tokens |
2432 list of tokens as generated by tokenize.generate_tokens |
2448 </dd> |
2445 </dd> |
2449 </dl> |
2446 </dl> |
2450 <a NAME="IndentationWrapper.pep8Expected" ID="IndentationWrapper.pep8Expected"></a> |
2447 <a NAME="IndentationWrapper.pep8Expected" ID="IndentationWrapper.pep8Expected"></a> |
2451 <h4>IndentationWrapper.pep8Expected</h4> |
2448 <h4>IndentationWrapper.pep8Expected</h4> |
2452 <b>pep8Expected</b>(<i></i>) |
2449 <b>pep8Expected</b>(<i></i>) |
2453 |
|
2454 <p> |
2450 <p> |
2455 Public method to replicate logic in pycodestyle.py, to know what level |
2451 Public method to replicate logic in pycodestyle.py, to know what level |
2456 to indent things to. |
2452 to indent things to. |
2457 </p> |
2453 </p> |
|
2454 |
2458 <dl> |
2455 <dl> |
2459 <dt>Return:</dt> |
2456 <dt>Return:</dt> |
2460 <dd> |
2457 <dd> |
2461 list of lists, where each list represents valid indent levels |
2458 list of lists, where each list represents valid indent levels |
2462 for the line in question, relative from the initial indent. However, |
2459 for the line in question, relative from the initial indent. However, |
2472 <div align="right"><a href="#top">Up</a></div> |
2469 <div align="right"><a href="#top">Up</a></div> |
2473 <hr /> |
2470 <hr /> |
2474 <hr /> |
2471 <hr /> |
2475 <a NAME="LineShortener" ID="LineShortener"></a> |
2472 <a NAME="LineShortener" ID="LineShortener"></a> |
2476 <h2>LineShortener</h2> |
2473 <h2>LineShortener</h2> |
2477 |
|
2478 <p> |
2474 <p> |
2479 Class used to shorten lines to a given maximum of characters. |
2475 Class used to shorten lines to a given maximum of characters. |
2480 </p> |
2476 </p> |
|
2477 |
2481 <h3>Derived from</h3> |
2478 <h3>Derived from</h3> |
2482 None |
2479 None |
2483 <h3>Class Attributes</h3> |
2480 <h3>Class Attributes</h3> |
2484 |
|
2485 <table> |
2481 <table> |
2486 <tr><td>None</td></tr> |
2482 <tr><td>None</td></tr> |
2487 </table> |
2483 </table> |
|
2484 |
2488 <h3>Class Methods</h3> |
2485 <h3>Class Methods</h3> |
2489 |
|
2490 <table> |
2486 <table> |
2491 <tr><td>None</td></tr> |
2487 <tr><td>None</td></tr> |
2492 </table> |
2488 </table> |
|
2489 |
2493 <h3>Methods</h3> |
2490 <h3>Methods</h3> |
2494 |
|
2495 <table> |
2491 <table> |
2496 |
|
2497 <tr> |
2492 <tr> |
2498 <td><a href="#LineShortener.__init__">LineShortener</a></td> |
2493 <td><a href="#LineShortener.__init__">LineShortener</a></td> |
2499 <td>Constructor</td> |
2494 <td>Constructor</td> |
2500 </tr> |
2495 </tr> |
2501 <tr> |
2496 <tr> |
2537 <tr> |
2532 <tr> |
2538 <td><a href="#LineShortener.shorten">shorten</a></td> |
2533 <td><a href="#LineShortener.shorten">shorten</a></td> |
2539 <td>Public method to shorten the line wrapped by the class instance.</td> |
2534 <td>Public method to shorten the line wrapped by the class instance.</td> |
2540 </tr> |
2535 </tr> |
2541 </table> |
2536 </table> |
|
2537 |
2542 <h3>Static Methods</h3> |
2538 <h3>Static Methods</h3> |
2543 |
|
2544 <table> |
2539 <table> |
2545 <tr><td>None</td></tr> |
2540 <tr><td>None</td></tr> |
2546 </table> |
2541 </table> |
2547 |
2542 |
|
2543 |
2548 <a NAME="LineShortener.__init__" ID="LineShortener.__init__"></a> |
2544 <a NAME="LineShortener.__init__" ID="LineShortener.__init__"></a> |
2549 <h4>LineShortener (Constructor)</h4> |
2545 <h4>LineShortener (Constructor)</h4> |
2550 <b>LineShortener</b>(<i>curLine, prevLine, nextLine, maxLength=88, eol="\n", indentWord=" ", isDocString=False, </i>) |
2546 <b>LineShortener</b>(<i>curLine, prevLine, nextLine, maxLength=88, eol="\n", indentWord=" ", isDocString=False, </i>) |
2551 |
|
2552 <p> |
2547 <p> |
2553 Constructor |
2548 Constructor |
2554 </p> |
2549 </p> |
|
2550 |
2555 <dl> |
2551 <dl> |
2556 |
2552 |
2557 <dt><i>curLine</i> (str)</dt> |
2553 <dt><i>curLine</i> (str)</dt> |
2558 <dd> |
2554 <dd> |
2559 text to work on |
2555 text to work on |
2585 </dd> |
2581 </dd> |
2586 </dl> |
2582 </dl> |
2587 <a NAME="LineShortener.__breakMultiline" ID="LineShortener.__breakMultiline"></a> |
2583 <a NAME="LineShortener.__breakMultiline" ID="LineShortener.__breakMultiline"></a> |
2588 <h4>LineShortener.__breakMultiline</h4> |
2584 <h4>LineShortener.__breakMultiline</h4> |
2589 <b>__breakMultiline</b>(<i></i>) |
2585 <b>__breakMultiline</b>(<i></i>) |
2590 |
|
2591 <p> |
2586 <p> |
2592 Private method to break multi line strings. |
2587 Private method to break multi line strings. |
2593 </p> |
2588 </p> |
|
2589 |
2594 <dl> |
2590 <dl> |
2595 <dt>Return:</dt> |
2591 <dt>Return:</dt> |
2596 <dd> |
2592 <dd> |
2597 tuple of the shortened line and the changed next line |
2593 tuple of the shortened line and the changed next line |
2598 </dd> |
2594 </dd> |
2604 </dd> |
2600 </dd> |
2605 </dl> |
2601 </dl> |
2606 <a NAME="LineShortener.__checkSyntax" ID="LineShortener.__checkSyntax"></a> |
2602 <a NAME="LineShortener.__checkSyntax" ID="LineShortener.__checkSyntax"></a> |
2607 <h4>LineShortener.__checkSyntax</h4> |
2603 <h4>LineShortener.__checkSyntax</h4> |
2608 <b>__checkSyntax</b>(<i>code</i>) |
2604 <b>__checkSyntax</b>(<i>code</i>) |
2609 |
|
2610 <p> |
2605 <p> |
2611 Private method to check the syntax of the given code fragment. |
2606 Private method to check the syntax of the given code fragment. |
2612 </p> |
2607 </p> |
|
2608 |
2613 <dl> |
2609 <dl> |
2614 |
2610 |
2615 <dt><i>code</i> (str)</dt> |
2611 <dt><i>code</i> (str)</dt> |
2616 <dd> |
2612 <dd> |
2617 code fragment to check |
2613 code fragment to check |
2630 </dd> |
2626 </dd> |
2631 </dl> |
2627 </dl> |
2632 <a NAME="LineShortener.__countUnbalancedBrackets" ID="LineShortener.__countUnbalancedBrackets"></a> |
2628 <a NAME="LineShortener.__countUnbalancedBrackets" ID="LineShortener.__countUnbalancedBrackets"></a> |
2633 <h4>LineShortener.__countUnbalancedBrackets</h4> |
2629 <h4>LineShortener.__countUnbalancedBrackets</h4> |
2634 <b>__countUnbalancedBrackets</b>(<i>line</i>) |
2630 <b>__countUnbalancedBrackets</b>(<i>line</i>) |
2635 |
|
2636 <p> |
2631 <p> |
2637 Private method to determine the number of unmatched open/close |
2632 Private method to determine the number of unmatched open/close |
2638 brackets. |
2633 brackets. |
2639 </p> |
2634 </p> |
|
2635 |
2640 <dl> |
2636 <dl> |
2641 |
2637 |
2642 <dt><i>line</i> (str)</dt> |
2638 <dt><i>line</i> (str)</dt> |
2643 <dd> |
2639 <dd> |
2644 line to work at |
2640 line to work at |
2657 </dd> |
2653 </dd> |
2658 </dl> |
2654 </dl> |
2659 <a NAME="LineShortener.__getIndent" ID="LineShortener.__getIndent"></a> |
2655 <a NAME="LineShortener.__getIndent" ID="LineShortener.__getIndent"></a> |
2660 <h4>LineShortener.__getIndent</h4> |
2656 <h4>LineShortener.__getIndent</h4> |
2661 <b>__getIndent</b>(<i>line</i>) |
2657 <b>__getIndent</b>(<i>line</i>) |
2662 |
|
2663 <p> |
2658 <p> |
2664 Private method to get the indentation string. |
2659 Private method to get the indentation string. |
2665 </p> |
2660 </p> |
|
2661 |
2666 <dl> |
2662 <dl> |
2667 |
2663 |
2668 <dt><i>line</i> (str)</dt> |
2664 <dt><i>line</i> (str)</dt> |
2669 <dd> |
2665 <dd> |
2670 line to determine the indentation string from |
2666 line to determine the indentation string from |
2683 </dd> |
2679 </dd> |
2684 </dl> |
2680 </dl> |
2685 <a NAME="LineShortener.__isProbablyInsideStringOrComment" ID="LineShortener.__isProbablyInsideStringOrComment"></a> |
2681 <a NAME="LineShortener.__isProbablyInsideStringOrComment" ID="LineShortener.__isProbablyInsideStringOrComment"></a> |
2686 <h4>LineShortener.__isProbablyInsideStringOrComment</h4> |
2682 <h4>LineShortener.__isProbablyInsideStringOrComment</h4> |
2687 <b>__isProbablyInsideStringOrComment</b>(<i>line, index</i>) |
2683 <b>__isProbablyInsideStringOrComment</b>(<i>line, index</i>) |
2688 |
|
2689 <p> |
2684 <p> |
2690 Private method to check, if the given string might be inside a string |
2685 Private method to check, if the given string might be inside a string |
2691 or comment. |
2686 or comment. |
2692 </p> |
2687 </p> |
|
2688 |
2693 <dl> |
2689 <dl> |
2694 |
2690 |
2695 <dt><i>line</i> (str)</dt> |
2691 <dt><i>line</i> (str)</dt> |
2696 <dd> |
2692 <dd> |
2697 line to check |
2693 line to check |
2715 </dd> |
2711 </dd> |
2716 </dl> |
2712 </dl> |
2717 <a NAME="LineShortener.__lineShorteningRank" ID="LineShortener.__lineShorteningRank"></a> |
2713 <a NAME="LineShortener.__lineShorteningRank" ID="LineShortener.__lineShorteningRank"></a> |
2718 <h4>LineShortener.__lineShorteningRank</h4> |
2714 <h4>LineShortener.__lineShorteningRank</h4> |
2719 <b>__lineShorteningRank</b>(<i>candidate</i>) |
2715 <b>__lineShorteningRank</b>(<i>candidate</i>) |
2720 |
|
2721 <p> |
2716 <p> |
2722 Private method to rank a candidate. |
2717 Private method to rank a candidate. |
2723 </p> |
2718 </p> |
|
2719 |
2724 <dl> |
2720 <dl> |
2725 |
2721 |
2726 <dt><i>candidate</i> (str)</dt> |
2722 <dt><i>candidate</i> (str)</dt> |
2727 <dd> |
2723 <dd> |
2728 candidate line to rank |
2724 candidate line to rank |
2741 </dd> |
2737 </dd> |
2742 </dl> |
2738 </dl> |
2743 <a NAME="LineShortener.__normalizeMultiline" ID="LineShortener.__normalizeMultiline"></a> |
2739 <a NAME="LineShortener.__normalizeMultiline" ID="LineShortener.__normalizeMultiline"></a> |
2744 <h4>LineShortener.__normalizeMultiline</h4> |
2740 <h4>LineShortener.__normalizeMultiline</h4> |
2745 <b>__normalizeMultiline</b>(<i>text</i>) |
2741 <b>__normalizeMultiline</b>(<i>text</i>) |
2746 |
|
2747 <p> |
2742 <p> |
2748 Private method to remove multiline-related code that will cause syntax |
2743 Private method to remove multiline-related code that will cause syntax |
2749 error. |
2744 error. |
2750 </p> |
2745 </p> |
|
2746 |
2751 <dl> |
2747 <dl> |
2752 |
2748 |
2753 <dt><i>text</i> (str)</dt> |
2749 <dt><i>text</i> (str)</dt> |
2754 <dd> |
2750 <dd> |
2755 code line to work on |
2751 code line to work on |
2768 </dd> |
2764 </dd> |
2769 </dl> |
2765 </dl> |
2770 <a NAME="LineShortener.__shortenComment" ID="LineShortener.__shortenComment"></a> |
2766 <a NAME="LineShortener.__shortenComment" ID="LineShortener.__shortenComment"></a> |
2771 <h4>LineShortener.__shortenComment</h4> |
2767 <h4>LineShortener.__shortenComment</h4> |
2772 <b>__shortenComment</b>(<i>isLast</i>) |
2768 <b>__shortenComment</b>(<i>isLast</i>) |
2773 |
|
2774 <p> |
2769 <p> |
2775 Private method to shorten a comment line. |
2770 Private method to shorten a comment line. |
2776 </p> |
2771 </p> |
|
2772 |
2777 <dl> |
2773 <dl> |
2778 |
2774 |
2779 <dt><i>isLast</i> (bool)</dt> |
2775 <dt><i>isLast</i> (bool)</dt> |
2780 <dd> |
2776 <dd> |
2781 flag indicating, that the line is the last comment line |
2777 flag indicating, that the line is the last comment line |
2794 </dd> |
2790 </dd> |
2795 </dl> |
2791 </dl> |
2796 <a NAME="LineShortener.__shortenLine" ID="LineShortener.__shortenLine"></a> |
2792 <a NAME="LineShortener.__shortenLine" ID="LineShortener.__shortenLine"></a> |
2797 <h4>LineShortener.__shortenLine</h4> |
2793 <h4>LineShortener.__shortenLine</h4> |
2798 <b>__shortenLine</b>(<i>tokens, source, indent</i>) |
2794 <b>__shortenLine</b>(<i>tokens, source, indent</i>) |
2799 |
|
2800 <p> |
2795 <p> |
2801 Private method to shorten a line of code at an operator. |
2796 Private method to shorten a line of code at an operator. |
2802 </p> |
2797 </p> |
|
2798 |
2803 <dl> |
2799 <dl> |
2804 |
2800 |
2805 <dt><i>tokens</i> (list of Token)</dt> |
2801 <dt><i>tokens</i> (list of Token)</dt> |
2806 <dd> |
2802 <dd> |
2807 tokens of the line as generated by tokenize |
2803 tokens of the line as generated by tokenize |
2828 </dd> |
2824 </dd> |
2829 </dl> |
2825 </dl> |
2830 <a NAME="LineShortener.shorten" ID="LineShortener.shorten"></a> |
2826 <a NAME="LineShortener.shorten" ID="LineShortener.shorten"></a> |
2831 <h4>LineShortener.shorten</h4> |
2827 <h4>LineShortener.shorten</h4> |
2832 <b>shorten</b>(<i></i>) |
2828 <b>shorten</b>(<i></i>) |
2833 |
|
2834 <p> |
2829 <p> |
2835 Public method to shorten the line wrapped by the class instance. |
2830 Public method to shorten the line wrapped by the class instance. |
2836 </p> |
2831 </p> |
|
2832 |
2837 <dl> |
2833 <dl> |
2838 <dt>Return:</dt> |
2834 <dt>Return:</dt> |
2839 <dd> |
2835 <dd> |
2840 tuple of a flag indicating successful shortening, the |
2836 tuple of a flag indicating successful shortening, the |
2841 shortened line and the changed next line |
2837 shortened line and the changed next line |
2850 <div align="right"><a href="#top">Up</a></div> |
2846 <div align="right"><a href="#top">Up</a></div> |
2851 <hr /> |
2847 <hr /> |
2852 <hr /> |
2848 <hr /> |
2853 <a NAME="Reindenter" ID="Reindenter"></a> |
2849 <a NAME="Reindenter" ID="Reindenter"></a> |
2854 <h2>Reindenter</h2> |
2850 <h2>Reindenter</h2> |
2855 |
|
2856 <p> |
2851 <p> |
2857 Class to reindent badly-indented code to uniformly use four-space |
2852 Class to reindent badly-indented code to uniformly use four-space |
2858 indentation. |
2853 indentation. |
2859 </p> |
2854 </p> |
2860 <p> |
2855 <p> |
2861 Released to the public domain, by Tim Peters, 03 October 2000. |
2856 Released to the public domain, by Tim Peters, 03 October 2000. |
2862 </p> |
2857 </p> |
|
2858 |
2863 <h3>Derived from</h3> |
2859 <h3>Derived from</h3> |
2864 None |
2860 None |
2865 <h3>Class Attributes</h3> |
2861 <h3>Class Attributes</h3> |
2866 |
|
2867 <table> |
2862 <table> |
2868 <tr><td>None</td></tr> |
2863 <tr><td>None</td></tr> |
2869 </table> |
2864 </table> |
|
2865 |
2870 <h3>Class Methods</h3> |
2866 <h3>Class Methods</h3> |
2871 |
|
2872 <table> |
2867 <table> |
2873 <tr><td>None</td></tr> |
2868 <tr><td>None</td></tr> |
2874 </table> |
2869 </table> |
|
2870 |
2875 <h3>Methods</h3> |
2871 <h3>Methods</h3> |
2876 |
|
2877 <table> |
2872 <table> |
2878 |
|
2879 <tr> |
2873 <tr> |
2880 <td><a href="#Reindenter.__init__">Reindenter</a></td> |
2874 <td><a href="#Reindenter.__init__">Reindenter</a></td> |
2881 <td>Constructor</td> |
2875 <td>Constructor</td> |
2882 </tr> |
2876 </tr> |
2883 <tr> |
2877 <tr> |
2899 <tr> |
2893 <tr> |
2900 <td><a href="#Reindenter.run">run</a></td> |
2894 <td><a href="#Reindenter.run">run</a></td> |
2901 <td>Public method to run the re-indenter.</td> |
2895 <td>Public method to run the re-indenter.</td> |
2902 </tr> |
2896 </tr> |
2903 </table> |
2897 </table> |
|
2898 |
2904 <h3>Static Methods</h3> |
2899 <h3>Static Methods</h3> |
2905 |
|
2906 <table> |
2900 <table> |
2907 <tr><td>None</td></tr> |
2901 <tr><td>None</td></tr> |
2908 </table> |
2902 </table> |
2909 |
2903 |
|
2904 |
2910 <a NAME="Reindenter.__init__" ID="Reindenter.__init__"></a> |
2905 <a NAME="Reindenter.__init__" ID="Reindenter.__init__"></a> |
2911 <h4>Reindenter (Constructor)</h4> |
2906 <h4>Reindenter (Constructor)</h4> |
2912 <b>Reindenter</b>(<i>sourceLines</i>) |
2907 <b>Reindenter</b>(<i>sourceLines</i>) |
2913 |
|
2914 <p> |
2908 <p> |
2915 Constructor |
2909 Constructor |
2916 </p> |
2910 </p> |
|
2911 |
2917 <dl> |
2912 <dl> |
2918 |
2913 |
2919 <dt><i>sourceLines</i> (list of str)</dt> |
2914 <dt><i>sourceLines</i> (list of str)</dt> |
2920 <dd> |
2915 <dd> |
2921 list of source lines including eol marker |
2916 list of source lines including eol marker |
2922 </dd> |
2917 </dd> |
2923 </dl> |
2918 </dl> |
2924 <a NAME="Reindenter.__genStats" ID="Reindenter.__genStats"></a> |
2919 <a NAME="Reindenter.__genStats" ID="Reindenter.__genStats"></a> |
2925 <h4>Reindenter.__genStats</h4> |
2920 <h4>Reindenter.__genStats</h4> |
2926 <b>__genStats</b>(<i>tokens</i>) |
2921 <b>__genStats</b>(<i>tokens</i>) |
2927 |
|
2928 <p> |
2922 <p> |
2929 Private method to generate the re-indent statistics. |
2923 Private method to generate the re-indent statistics. |
2930 </p> |
2924 </p> |
|
2925 |
2931 <dl> |
2926 <dl> |
2932 |
2927 |
2933 <dt><i>tokens</i> (function)</dt> |
2928 <dt><i>tokens</i> (function)</dt> |
2934 <dd> |
2929 <dd> |
2935 tokens generator (tokenize._tokenize) |
2930 tokens generator (tokenize._tokenize) |
2948 </dd> |
2943 </dd> |
2949 </dl> |
2944 </dl> |
2950 <a NAME="Reindenter.__getlspace" ID="Reindenter.__getlspace"></a> |
2945 <a NAME="Reindenter.__getlspace" ID="Reindenter.__getlspace"></a> |
2951 <h4>Reindenter.__getlspace</h4> |
2946 <h4>Reindenter.__getlspace</h4> |
2952 <b>__getlspace</b>(<i>line</i>) |
2947 <b>__getlspace</b>(<i>line</i>) |
2953 |
|
2954 <p> |
2948 <p> |
2955 Private method to count number of leading blanks. |
2949 Private method to count number of leading blanks. |
2956 </p> |
2950 </p> |
|
2951 |
2957 <dl> |
2952 <dl> |
2958 |
2953 |
2959 <dt><i>line</i> (str)</dt> |
2954 <dt><i>line</i> (str)</dt> |
2960 <dd> |
2955 <dd> |
2961 line to check |
2956 line to check |
2974 </dd> |
2969 </dd> |
2975 </dl> |
2970 </dl> |
2976 <a NAME="Reindenter.fixedLine" ID="Reindenter.fixedLine"></a> |
2971 <a NAME="Reindenter.fixedLine" ID="Reindenter.fixedLine"></a> |
2977 <h4>Reindenter.fixedLine</h4> |
2972 <h4>Reindenter.fixedLine</h4> |
2978 <b>fixedLine</b>(<i>line</i>) |
2973 <b>fixedLine</b>(<i>line</i>) |
2979 |
|
2980 <p> |
2974 <p> |
2981 Public method to get a fixed line. |
2975 Public method to get a fixed line. |
2982 </p> |
2976 </p> |
|
2977 |
2983 <dl> |
2978 <dl> |
2984 |
2979 |
2985 <dt><i>line</i> (int)</dt> |
2980 <dt><i>line</i> (int)</dt> |
2986 <dd> |
2981 <dd> |
2987 number of the line to retrieve |
2982 number of the line to retrieve |