Sun, 25 Aug 2013 19:56:37 +0200
Extended the PEP8 fixer and adjusted it to the updated PEP8 checker.
--- a/APIs/Python3/eric5.api Sat Aug 24 15:05:05 2013 +0200 +++ b/APIs/Python3/eric5.api Sun Aug 25 19:56:37 2013 +0200 @@ -3743,6 +3743,10 @@ eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Fixer.fixIssue?4(line, pos, message) eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Fixer.saveFile?4(encoding) eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Fixer?1(project, filename, sourceLines, fixCodes, inPlace) +eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Reindenter.fixedLine?4(line) +eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Reindenter.getline?4() +eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Reindenter.run?4() +eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.Pep8Reindenter?1(sourceLines) eric5.Plugins.CheckerPlugins.Pep8.Pep8StatisticsDialog.Pep8StatisticsDialog?1(statistics, parent=None) eric5.Plugins.CheckerPlugins.Pep8.pep8.ARITHMETIC_OP?7 eric5.Plugins.CheckerPlugins.Pep8.pep8.BENCHMARK_KEYS?7
--- a/Documentation/Help/source.qhp Sat Aug 24 15:05:05 2013 +0200 +++ b/Documentation/Help/source.qhp Sun Aug 25 19:56:37 2013 +0200 @@ -8002,28 +8002,40 @@ <keyword name="Pep8Fixer (Constructor)" id="Pep8Fixer (Constructor)" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__init__" /> <keyword name="Pep8Fixer (Module)" id="Pep8Fixer (Module)" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html" /> <keyword name="Pep8Fixer.__finalize" id="Pep8Fixer.__finalize" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__finalize" /> - <keyword name="Pep8Fixer.__fixBlankLinesAfterDecorator" id="Pep8Fixer.__fixBlankLinesAfterDecorator" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixBlankLinesAfterDecorator" /> - <keyword name="Pep8Fixer.__fixMissingWhitespaceAfter" id="Pep8Fixer.__fixMissingWhitespaceAfter" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixMissingWhitespaceAfter" /> - <keyword name="Pep8Fixer.__fixMissingWhitespaceAroundOperator" id="Pep8Fixer.__fixMissingWhitespaceAroundOperator" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixMissingWhitespaceAroundOperator" /> - <keyword name="Pep8Fixer.__fixNewline" id="Pep8Fixer.__fixNewline" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixNewline" /> - <keyword name="Pep8Fixer.__fixNotEqual" id="Pep8Fixer.__fixNotEqual" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixNotEqual" /> - <keyword name="Pep8Fixer.__fixOneBlankLine" id="Pep8Fixer.__fixOneBlankLine" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixOneBlankLine" /> - <keyword name="Pep8Fixer.__fixTabs" id="Pep8Fixer.__fixTabs" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixTabs" /> - <keyword name="Pep8Fixer.__fixTooManyBlankLines" id="Pep8Fixer.__fixTooManyBlankLines" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixTooManyBlankLines" /> - <keyword name="Pep8Fixer.__fixTrailingBlankLines" id="Pep8Fixer.__fixTrailingBlankLines" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixTrailingBlankLines" /> - <keyword name="Pep8Fixer.__fixTwoBlankLines" id="Pep8Fixer.__fixTwoBlankLines" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixTwoBlankLines" /> + <keyword name="Pep8Fixer.__fixE101" id="Pep8Fixer.__fixE101" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE101" /> + <keyword name="Pep8Fixer.__fixE201" id="Pep8Fixer.__fixE201" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE201" /> + <keyword name="Pep8Fixer.__fixE221" id="Pep8Fixer.__fixE221" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE221" /> + <keyword name="Pep8Fixer.__fixE231" id="Pep8Fixer.__fixE231" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE231" /> + <keyword name="Pep8Fixer.__fixE251" id="Pep8Fixer.__fixE251" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE251" /> + <keyword name="Pep8Fixer.__fixE261" id="Pep8Fixer.__fixE261" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE261" /> + <keyword name="Pep8Fixer.__fixE301" id="Pep8Fixer.__fixE301" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE301" /> + <keyword name="Pep8Fixer.__fixE302" id="Pep8Fixer.__fixE302" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE302" /> + <keyword name="Pep8Fixer.__fixE303" id="Pep8Fixer.__fixE303" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE303" /> + <keyword name="Pep8Fixer.__fixE304" id="Pep8Fixer.__fixE304" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE304" /> + <keyword name="Pep8Fixer.__fixE401" id="Pep8Fixer.__fixE401" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE401" /> + <keyword name="Pep8Fixer.__fixE502" id="Pep8Fixer.__fixE502" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE502" /> + <keyword name="Pep8Fixer.__fixE701" id="Pep8Fixer.__fixE701" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE701" /> + <keyword name="Pep8Fixer.__fixE702" id="Pep8Fixer.__fixE702" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE702" /> + <keyword name="Pep8Fixer.__fixE711" id="Pep8Fixer.__fixE711" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixE711" /> + <keyword name="Pep8Fixer.__fixW291" id="Pep8Fixer.__fixW291" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixW291" /> + <keyword name="Pep8Fixer.__fixW292" id="Pep8Fixer.__fixW292" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixW292" /> + <keyword name="Pep8Fixer.__fixW391" id="Pep8Fixer.__fixW391" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixW391" /> + <keyword name="Pep8Fixer.__fixW603" id="Pep8Fixer.__fixW603" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixW603" /> <keyword name="Pep8Fixer.__fixWhitespace" id="Pep8Fixer.__fixWhitespace" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespace" /> - <keyword name="Pep8Fixer.__fixWhitespaceAfter" id="Pep8Fixer.__fixWhitespaceAfter" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceAfter" /> - <keyword name="Pep8Fixer.__fixWhitespaceAfterInline" id="Pep8Fixer.__fixWhitespaceAfterInline" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceAfterInline" /> - <keyword name="Pep8Fixer.__fixWhitespaceAroundEquals" id="Pep8Fixer.__fixWhitespaceAroundEquals" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceAroundEquals" /> - <keyword name="Pep8Fixer.__fixWhitespaceAroundOperator" id="Pep8Fixer.__fixWhitespaceAroundOperator" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceAroundOperator" /> - <keyword name="Pep8Fixer.__fixWhitespaceBefore" id="Pep8Fixer.__fixWhitespaceBefore" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceBefore" /> - <keyword name="Pep8Fixer.__fixWhitespaceBeforeInline" id="Pep8Fixer.__fixWhitespaceBeforeInline" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__fixWhitespaceBeforeInline" /> <keyword name="Pep8Fixer.__getEol" id="Pep8Fixer.__getEol" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__getEol" /> + <keyword name="Pep8Fixer.__getIndent" id="Pep8Fixer.__getIndent" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__getIndent" /> + <keyword name="Pep8Fixer.__getIndentWord" id="Pep8Fixer.__getIndentWord" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.__getIndentWord" /> <keyword name="Pep8Fixer.fixIssue" id="Pep8Fixer.fixIssue" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.fixIssue" /> <keyword name="Pep8Fixer.saveFile" id="Pep8Fixer.saveFile" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Fixer.saveFile" /> <keyword name="Pep8Py2Checker" id="Pep8Py2Checker" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Checker.html#Pep8Py2Checker" /> <keyword name="Pep8Py2Checker (Constructor)" id="Pep8Py2Checker (Constructor)" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Checker.html#Pep8Py2Checker.__init__" /> + <keyword name="Pep8Reindenter" id="Pep8Reindenter" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Reindenter" /> + <keyword name="Pep8Reindenter (Constructor)" id="Pep8Reindenter (Constructor)" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Reindenter.__init__" /> + <keyword name="Pep8Reindenter.__genStats" id="Pep8Reindenter.__genStats" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Reindenter.__genStats" /> + <keyword name="Pep8Reindenter.__getlspace" id="Pep8Reindenter.__getlspace" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Reindenter.__getlspace" /> + <keyword name="Pep8Reindenter.fixedLine" id="Pep8Reindenter.fixedLine" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Reindenter.fixedLine" /> + <keyword name="Pep8Reindenter.getline" id="Pep8Reindenter.getline" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Reindenter.getline" /> + <keyword name="Pep8Reindenter.run" id="Pep8Reindenter.run" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html#Pep8Reindenter.run" /> <keyword name="Pep8Report" id="Pep8Report" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html#Pep8Report" /> <keyword name="Pep8Report" id="Pep8Report" ref="eric5.UtilitiesPython2.Pep8Checker.html#Pep8Report" /> <keyword name="Pep8Report (Constructor)" id="Pep8Report (Constructor)" ref="eric5.Plugins.CheckerPlugins.Pep8.Pep8Dialog.html#Pep8Report.__init__" />
--- a/Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html Sat Aug 24 15:05:05 2013 +0200 +++ b/Documentation/Source/eric5.Plugins.CheckerPlugins.Pep8.Pep8Fixer.html Sun Aug 25 19:56:37 2013 +0200 @@ -32,6 +32,9 @@ <tr> <td><a href="#Pep8Fixer">Pep8Fixer</a></td> <td>Class implementing a fixer for certain PEP 8 issues.</td> +</tr><tr> +<td><a href="#Pep8Reindenter">Pep8Reindenter</a></td> +<td>Class to reindent badly-indented code to uniformly use four-space indentation.</td> </tr> </table> <h3>Functions</h3> @@ -63,60 +66,75 @@ <td><a href="#Pep8Fixer.__finalize">__finalize</a></td> <td>Private method to apply all deferred fixes.</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixBlankLinesAfterDecorator">__fixBlankLinesAfterDecorator</a></td> -<td>Private method to fix superfluous blank lines after a function decorator.</td> +<td><a href="#Pep8Fixer.__fixE101">__fixE101</a></td> +<td>Private method to fix obsolete tab usage and indentation errors (E101, E111, W191).</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixMissingWhitespaceAfter">__fixMissingWhitespaceAfter</a></td> -<td>Private method to fix missing whitespace after ',;:'.</td> +<td><a href="#Pep8Fixer.__fixE201">__fixE201</a></td> +<td>Private method to fix extraneous whitespace (E201, E202, E203, E211).</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixMissingWhitespaceAroundOperator">__fixMissingWhitespaceAroundOperator</a></td> +<td><a href="#Pep8Fixer.__fixE221">__fixE221</a></td> +<td>Private method to fix extraneous whitespace around operator or keyword (E221, E222, E223, E224, E225, E226, E227, E228, E241, E242, E271, E272, E273, E274).</td> +</tr><tr> +<td><a href="#Pep8Fixer.__fixE231">__fixE231</a></td> <td>Private method to fix missing whitespace after ',;:'.</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixNewline">__fixNewline</a></td> -<td>Private method to fix a missing newline at the end of file.</td> +<td><a href="#Pep8Fixer.__fixE251">__fixE251</a></td> +<td>Private method to fix extraneous whitespace around keyword and default parameter equals (E251).</td> +</tr><tr> +<td><a href="#Pep8Fixer.__fixE261">__fixE261</a></td> +<td>Private method to fix whitespace before or after inline comment (E261, E262).</td> +</tr><tr> +<td><a href="#Pep8Fixer.__fixE301">__fixE301</a></td> +<td>Private method to fix the need for one blank line (E301).</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixNotEqual">__fixNotEqual</a></td> -<td>Private method to fix the not equal notation.</td> +<td><a href="#Pep8Fixer.__fixE302">__fixE302</a></td> +<td>Private method to fix the need for two blank lines (E302).</td> +</tr><tr> +<td><a href="#Pep8Fixer.__fixE303">__fixE303</a></td> +<td>Private method to fix superfluous blank lines (E303).</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixOneBlankLine">__fixOneBlankLine</a></td> -<td>Private method to fix the need for one blank line.</td> +<td><a href="#Pep8Fixer.__fixE304">__fixE304</a></td> +<td>Private method to fix superfluous blank lines after a function decorator (E304).</td> +</tr><tr> +<td><a href="#Pep8Fixer.__fixE401">__fixE401</a></td> +<td>Private method to fix multiple imports on one line (E401).</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixTabs">__fixTabs</a></td> -<td>Private method to fix obsolete tab usage.</td> +<td><a href="#Pep8Fixer.__fixE502">__fixE502</a></td> +<td>Private method to fix redundant backslash within brackets (E502).</td> +</tr><tr> +<td><a href="#Pep8Fixer.__fixE701">__fixE701</a></td> +<td>Private method to fix colon-separated compund statements (E701).</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixTooManyBlankLines">__fixTooManyBlankLines</a></td> -<td>Private method to fix superfluous blank lines.</td> +<td><a href="#Pep8Fixer.__fixE702">__fixE702</a></td> +<td>Private method to fix semicolon-separated compound statements (E702, E703).</td> +</tr><tr> +<td><a href="#Pep8Fixer.__fixE711">__fixE711</a></td> +<td>Private method to fix comparison with None (E711, E712).</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixTrailingBlankLines">__fixTrailingBlankLines</a></td> -<td>Private method to fix trailing blank lines.</td> +<td><a href="#Pep8Fixer.__fixW291">__fixW291</a></td> +<td>Private method to fix trailing whitespace (W291, W293).</td> +</tr><tr> +<td><a href="#Pep8Fixer.__fixW292">__fixW292</a></td> +<td>Private method to fix a missing newline at the end of file (W292).</td> </tr><tr> -<td><a href="#Pep8Fixer.__fixTwoBlankLines">__fixTwoBlankLines</a></td> -<td>Private method to fix the need for two blank lines.</td> +<td><a href="#Pep8Fixer.__fixW391">__fixW391</a></td> +<td>Private method to fix trailing blank lines (W391).</td> +</tr><tr> +<td><a href="#Pep8Fixer.__fixW603">__fixW603</a></td> +<td>Private method to fix the not equal notation (W603).</td> </tr><tr> <td><a href="#Pep8Fixer.__fixWhitespace">__fixWhitespace</a></td> -<td>Private method to fix trailing whitespace.</td> -</tr><tr> -<td><a href="#Pep8Fixer.__fixWhitespaceAfter">__fixWhitespaceAfter</a></td> -<td>Private method to fix superfluous whitespace after '([{'.</td> -</tr><tr> -<td><a href="#Pep8Fixer.__fixWhitespaceAfterInline">__fixWhitespaceAfterInline</a></td> -<td>Private method to fix whitespace after inline comment.</td> -</tr><tr> -<td><a href="#Pep8Fixer.__fixWhitespaceAroundEquals">__fixWhitespaceAroundEquals</a></td> -<td>Private method to fix extraneous whitespace around keyword and default parameter equals.</td> -</tr><tr> -<td><a href="#Pep8Fixer.__fixWhitespaceAroundOperator">__fixWhitespaceAroundOperator</a></td> -<td>Private method to fix extraneous whitespace around operator.</td> -</tr><tr> -<td><a href="#Pep8Fixer.__fixWhitespaceBefore">__fixWhitespaceBefore</a></td> -<td>Private method to fix superfluous whitespace before '}])', ',;:' and '(['.</td> -</tr><tr> -<td><a href="#Pep8Fixer.__fixWhitespaceBeforeInline">__fixWhitespaceBeforeInline</a></td> -<td>Private method to fix missing whitespace before inline comment.</td> +<td>Private method to correct whitespace at the given offset.</td> </tr><tr> <td><a href="#Pep8Fixer.__getEol">__getEol</a></td> <td>Private method to get the applicable eol string.</td> </tr><tr> +<td><a href="#Pep8Fixer.__getIndent">__getIndent</a></td> +<td>Private method to get the indentation string.</td> +</tr><tr> +<td><a href="#Pep8Fixer.__getIndentWord">__getIndentWord</a></td> +<td>Private method to determine the indentation type.</td> +</tr><tr> <td><a href="#Pep8Fixer.fixIssue">fixIssue</a></td> <td>Public method to fix the fixable issues.</td> </tr><tr> @@ -157,12 +175,12 @@ <b>__finalize</b>(<i></i>) <p> Private method to apply all deferred fixes. -</p><a NAME="Pep8Fixer.__fixBlankLinesAfterDecorator" ID="Pep8Fixer.__fixBlankLinesAfterDecorator"></a> -<h4>Pep8Fixer.__fixBlankLinesAfterDecorator</h4> -<b>__fixBlankLinesAfterDecorator</b>(<i>code, line, pos, apply=False</i>) +</p><a NAME="Pep8Fixer.__fixE101" ID="Pep8Fixer.__fixE101"></a> +<h4>Pep8Fixer.__fixE101</h4> +<b>__fixE101</b>(<i>code, line, pos</i>) <p> - Private method to fix superfluous blank lines after a function - decorator. + Private method to fix obsolete tab usage and indentation errors + (E101, E111, W191). </p><dl> <dt><i>code</i></dt> <dd> @@ -173,10 +191,6 @@ </dd><dt><i>pos</i></dt> <dd> position inside line (integer) -</dd><dt><i>apply=</i></dt> -<dd> -flag indicating, that the fix should be applied - (boolean) </dd> </dl><dl> <dt>Returns:</dt> @@ -184,9 +198,56 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixMissingWhitespaceAfter" ID="Pep8Fixer.__fixMissingWhitespaceAfter"></a> -<h4>Pep8Fixer.__fixMissingWhitespaceAfter</h4> -<b>__fixMissingWhitespaceAfter</b>(<i>code, line, pos, apply=False</i>) +</dl><a NAME="Pep8Fixer.__fixE201" ID="Pep8Fixer.__fixE201"></a> +<h4>Pep8Fixer.__fixE201</h4> +<b>__fixE201</b>(<i>code, line, pos</i>) +<p> + Private method to fix extraneous whitespace (E201, E202, + E203, E211). +</p><dl> +<dt><i>code</i></dt> +<dd> +code of the issue (string) +</dd><dt><i>line</i></dt> +<dd> +line number of the issue (integer) +</dd><dt><i>pos</i></dt> +<dd> +position inside line (integer) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating an applied fix (boolean) and a message for + the fix (string) +</dd> +</dl><a NAME="Pep8Fixer.__fixE221" ID="Pep8Fixer.__fixE221"></a> +<h4>Pep8Fixer.__fixE221</h4> +<b>__fixE221</b>(<i>code, line, pos</i>) +<p> + Private method to fix extraneous whitespace around operator or + keyword (E221, E222, E223, E224, E225, E226, E227, E228, E241, + E242, E271, E272, E273, E274). +</p><dl> +<dt><i>code</i></dt> +<dd> +code of the issue (string) +</dd><dt><i>line</i></dt> +<dd> +line number of the issue (integer) +</dd><dt><i>pos</i></dt> +<dd> +position inside line (integer) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating an applied fix (boolean) and a message for + the fix (string) +</dd> +</dl><a NAME="Pep8Fixer.__fixE231" ID="Pep8Fixer.__fixE231"></a> +<h4>Pep8Fixer.__fixE231</h4> +<b>__fixE231</b>(<i>code, line, pos</i>) <p> Private method to fix missing whitespace after ',;:'. </p><dl> @@ -199,10 +260,6 @@ </dd><dt><i>pos</i></dt> <dd> position inside line (integer) -</dd><dt><i>apply=</i></dt> -<dd> -flag indicating, that the fix should be applied - (boolean) </dd> </dl><dl> <dt>Returns:</dt> @@ -210,11 +267,57 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixMissingWhitespaceAroundOperator" ID="Pep8Fixer.__fixMissingWhitespaceAroundOperator"></a> -<h4>Pep8Fixer.__fixMissingWhitespaceAroundOperator</h4> -<b>__fixMissingWhitespaceAroundOperator</b>(<i>code, line, pos, apply=False</i>) +</dl><a NAME="Pep8Fixer.__fixE251" ID="Pep8Fixer.__fixE251"></a> +<h4>Pep8Fixer.__fixE251</h4> +<b>__fixE251</b>(<i>code, line, pos</i>) <p> - Private method to fix missing whitespace after ',;:'. + Private method to fix extraneous whitespace around keyword and + default parameter equals (E251). +</p><dl> +<dt><i>code</i></dt> +<dd> +code of the issue (string) +</dd><dt><i>line</i></dt> +<dd> +line number of the issue (integer) +</dd><dt><i>pos</i></dt> +<dd> +position inside line (integer) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating an applied fix (boolean) and a message for + the fix (string) +</dd> +</dl><a NAME="Pep8Fixer.__fixE261" ID="Pep8Fixer.__fixE261"></a> +<h4>Pep8Fixer.__fixE261</h4> +<b>__fixE261</b>(<i>code, line, pos</i>) +<p> + Private method to fix whitespace before or after inline comment + (E261, E262). +</p><dl> +<dt><i>code</i></dt> +<dd> +code of the issue (string) +</dd><dt><i>line</i></dt> +<dd> +line number of the issue (integer) +</dd><dt><i>pos</i></dt> +<dd> +position inside line (integer) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating an applied fix (boolean) and a message for + the fix (string) +</dd> +</dl><a NAME="Pep8Fixer.__fixE301" ID="Pep8Fixer.__fixE301"></a> +<h4>Pep8Fixer.__fixE301</h4> +<b>__fixE301</b>(<i>code, line, pos, apply=False</i>) +<p> + Private method to fix the need for one blank line (E301). </p><dl> <dt><i>code</i></dt> <dd> @@ -236,55 +339,16 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixNewline" ID="Pep8Fixer.__fixNewline"></a> -<h4>Pep8Fixer.__fixNewline</h4> -<b>__fixNewline</b>(<i>code, line, pos</i>) +</dl><a NAME="Pep8Fixer.__fixE302" ID="Pep8Fixer.__fixE302"></a> +<h4>Pep8Fixer.__fixE302</h4> +<b>__fixE302</b>(<i>code, line, pos, apply=False</i>) <p> - Private method to fix a missing newline at the end of file. -</p><dl> -<dt><i>code</i></dt> -<dd> -code of the issue (string) -</dd><dt><i>line</i></dt> -<dd> -line number of the issue (integer) -</dd><dt><i>pos</i></dt> -<dd> -position inside line (integer) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -flag indicating an applied fix (boolean) and a message for - the fix (string) -</dd> -</dl><a NAME="Pep8Fixer.__fixNotEqual" ID="Pep8Fixer.__fixNotEqual"></a> -<h4>Pep8Fixer.__fixNotEqual</h4> -<b>__fixNotEqual</b>(<i>code, line, pos</i>) + Private method to fix the need for two blank lines (E302). +</p><a NAME="Pep8Fixer.__fixE303" ID="Pep8Fixer.__fixE303"></a> +<h4>Pep8Fixer.__fixE303</h4> +<b>__fixE303</b>(<i>code, line, pos, apply=False</i>) <p> - Private method to fix the not equal notation. -</p><dl> -<dt><i>code</i></dt> -<dd> -code of the issue (string) -</dd><dt><i>line</i></dt> -<dd> -line number of the issue (integer) -</dd><dt><i>pos</i></dt> -<dd> -position inside line (integer) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -flag indicating an applied fix (boolean) and a message for - the fix (string) -</dd> -</dl><a NAME="Pep8Fixer.__fixOneBlankLine" ID="Pep8Fixer.__fixOneBlankLine"></a> -<h4>Pep8Fixer.__fixOneBlankLine</h4> -<b>__fixOneBlankLine</b>(<i>code, line, pos, apply=False</i>) -<p> - Private method to fix the need for one blank line. + Private method to fix superfluous blank lines (E303). </p><dl> <dt><i>code</i></dt> <dd> @@ -306,33 +370,12 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixTabs" ID="Pep8Fixer.__fixTabs"></a> -<h4>Pep8Fixer.__fixTabs</h4> -<b>__fixTabs</b>(<i>code, line, pos</i>) +</dl><a NAME="Pep8Fixer.__fixE304" ID="Pep8Fixer.__fixE304"></a> +<h4>Pep8Fixer.__fixE304</h4> +<b>__fixE304</b>(<i>code, line, pos, apply=False</i>) <p> - Private method to fix obsolete tab usage. -</p><dl> -<dt><i>code</i></dt> -<dd> -code of the issue (string) -</dd><dt><i>line</i></dt> -<dd> -line number of the issue (integer) -</dd><dt><i>pos</i></dt> -<dd> -position inside line (integer) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -flag indicating an applied fix (boolean) and a message for - the fix (string) -</dd> -</dl><a NAME="Pep8Fixer.__fixTooManyBlankLines" ID="Pep8Fixer.__fixTooManyBlankLines"></a> -<h4>Pep8Fixer.__fixTooManyBlankLines</h4> -<b>__fixTooManyBlankLines</b>(<i>code, line, pos, apply=False</i>) -<p> - Private method to fix superfluous blank lines. + Private method to fix superfluous blank lines after a function + decorator (E304). </p><dl> <dt><i>code</i></dt> <dd> @@ -354,60 +397,11 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixTrailingBlankLines" ID="Pep8Fixer.__fixTrailingBlankLines"></a> -<h4>Pep8Fixer.__fixTrailingBlankLines</h4> -<b>__fixTrailingBlankLines</b>(<i>code, line, pos</i>) -<p> - Private method to fix trailing blank lines. -</p><dl> -<dt><i>code</i></dt> -<dd> -code of the issue (string) -</dd><dt><i>line</i></dt> -<dd> -line number of the issue (integer) -</dd><dt><i>pos</i></dt> -<dd> -position inside line (integer) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -flag indicating an applied fix (boolean) and a message for - the fix (string) -</dd> -</dl><a NAME="Pep8Fixer.__fixTwoBlankLines" ID="Pep8Fixer.__fixTwoBlankLines"></a> -<h4>Pep8Fixer.__fixTwoBlankLines</h4> -<b>__fixTwoBlankLines</b>(<i>code, line, pos, apply=False</i>) +</dl><a NAME="Pep8Fixer.__fixE401" ID="Pep8Fixer.__fixE401"></a> +<h4>Pep8Fixer.__fixE401</h4> +<b>__fixE401</b>(<i>code, line, pos, apply=False</i>) <p> - Private method to fix the need for two blank lines. -</p><a NAME="Pep8Fixer.__fixWhitespace" ID="Pep8Fixer.__fixWhitespace"></a> -<h4>Pep8Fixer.__fixWhitespace</h4> -<b>__fixWhitespace</b>(<i>code, line, pos</i>) -<p> - Private method to fix trailing whitespace. -</p><dl> -<dt><i>code</i></dt> -<dd> -code of the issue (string) -</dd><dt><i>line</i></dt> -<dd> -line number of the issue (integer) -</dd><dt><i>pos</i></dt> -<dd> -position inside line (integer) -</dd> -</dl><dl> -<dt>Returns:</dt> -<dd> -flag indicating an applied fix (boolean) and a message for - the fix (string) -</dd> -</dl><a NAME="Pep8Fixer.__fixWhitespaceAfter" ID="Pep8Fixer.__fixWhitespaceAfter"></a> -<h4>Pep8Fixer.__fixWhitespaceAfter</h4> -<b>__fixWhitespaceAfter</b>(<i>code, line, pos, apply=False</i>) -<p> - Private method to fix superfluous whitespace after '([{'. + Private method to fix multiple imports on one line (E401). </p><dl> <dt><i>code</i></dt> <dd> @@ -429,11 +423,60 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixWhitespaceAfterInline" ID="Pep8Fixer.__fixWhitespaceAfterInline"></a> -<h4>Pep8Fixer.__fixWhitespaceAfterInline</h4> -<b>__fixWhitespaceAfterInline</b>(<i>code, line, pos, apply=False</i>) +</dl><a NAME="Pep8Fixer.__fixE502" ID="Pep8Fixer.__fixE502"></a> +<h4>Pep8Fixer.__fixE502</h4> +<b>__fixE502</b>(<i>code, line, pos</i>) +<p> + Private method to fix redundant backslash within brackets (E502). +</p><dl> +<dt><i>code</i></dt> +<dd> +code of the issue (string) +</dd><dt><i>line</i></dt> +<dd> +line number of the issue (integer) +</dd><dt><i>pos</i></dt> +<dd> +position inside line (integer) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating an applied fix (boolean) and a message for + the fix (string) +</dd> +</dl><a NAME="Pep8Fixer.__fixE701" ID="Pep8Fixer.__fixE701"></a> +<h4>Pep8Fixer.__fixE701</h4> +<b>__fixE701</b>(<i>code, line, pos, apply=False</i>) <p> - Private method to fix whitespace after inline comment. + Private method to fix colon-separated compund statements (E701). +</p><dl> +<dt><i>code</i></dt> +<dd> +code of the issue (string) +</dd><dt><i>line</i></dt> +<dd> +line number of the issue (integer) +</dd><dt><i>pos</i></dt> +<dd> +position inside line (integer) +</dd><dt><i>apply=</i></dt> +<dd> +flag indicating, that the fix should be applied + (boolean) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating an applied fix (boolean) and a message for + the fix (string) +</dd> +</dl><a NAME="Pep8Fixer.__fixE702" ID="Pep8Fixer.__fixE702"></a> +<h4>Pep8Fixer.__fixE702</h4> +<b>__fixE702</b>(<i>code, line, pos, apply=False</i>) +<p> + Private method to fix semicolon-separated compound statements + (E702, E703). </p><dl> <dt><i>code</i></dt> <dd> @@ -455,12 +498,11 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixWhitespaceAroundEquals" ID="Pep8Fixer.__fixWhitespaceAroundEquals"></a> -<h4>Pep8Fixer.__fixWhitespaceAroundEquals</h4> -<b>__fixWhitespaceAroundEquals</b>(<i>code, line, pos, apply=False</i>) +</dl><a NAME="Pep8Fixer.__fixE711" ID="Pep8Fixer.__fixE711"></a> +<h4>Pep8Fixer.__fixE711</h4> +<b>__fixE711</b>(<i>code, line, pos</i>) <p> - Private method to fix extraneous whitespace around keyword and - default parameter equals. + Private method to fix comparison with None (E711, E712). </p><dl> <dt><i>code</i></dt> <dd> @@ -471,10 +513,6 @@ </dd><dt><i>pos</i></dt> <dd> position inside line (integer) -</dd><dt><i>apply=</i></dt> -<dd> -flag indicating, that the fix should be applied - (boolean) </dd> </dl><dl> <dt>Returns:</dt> @@ -482,11 +520,55 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixWhitespaceAroundOperator" ID="Pep8Fixer.__fixWhitespaceAroundOperator"></a> -<h4>Pep8Fixer.__fixWhitespaceAroundOperator</h4> -<b>__fixWhitespaceAroundOperator</b>(<i>code, line, pos, apply=False</i>) +</dl><a NAME="Pep8Fixer.__fixW291" ID="Pep8Fixer.__fixW291"></a> +<h4>Pep8Fixer.__fixW291</h4> +<b>__fixW291</b>(<i>code, line, pos</i>) <p> - Private method to fix extraneous whitespace around operator. + Private method to fix trailing whitespace (W291, W293). +</p><dl> +<dt><i>code</i></dt> +<dd> +code of the issue (string) +</dd><dt><i>line</i></dt> +<dd> +line number of the issue (integer) +</dd><dt><i>pos</i></dt> +<dd> +position inside line (integer) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating an applied fix (boolean) and a message for + the fix (string) +</dd> +</dl><a NAME="Pep8Fixer.__fixW292" ID="Pep8Fixer.__fixW292"></a> +<h4>Pep8Fixer.__fixW292</h4> +<b>__fixW292</b>(<i>code, line, pos</i>) +<p> + Private method to fix a missing newline at the end of file (W292). +</p><dl> +<dt><i>code</i></dt> +<dd> +code of the issue (string) +</dd><dt><i>line</i></dt> +<dd> +line number of the issue (integer) +</dd><dt><i>pos</i></dt> +<dd> +position inside line (integer) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +flag indicating an applied fix (boolean) and a message for + the fix (string) +</dd> +</dl><a NAME="Pep8Fixer.__fixW391" ID="Pep8Fixer.__fixW391"></a> +<h4>Pep8Fixer.__fixW391</h4> +<b>__fixW391</b>(<i>code, line, pos</i>) +<p> + Private method to fix trailing blank lines (W391). </p><dl> <dt><i>code</i></dt> <dd> @@ -497,10 +579,6 @@ </dd><dt><i>pos</i></dt> <dd> position inside line (integer) -</dd><dt><i>apply=</i></dt> -<dd> -flag indicating, that the fix should be applied - (boolean) </dd> </dl><dl> <dt>Returns:</dt> @@ -508,12 +586,11 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixWhitespaceBefore" ID="Pep8Fixer.__fixWhitespaceBefore"></a> -<h4>Pep8Fixer.__fixWhitespaceBefore</h4> -<b>__fixWhitespaceBefore</b>(<i>code, line, pos, apply=False</i>) +</dl><a NAME="Pep8Fixer.__fixW603" ID="Pep8Fixer.__fixW603"></a> +<h4>Pep8Fixer.__fixW603</h4> +<b>__fixW603</b>(<i>code, line, pos</i>) <p> - Private method to fix superfluous whitespace before '}])', - ',;:' and '(['. + Private method to fix the not equal notation (W603). </p><dl> <dt><i>code</i></dt> <dd> @@ -524,10 +601,6 @@ </dd><dt><i>pos</i></dt> <dd> position inside line (integer) -</dd><dt><i>apply=</i></dt> -<dd> -flag indicating, that the fix should be applied - (boolean) </dd> </dl><dl> <dt>Returns:</dt> @@ -535,31 +608,26 @@ flag indicating an applied fix (boolean) and a message for the fix (string) </dd> -</dl><a NAME="Pep8Fixer.__fixWhitespaceBeforeInline" ID="Pep8Fixer.__fixWhitespaceBeforeInline"></a> -<h4>Pep8Fixer.__fixWhitespaceBeforeInline</h4> -<b>__fixWhitespaceBeforeInline</b>(<i>code, line, pos, apply=False</i>) +</dl><a NAME="Pep8Fixer.__fixWhitespace" ID="Pep8Fixer.__fixWhitespace"></a> +<h4>Pep8Fixer.__fixWhitespace</h4> +<b>__fixWhitespace</b>(<i>line, offset, replacement</i>) <p> - Private method to fix missing whitespace before inline comment. + Private method to correct whitespace at the given offset. </p><dl> -<dt><i>code</i></dt> +<dt><i>line</i></dt> <dd> -code of the issue (string) -</dd><dt><i>line</i></dt> -<dd> -line number of the issue (integer) -</dd><dt><i>pos</i></dt> +line to be corrected (string) +</dd><dt><i>offset</i></dt> <dd> -position inside line (integer) -</dd><dt><i>apply=</i></dt> +offset within line (integer) +</dd><dt><i>replacement</i></dt> <dd> -flag indicating, that the fix should be applied - (boolean) +replacement string (string) </dd> </dl><dl> <dt>Returns:</dt> <dd> -flag indicating an applied fix (boolean) and a message for - the fix (string) +corrected line </dd> </dl><a NAME="Pep8Fixer.__getEol" ID="Pep8Fixer.__getEol"></a> <h4>Pep8Fixer.__getEol</h4> @@ -571,6 +639,31 @@ <dd> eol string (string) </dd> +</dl><a NAME="Pep8Fixer.__getIndent" ID="Pep8Fixer.__getIndent"></a> +<h4>Pep8Fixer.__getIndent</h4> +<b>__getIndent</b>(<i>line</i>) +<p> + Private method to get the indentation string. +</p><dl> +<dt><i>line</i></dt> +<dd> +line to determine the indentation string from (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +indentation string (string) +</dd> +</dl><a NAME="Pep8Fixer.__getIndentWord" ID="Pep8Fixer.__getIndentWord"></a> +<h4>Pep8Fixer.__getIndentWord</h4> +<b>__getIndentWord</b>(<i></i>) +<p> + Private method to determine the indentation type. +</p><dl> +<dt>Returns:</dt> +<dd> +string to be used for an indentation (string) +</dd> </dl><a NAME="Pep8Fixer.fixIssue" ID="Pep8Fixer.fixIssue"></a> <h4>Pep8Fixer.fixIssue</h4> <b>fixIssue</b>(<i>line, pos, message</i>) @@ -610,5 +703,117 @@ </dd> </dl> <div align="right"><a href="#top">Up</a></div> +<hr /><hr /> +<a NAME="Pep8Reindenter" ID="Pep8Reindenter"></a> +<h2>Pep8Reindenter</h2> +<p> + Class to reindent badly-indented code to uniformly use four-space indentation. +</p><p> + Released to the public domain, by Tim Peters, 03 October 2000. +</p> +<h3>Derived from</h3> +object +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<h3>Methods</h3> +<table> +<tr> +<td><a href="#Pep8Reindenter.__init__">Pep8Reindenter</a></td> +<td>Constructor</td> +</tr><tr> +<td><a href="#Pep8Reindenter.__genStats">__genStats</a></td> +<td>Private method to generate the re-indent statistics.</td> +</tr><tr> +<td><a href="#Pep8Reindenter.__getlspace">__getlspace</a></td> +<td>Private method to count number of leading blanks.</td> +</tr><tr> +<td><a href="#Pep8Reindenter.fixedLine">fixedLine</a></td> +<td>Public method to get a fixed line.</td> +</tr><tr> +<td><a href="#Pep8Reindenter.getline">getline</a></td> +<td>Public method to get a line of text for tokenize.</td> +</tr><tr> +<td><a href="#Pep8Reindenter.run">run</a></td> +<td>Public method to run the re-indenter.</td> +</tr> +</table> +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> +<a NAME="Pep8Reindenter.__init__" ID="Pep8Reindenter.__init__"></a> +<h4>Pep8Reindenter (Constructor)</h4> +<b>Pep8Reindenter</b>(<i>sourceLines</i>) +<p> + Constructor +</p><dl> +<dt><i>sourceLines</i></dt> +<dd> +list of source lines including eol marker + (list of string) +</dd> +</dl><a NAME="Pep8Reindenter.__genStats" ID="Pep8Reindenter.__genStats"></a> +<h4>Pep8Reindenter.__genStats</h4> +<b>__genStats</b>(<i>tokens</i>) +<p> + Private method to generate the re-indent statistics. +</p><dl> +<dt><i>tokens</i></dt> +<dd> +tokens generator (tokenize._tokenize) +</dd> +</dl><a NAME="Pep8Reindenter.__getlspace" ID="Pep8Reindenter.__getlspace"></a> +<h4>Pep8Reindenter.__getlspace</h4> +<b>__getlspace</b>(<i>line</i>) +<p> + Private method to count number of leading blanks. +</p><dl> +<dt><i>line</i></dt> +<dd> +line to check (string) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +number of leading blanks (integer) +</dd> +</dl><a NAME="Pep8Reindenter.fixedLine" ID="Pep8Reindenter.fixedLine"></a> +<h4>Pep8Reindenter.fixedLine</h4> +<b>fixedLine</b>(<i>line</i>) +<p> + Public method to get a fixed line. +</p><dl> +<dt><i>line</i></dt> +<dd> +number of the line to retrieve (integer) +</dd> +</dl><dl> +<dt>Returns:</dt> +<dd> +fixed line (string) +</dd> +</dl><a NAME="Pep8Reindenter.getline" ID="Pep8Reindenter.getline"></a> +<h4>Pep8Reindenter.getline</h4> +<b>getline</b>(<i></i>) +<p> + Public method to get a line of text for tokenize. +</p><dl> +<dt>Returns:</dt> +<dd> +line of text (string) +</dd> +</dl><a NAME="Pep8Reindenter.run" ID="Pep8Reindenter.run"></a> +<h4>Pep8Reindenter.run</h4> +<b>run</b>(<i></i>) +<p> + Public method to run the re-indenter. +</p> +<div align="right"><a href="#top">Up</a></div> <hr /> </body></html> \ No newline at end of file
--- a/Plugins/CheckerPlugins/Pep8/Pep8Fixer.py Sat Aug 24 15:05:05 2013 +0200 +++ b/Plugins/CheckerPlugins/Pep8/Pep8Fixer.py Sun Aug 25 19:56:37 2013 +0200 @@ -9,6 +9,8 @@ import os import re +import tokenize +import io from PyQt4.QtCore import QObject @@ -16,10 +18,14 @@ import Utilities -Pep8FixableIssues = ["E101", "W191", "E201", "E202", "E203", "E211", "E221", - "E222", "E225", "E231", "E241", "E251", "E261", "E262", - "W291", "W292", "W293", "E301", "E302", "E303", "E304", - "W391", "W603"] +Pep8FixableIssues = ["E101", "E111", "W191", "E201", "E202", "E203", + "E211", "E221", "E222", "E223", "E224", "E225", + "E226", "E227", "E228", "E231", "E241", "E242", + "E251", "E261", "E262", "E271", "E272", "E273", + "E274", "W291", "W292", "W293", "E301", "E302", + "E303", "E304", "W391", "E401", "E502", "W603", + "E701", "E702", "E703", "E711", "E712" + ] class Pep8Fixer(QObject): @@ -47,35 +53,57 @@ self.__fixCodes = [c.strip() for c in fixCodes.split(",") if c.strip()] self.fixed = 0 + self.__reindenter = None + self.__eol = "" + self.__indentWord = self.__getIndentWord() + if not inPlace: self.__origName = self.__filename self.__filename = os.path.join(os.path.dirname(self.__filename), "fixed_" + os.path.basename(self.__filename)) self.__fixes = { - "E101": self.__fixTabs, - "W191": self.__fixTabs, - "E201": self.__fixWhitespaceAfter, - "E202": self.__fixWhitespaceBefore, - "E203": self.__fixWhitespaceBefore, - "E211": self.__fixWhitespaceBefore, - "E221": self.__fixWhitespaceAroundOperator, - "E222": self.__fixWhitespaceAroundOperator, - "E225": self.__fixMissingWhitespaceAroundOperator, - "E231": self.__fixMissingWhitespaceAfter, - "E241": self.__fixWhitespaceAroundOperator, - "E251": self.__fixWhitespaceAroundEquals, - "E261": self.__fixWhitespaceBeforeInline, - "E262": self.__fixWhitespaceAfterInline, - "W291": self.__fixWhitespace, - "W292": self.__fixNewline, - "W293": self.__fixWhitespace, - "E301": self.__fixOneBlankLine, - "E302": self.__fixTwoBlankLines, - "E303": self.__fixTooManyBlankLines, - "E304": self.__fixBlankLinesAfterDecorator, - "W391": self.__fixTrailingBlankLines, - "W603": self.__fixNotEqual, + "E101": self.__fixE101, + "E111": self.__fixE101, + "W191": self.__fixE101, + "E201": self.__fixE201, + "E202": self.__fixE201, + "E203": self.__fixE201, + "E211": self.__fixE201, + "E221": self.__fixE221, + "E222": self.__fixE221, + "E223": self.__fixE221, + "E224": self.__fixE221, + "E225": self.__fixE221, + "E226": self.__fixE221, + "E227": self.__fixE221, + "E228": self.__fixE221, + "E231": self.__fixE231, + "E241": self.__fixE221, + "E242": self.__fixE221, + "E251": self.__fixE251, + "E261": self.__fixE261, + "E262": self.__fixE261, + "E271": self.__fixE221, + "E272": self.__fixE221, + "E273": self.__fixE221, + "E274": self.__fixE221, + "W291": self.__fixW291, + "W292": self.__fixW292, + "W293": self.__fixW291, + "E301": self.__fixE301, + "E302": self.__fixE302, + "E303": self.__fixE303, + "E304": self.__fixE304, + "W391": self.__fixW391, + "E401": self.__fixE401, + "E502": self.__fixE502, + "W603": self.__fixW603, + "E701": self.__fixE701, + "E702": self.__fixE702, + "E703": self.__fixE702, + "E711": self.__fixE711, + "E712": self.__fixE711, } self.__modified = False self.__stack = [] # these need to be fixed before the file is saved @@ -147,20 +175,64 @@ @return eol string (string) """ - if self.__origName: - fn = self.__origName - else: - fn = self.__filename + if not self.__eol: + if self.__origName: + fn = self.__origName + else: + fn = self.__filename + + if self.__project.isOpen() and self.__project.isProjectFile(fn): + self.__eol = self.__project.getEolString() + else: + self.__eol = Utilities.linesep() + return self.__eol + + def __getIndentWord(self): + """ + Private method to determine the indentation type. - if self.__project.isOpen() and self.__project.isProjectFile(fn): - eol = self.__project.getEolString() + @return string to be used for an indentation (string) + """ + sio = io.StringIO("".join(self.__source)) + indentWord = " " # default in case of failure + try: + for token in tokenize.generate_tokens(sio.readline): + if token[0] == tokenize.INDENT: + indentWord = token[1] + break + except (SyntaxError, tokenize.TokenError): + pass + return indentWord + + def __getIndent(self, line): + """ + Private method to get the indentation string. + + @param line line to determine the indentation string from (string) + @return indentation string (string) + """ + return line.replace(line.lstrip(), "") + + def __fixWhitespace(self, line, offset, replacement): + """ + Private method to correct whitespace at the given offset. + + @param line line to be corrected (string) + @param offset offset within line (integer) + @param replacement replacement string (string) + @return corrected line + """ + left = line[:offset].rstrip(" \t") + right = line[offset:].lstrip(" \t") + if right.startswith("#"): + return line else: - eol = Utilities.linesep() - return eol + return left + replacement + right - def __fixTabs(self, code, line, pos): + def __fixE101(self, code, line, pos): """ - Private method to fix obsolete tab usage. + Private method to fix obsolete tab usage and indentation errors + (E101, E111, W191). @param code code of the issue (string) @param line line number of the issue (integer) @@ -168,39 +240,24 @@ @return flag indicating an applied fix (boolean) and a message for the fix (string) """ - self.__source[line - 1] = self.__source[line - 1].replace("\t", " ") - return (True, self.trUtf8("Tab converted to 4 spaces.")) - - def __fixWhitespace(self, code, line, pos): - """ - Private method to fix trailing whitespace. - - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @return flag indicating an applied fix (boolean) and a message for - the fix (string) - """ - self.__source[line - 1] = re.sub(r'[\t ]+(\r?)$', r"\1", - self.__source[line - 1]) - return (True, self.trUtf8("Whitespace stripped from end of line.")) + if self.__reindenter is None: + self.__reindenter = Pep8Reindenter(self.__source) + self.__reindenter.run() + fixedLine = self.__reindenter.fixedLine(line - 1) + if fixedLine is not None: + self.__source[line - 1] = fixedLine + if code in ["E101", "W191"]: + msg = self.trUtf8("Tab converted to 4 spaces.") + else: + msg = self.trUtf8("Indentation adjusted to be a multiple of four.") + return (True, msg) + else: + return (False, self.trUtf8("Fix for {0} failed.").format(code)) - def __fixNewline(self, code, line, pos): + def __fixE201(self, code, line, pos): """ - Private method to fix a missing newline at the end of file. - - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @return flag indicating an applied fix (boolean) and a message for - the fix (string) - """ - self.__source[line - 1] += self.__getEol() - return (True, self.trUtf8("newline added to end of file.")) - - def __fixTrailingBlankLines(self, code, line, pos): - """ - Private method to fix trailing blank lines. + Private method to fix extraneous whitespace (E201, E202, + E203, E211). @param code code of the issue (string) @param line line number of the issue (integer) @@ -208,19 +265,50 @@ @return flag indicating an applied fix (boolean) and a message for the fix (string) """ - index = line - 1 - while index: - if self.__source[index].strip() == "": - del self.__source[index] - index -= 1 - else: - break - return (True, self.trUtf8( - "Superfluous trailing blank lines removed from end of file.")) + line = line - 1 + text = self.__source[line] + + if '"""' in text or "'''" in text or text.rstrip().endswith('\\'): + return (False, self.trUtf8("Extraneous whitespace cannot be removed.")) + + newText = self.__fixWhitespace(text, pos, '') + if newText == text: + return (False, "") + + self.__source[line] = newText + return (True, self.trUtf8("Extraneous whitespace removed.")) - def __fixNotEqual(self, code, line, pos): + def __fixE221(self, code, line, pos): + """ + Private method to fix extraneous whitespace around operator or + keyword (E221, E222, E223, E224, E225, E226, E227, E228, E241, + E242, E271, E272, E273, E274). + + @param code code of the issue (string) + @param line line number of the issue (integer) + @param pos position inside line (integer) + @return flag indicating an applied fix (boolean) and a message for + the fix (string) """ - Private method to fix the not equal notation. + line = line - 1 + text = self.__source[line] + + if '"""' in text or "'''" in text or text.rstrip().endswith('\\'): + return (False, self.trUtf8("Extraneous whitespace cannot be removed.")) + + newText = self.__fixWhitespace(text, pos, ' ') + if newText == text: + return (False, "") + + self.__source[line] = newText + if code in ["E225", "E226", "E227", "E228"]: + return (True, self.trUtf8("Missing whitespace added.")) + else: + return (True, self.trUtf8("Extraneous whitespace removed.")) + + def __fixE231(self, code, line, pos): + """ + Private method to fix missing whitespace after ',;:'. @param code code of the issue (string) @param line line number of the issue (integer) @@ -228,62 +316,69 @@ @return flag indicating an applied fix (boolean) and a message for the fix (string) """ - self.__source[line - 1] = self.__source[line - 1].replace("<>", "!=") - return (True, self.trUtf8("'<>' replaced by '!='.")) + line = line - 1 + pos = pos + 1 + self.__source[line] = self.__source[line][:pos] + \ + " " + \ + self.__source[line][pos:] + return (True, self.trUtf8("Missing whitespace added.")) - def __fixBlankLinesAfterDecorator(self, code, line, pos, apply=False): + def __fixE251(self, code, line, pos): """ - Private method to fix superfluous blank lines after a function - decorator. + Private method to fix extraneous whitespace around keyword and + default parameter equals (E251). @param code code of the issue (string) @param line line number of the issue (integer) @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) @return flag indicating an applied fix (boolean) and a message for the fix (string) """ - if apply: - index = line - 2 - while index: - if self.__source[index].strip() == "": - del self.__source[index] - index -= 1 - else: - break + line = line - 1 + text = self.__source[line] + + # This is necessary since pep8 sometimes reports columns that goes + # past the end of the physical line. This happens in cases like, + # foo(bar\n=None) + col = min(pos, len(text) - 1) + if text[col].strip(): + newText = text else: - self.__stack.append((code, line, pos)) - return (True, self.trUtf8( - "Superfluous blank lines after function decorator removed.")) + newText = text[:col].rstrip() + text[col:].lstrip() + + # There could be an escaped newline + # + # def foo(a=\ + # 1) + if newText.endswith(('=\\\n', '=\\\r\n', '=\\\r')): + self.__source[line] = newText.rstrip("\n\r \t\\") + self.__source[line + 1] = self.__source[line + 1].lstrip() + else: + self.__source[line] = newText + return (True, self.trUtf8("Extraneous whitespace removed.")) - def __fixTooManyBlankLines(self, code, line, pos, apply=False): + def __fixE261(self, code, line, pos): """ - Private method to fix superfluous blank lines. + Private method to fix whitespace before or after inline comment + (E261, E262). @param code code of the issue (string) @param line line number of the issue (integer) @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) @return flag indicating an applied fix (boolean) and a message for the fix (string) """ - if apply: - index = line - 3 - while index: - if self.__source[index].strip() == "": - del self.__source[index] - index -= 1 - else: - break - else: - self.__stack.append((code, line, pos)) - return (True, self.trUtf8("Superfluous blank lines removed.")) + line = line - 1 + text = self.__source[line] + left = text[:pos].rstrip(' \t#') + right = text[pos:].lstrip(' \t#') + newText = left + (" # " + right if right.strip() else right) + self.__source[line] = newText + return (True, self.trUtf8("Whitespace around comment sign corrected.")) - def __fixOneBlankLine(self, code, line, pos, apply=False): + def __fixE301(self, code, line, pos, apply=False): """ - Private method to fix the need for one blank line. + Private method to fix the need for one blank line (E301). @param code code of the issue (string) @param line line number of the issue (integer) @@ -299,9 +394,9 @@ self.__stack.append((code, line, pos)) return (True, self.trUtf8("One blank line inserted.")) - def __fixTwoBlankLines(self, code, line, pos, apply=False): + def __fixE302(self, code, line, pos, apply=False): """ - Private method to fix the need for two blank lines. + Private method to fix the need for two blank lines (E302). """ # count blank lines index = line - 1 @@ -338,9 +433,59 @@ msg = "" return (True, msg) - def __fixWhitespaceAfter(self, code, line, pos, apply=False): + def __fixE303(self, code, line, pos, apply=False): + """ + Private method to fix superfluous blank lines (E303). + + @param code code of the issue (string) + @param line line number of the issue (integer) + @param pos position inside line (integer) + @keyparam apply flag indicating, that the fix should be applied + (boolean) + @return flag indicating an applied fix (boolean) and a message for + the fix (string) + """ + if apply: + index = line - 3 + while index: + if self.__source[index].strip() == "": + del self.__source[index] + index -= 1 + else: + break + else: + self.__stack.append((code, line, pos)) + return (True, self.trUtf8("Superfluous blank lines removed.")) + + def __fixE304(self, code, line, pos, apply=False): """ - Private method to fix superfluous whitespace after '([{'. + Private method to fix superfluous blank lines after a function + decorator (E304). + + @param code code of the issue (string) + @param line line number of the issue (integer) + @param pos position inside line (integer) + @keyparam apply flag indicating, that the fix should be applied + (boolean) + @return flag indicating an applied fix (boolean) and a message for + the fix (string) + """ + if apply: + index = line - 2 + while index: + if self.__source[index].strip() == "": + del self.__source[index] + index -= 1 + else: + break + else: + self.__stack.append((code, line, pos)) + return (True, self.trUtf8( + "Superfluous blank lines after function decorator removed.")) + + def __fixE401(self, code, line, pos, apply=False): + """ + Private method to fix multiple imports on one line (E401). @param code code of the issue (string) @param line line number of the issue (integer) @@ -350,17 +495,42 @@ @return flag indicating an applied fix (boolean) and a message for the fix (string) """ - line = line - 1 - pos = pos - 1 - while self.__source[line][pos] in [" ", "\t"]: - self.__source[line] = self.__source[line][:pos] + \ - self.__source[line][pos + 1:] - return (True, self.trUtf8("Superfluous whitespace removed.")) + if apply: + line = line - 1 + text = self.__source[line] + if not text.lstrip().startswith("import"): + return (False, "") + + # pep8 (1.3.1) reports false positive if there is an import + # statement followed by a semicolon and some unrelated + # statement with commas in it. + if ';' in text: + return (False, "") + + newText = text[:pos].rstrip("\t ,") + self.__getEol() + \ + self.__getIndent(text) + "import " + text[pos:].lstrip("\t ,") + self.__source[line] = newText + else: + self.__stack.append((code, line, pos)) + return (True, self.trUtf8("Imports were put on separate lines.")) - def __fixWhitespaceBefore(self, code, line, pos, apply=False): + def __fixE502(self, code, line, pos): """ - Private method to fix superfluous whitespace before '}])', - ',;:' and '(['. + Private method to fix redundant backslash within brackets (E502). + + @param code code of the issue (string) + @param line line number of the issue (integer) + @param pos position inside line (integer) + @return flag indicating an applied fix (boolean) and a message for + the fix (string) + """ + self.__source[line - 1] = self.__source[line - 1].rstrip("\n\r \t\\") + \ + self.__getEol() + return (True, self.trUtf8("Redundant backslash in brackets removed.")) + + def __fixE701(self, code, line, pos, apply=False): + """ + Private method to fix colon-separated compund statements (E701). @param code code of the issue (string) @param line line number of the issue (integer) @@ -370,35 +540,23 @@ @return flag indicating an applied fix (boolean) and a message for the fix (string) """ - line = line - 1 - pos = pos - 1 - while self.__source[line][pos] in [" ", "\t"]: - self.__source[line] = self.__source[line][:pos] + \ - self.__source[line][pos + 1:] - pos -= 1 - return (True, self.trUtf8("Superfluous whitespace removed.")) + if apply: + line = line - 1 + text = self.__source[line] + pos = pos + 1 + + newText = text[:pos] + self.__getEol() + self.__getIndent(text) + \ + self.__indentWord + text[pos:].lstrip("\n\r \t\\") + \ + self.__getEol() + self.__source[line] = newText + else: + self.__stack.append((code, line, pos)) + return (True, self.trUtf8("Compound statement corrected.")) - def __fixMissingWhitespaceAfter(self, code, line, pos, apply=False): + def __fixE702(self, code, line, pos, apply=False): """ - Private method to fix missing whitespace after ',;:'. - - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) - @return flag indicating an applied fix (boolean) and a message for - the fix (string) - """ - line = line - 1 - self.__source[line] = self.__source[line][:pos] + \ - " " + \ - self.__source[line][pos:] - return (True, self.trUtf8("Missing whitespace added.")) - - def __fixWhitespaceAroundOperator(self, code, line, pos, apply=False): - """ - Private method to fix extraneous whitespace around operator. + Private method to fix semicolon-separated compound statements + (E702, E703). @param code code of the issue (string) @param line line number of the issue (integer) @@ -408,99 +566,305 @@ @return flag indicating an applied fix (boolean) and a message for the fix (string) """ - line = line - 1 - while self.__source[line][pos - 1] in [" ", "\t"]: - self.__source[line] = self.__source[line][:pos - 1] + \ - self.__source[line][pos:] - pos -= 1 - return (True, self.trUtf8("Extraneous whitespace removed.")) + if apply: + line = line - 1 + text = self.__source[line] + + if text.rstrip().endswith("\\"): + # normalize '1; \\\n2' into '1; 2' + self.__source[line] = text.rstrip("\n\r \t\\") + self.__source[line + 1] = self.__source[line + 1].lstrip() + elif text.rstrip().endswith(";"): + self.__source[line] = text.rstrip("\n\r \t;") + self.__getEol() + else: + first = text[:pos].rstrip("\n\r \t;") + self.__getEol() + second = text[pos:].lstrip("\n\r \t;") + self.__source[line] = first + self.__getIndent(text) + second + else: + self.__stack.append((code, line, pos)) + return (True, self.trUtf8("Compound statement corrected.")) - def __fixMissingWhitespaceAroundOperator(self, code, line, pos, - apply=False): + def __fixE711(self, code, line, pos): """ - Private method to fix missing whitespace after ',;:'. + Private method to fix comparison with None (E711, E712). @param code code of the issue (string) @param line line number of the issue (integer) @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) - @return flag indicating an applied fix (boolean) and a message for - the fix (string) - """ - line = line - 1 - pos = pos - 1 - self.__source[line] = self.__source[line][:pos] + \ - " " + \ - self.__source[line][pos:] - return (True, self.trUtf8("Missing whitespace added.")) - - def __fixWhitespaceAroundEquals(self, code, line, pos, apply=False): - """ - Private method to fix extraneous whitespace around keyword and - default parameter equals. - - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) @return flag indicating an applied fix (boolean) and a message for the fix (string) """ line = line - 1 - if self.__source[line][pos + 1] == " ": - self.__source[line] = self.__source[line][:pos + 1] + \ - self.__source[line][pos + 2:] - if self.__source[line][pos - 1] == " ": - self.__source[line] = self.__source[line][:pos - 1] + \ - self.__source[line][pos:] - return (True, self.trUtf8("Extraneous whitespace removed.")) + text = self.__source[line] + + rightPos = pos + 2 + if rightPos >= len(text): + return (False, "") + + left = text[:pos].rstrip() + center = text[pos:rightPos] + right = text[rightPos:].lstrip() + + if not right.startswith(("None", "True", "False")): + return (False, "") + + if center.strip() == "==": + center = "is" + elif center.strip() == "!=": + center = "is not" + else: + return (False, "") + + self.__source[line] = " ".join([left, center, right]) + return (True, self.trUtf8("Comparison to None/True/False corrected.")) + + def __fixW291(self, code, line, pos): + """ + Private method to fix trailing whitespace (W291, W293). + + @param code code of the issue (string) + @param line line number of the issue (integer) + @param pos position inside line (integer) + @return flag indicating an applied fix (boolean) and a message for + the fix (string) + """ + self.__source[line - 1] = re.sub(r'[\t ]+(\r?)$', r"\1", + self.__source[line - 1]) + return (True, self.trUtf8("Whitespace stripped from end of line.")) - def __fixWhitespaceBeforeInline(self, code, line, pos, apply=False): + def __fixW292(self, code, line, pos): + """ + Private method to fix a missing newline at the end of file (W292). + + @param code code of the issue (string) + @param line line number of the issue (integer) + @param pos position inside line (integer) + @return flag indicating an applied fix (boolean) and a message for + the fix (string) + """ + self.__source[line - 1] += self.__getEol() + return (True, self.trUtf8("newline added to end of file.")) + + def __fixW391(self, code, line, pos): """ - Private method to fix missing whitespace before inline comment. + Private method to fix trailing blank lines (W391). + + @param code code of the issue (string) + @param line line number of the issue (integer) + @param pos position inside line (integer) + @return flag indicating an applied fix (boolean) and a message for + the fix (string) + """ + index = line - 1 + while index: + if self.__source[index].strip() == "": + del self.__source[index] + index -= 1 + else: + break + return (True, self.trUtf8( + "Superfluous trailing blank lines removed from end of file.")) + + def __fixW603(self, code, line, pos): + """ + Private method to fix the not equal notation (W603). @param code code of the issue (string) @param line line number of the issue (integer) @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) @return flag indicating an applied fix (boolean) and a message for the fix (string) """ - line = line - 1 - pos = pos - 1 - if self.__source[line][pos] == " ": - count = 1 - else: - count = 2 - self.__source[line] = self.__source[line][:pos] + \ - count * " " + \ - self.__source[line][pos:] - return (True, self.trUtf8("Missing whitespace added.")) + self.__source[line - 1] = self.__source[line - 1].replace("<>", "!=") + return (True, self.trUtf8("'<>' replaced by '!='.")) + + +class Pep8Reindenter(object): + """ + Class to reindent badly-indented code to uniformly use four-space indentation. + + Released to the public domain, by Tim Peters, 03 October 2000. + """ + def __init__(self, sourceLines): + """ + Constructor + + @param sourceLines list of source lines including eol marker + (list of string) + """ + # Raw file lines. + self.raw = sourceLines + self.after = [] + + # File lines, rstripped & tab-expanded. Dummy at start is so + # that we can use tokenize's 1-based line numbering easily. + # Note that a line is all-blank iff it's "\n". + self.lines = [line.rstrip().expandtabs() + "\n" + for line in self.raw] + self.lines.insert(0, None) + self.index = 1 # index into self.lines of next line + + # List of (lineno, indentlevel) pairs, one for each stmt and + # comment line. indentlevel is -1 for comment lines, as a + # signal that tokenize doesn't know what to do about them; + # indeed, they're our headache! + self.stats = [] - def __fixWhitespaceAfterInline(self, code, line, pos, apply=False): + def run(self): + """ + Public method to run the re-indenter. """ - Private method to fix whitespace after inline comment. + try: + stats = self.__genStats(tokenize.generate_tokens(self.getline)) + except (SyntaxError, tokenize.TokenError): + return False - @param code code of the issue (string) - @param line line number of the issue (integer) - @param pos position inside line (integer) - @keyparam apply flag indicating, that the fix should be applied - (boolean) - @return flag indicating an applied fix (boolean) and a message for - the fix (string) + # Remove trailing empty lines. + lines = self.lines + while lines and lines[-1] == "\n": + lines.pop() + # Sentinel. + stats.append((len(lines), 0)) + # Map count of leading spaces to # we want. + have2want = {} + # Program after transformation. + after = self.after = [] + # Copy over initial empty lines -- there's nothing to do until + # we see a line with *something* on it. + i = stats[0][0] + after.extend(lines[1:i]) + for i in range(len(stats)-1): + thisstmt, thislevel = stats[i] + nextstmt = stats[i+1][0] + have = self.__getlspace(lines[thisstmt]) + want = thislevel * 4 + if want < 0: + # A comment line. + if have: + # An indented comment line. If we saw the same + # indentation before, reuse what it most recently + # mapped to. + want = have2want.get(have, -1) + if want < 0: + # Then it probably belongs to the next real stmt. + for j in range(i + 1, len(stats) - 1): + jline, jlevel = stats[j] + if jlevel >= 0: + if have == self.__getlspace(lines[jline]): + want = jlevel * 4 + break + if want < 0: # Maybe it's a hanging + # comment like this one, + # in which case we should shift it like its base + # line got shifted. + for j in range(i - 1, -1, -1): + jline, jlevel = stats[j] + if jlevel >= 0: + want = have + self.__getlspace(after[jline-1]) - \ + self.__getlspace(lines[jline]) + break + if want < 0: + # Still no luck -- leave it alone. + want = have + else: + want = 0 + assert want >= 0 + have2want[have] = want + diff = want - have + if diff == 0 or have == 0: + after.extend(lines[thisstmt:nextstmt]) + else: + for line in lines[thisstmt:nextstmt]: + if diff > 0: + if line == "\n": + after.append(line) + else: + after.append(" " * diff + line) + else: + remove = min(self.__getlspace(line), -diff) + after.append(line[remove:]) + return self.raw != self.after + + def fixedLine(self, line): + """ + Public method to get a fixed line. + + @param line number of the line to retrieve (integer) + @return fixed line (string) """ - line = line - 1 - if self.__source[line][pos] == " ": - pos += 1 - while self.__source[line][pos] == " ": - self.__source[line] = self.__source[line][:pos] + \ - self.__source[line][pos + 1:] + if line < len(self.after): + return self.after[line] + + def getline(self): + """ + Public method to get a line of text for tokenize. + + @return line of text (string) + """ + if self.index >= len(self.lines): + line = "" else: - self.__source[line] = self.__source[line][:pos] + \ - " " + \ - self.__source[line][pos:] - return (True, self.trUtf8( - "Whitespace after inline comment sign corrected.")) + line = self.lines[self.index] + self.index += 1 + return line + + def __genStats(self, tokens): + """ + Private method to generate the re-indent statistics. + + @param tokens tokens generator (tokenize._tokenize) + """ + find_stmt = True # next token begins a fresh stmt? + level = 0 # current indent level + stats = [] + + for t in tokens: + token_type = t[0] + sline = t[2][0] + line = t[4] + + if token_type == tokenize.NEWLINE: + # A program statement, or ENDMARKER, will eventually follow, + # after some (possibly empty) run of tokens of the form + # (NL | COMMENT)* (INDENT | DEDENT+)? + self.find_stmt = True + + elif token_type == tokenize.INDENT: + find_stmt = True + level += 1 + + elif token_type == tokenize.DEDENT: + find_stmt = True + level -= 1 + + elif token_type == tokenize.COMMENT: + if find_stmt: + stats.append((sline, -1)) + # but we're still looking for a new stmt, so leave + # find_stmt alone + + elif token_type == tokenize.NL: + pass + + elif find_stmt: + # This is the first "real token" following a NEWLINE, so it + # must be the first token of the next program statement, or an + # ENDMARKER. + find_stmt = False + if line: # not endmarker + stats.append((sline, level)) + + return stats + + def __getlspace(self, line): + """ + Private method to count number of leading blanks. + + @param line line to check (string) + @return number of leading blanks (integer) + """ + i = 0 + n = len(line) + while i < n and line[i] == " ": + i += 1 + return i
--- a/i18n/eric5_cs.ts Sat Aug 24 15:05:05 2013 +0200 +++ b/i18n/eric5_cs.ts Sun Aug 25 19:56:37 2013 +0200 @@ -33294,57 +33294,57 @@ <context> <name>Pep8Fixer</name> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source>Fix PEP 8 issues</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source><p>Could not save the file <b>{0}</b>. Skipping it.</p><p>Reason: {1}</p></source> <translation type="unfinished"><p>Nelze uložit do souboru <b>{0}</b>. Přeskočeno.</p><p>Důvod: {1}</p></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="172"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="250"/> <source>Tab converted to 4 spaces.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="186"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="633"/> <source>Whitespace stripped from end of line.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="199"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="646"/> <source>newline added to end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="218"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="665"/> <source>Superfluous trailing blank lines removed from end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="232"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="679"/> <source>'<>' replaced by '!='.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="257"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="483"/> <source>Superfluous blank lines after function decorator removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="282"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> <source>Superfluous blank lines removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="300"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="395"/> <source>One blank line inserted.</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="334"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="429"/> <source>%n blank line(s) inserted.</source> <translation type="unfinished"> <numerusform></numerusform> @@ -33353,7 +33353,7 @@ </translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="336"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="431"/> <source>%n superfluous lines removed</source> <translation type="unfinished"> <numerusform></numerusform> @@ -33362,23 +33362,53 @@ </translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="379"/> - <source>Superfluous whitespace removed.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="481"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="324"/> <source>Missing whitespace added.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="358"/> <source>Extraneous whitespace removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="505"/> - <source>Whitespace after inline comment sign corrected.</source> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="252"/> + <source>Indentation adjusted to be a multiple of four.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="255"/> + <source>Fix for {0} failed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="297"/> + <source>Extraneous whitespace cannot be removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="377"/> + <source>Whitespace around comment sign corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="515"/> + <source>Imports were put on separate lines.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="529"/> + <source>Redundant backslash in brackets removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="585"/> + <source>Compound statement corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="619"/> + <source>Comparison to None/True/False corrected.</source> <translation type="unfinished"></translation> </message> </context>
--- a/i18n/eric5_de.ts Sat Aug 24 15:05:05 2013 +0200 +++ b/i18n/eric5_de.ts Sun Aug 25 19:56:37 2013 +0200 @@ -31940,57 +31940,57 @@ <context> <name>Pep8Fixer</name> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source>Fix PEP 8 issues</source> <translation>PEP 8-Probleme beheben</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source><p>Could not save the file <b>{0}</b>. Skipping it.</p><p>Reason: {1}</p></source> <translation><p>Die Datei <b>{0}</b> konnte nicht gespeichert werden. Überspringe sie.</p><p>Ursache: {1}</p></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="172"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="250"/> <source>Tab converted to 4 spaces.</source> <translation>Tabulator in 4 Leerzeichen gewandelt.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="186"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="633"/> <source>Whitespace stripped from end of line.</source> <translation>Leerzeichen am Zeilenende entfernt.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="199"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="646"/> <source>newline added to end of file.</source> <translation>Zeilenvorschub am Dateiende angefügt.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="218"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="665"/> <source>Superfluous trailing blank lines removed from end of file.</source> <translation>Überflüssige Leerzeilen am Dateiende gelöscht.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="232"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="679"/> <source>'<>' replaced by '!='.</source> <translation>„<>“ durch „!=“ ersetzt.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="257"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="483"/> <source>Superfluous blank lines after function decorator removed.</source> <translation>Überflüssige Leerzeilen nach Funktionsdekorator gelöscht.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="282"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> <source>Superfluous blank lines removed.</source> <translation>Überflüssige Leerzeilen gelöscht.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="300"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="395"/> <source>One blank line inserted.</source> <translation>Eine Leerzeile eingefügt.</translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="334"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="429"/> <source>%n blank line(s) inserted.</source> <translation> <numerusform>%n Leerzeile eingefügt.</numerusform> @@ -31998,7 +31998,7 @@ </translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="336"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="431"/> <source>%n superfluous lines removed</source> <translation> <numerusform>%n überflüssige Zeile gelöscht</numerusform> @@ -32006,24 +32006,54 @@ </translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="379"/> - <source>Superfluous whitespace removed.</source> - <translation>Überflüssige Leerzeichen entfernt.</translation> - </message> - <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="481"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="324"/> <source>Missing whitespace added.</source> <translation>Fehlende Leerzeichen eingefügt.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="358"/> <source>Extraneous whitespace removed.</source> <translation>Überzählige Leerzeichen gelöscht.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="505"/> - <source>Whitespace after inline comment sign corrected.</source> - <translation>Leerzeichen nach Inline Kommentarzeichen korrigiert.</translation> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="252"/> + <source>Indentation adjusted to be a multiple of four.</source> + <translation>Einrückung auf ein Vielfaches von vier korrigiert.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="255"/> + <source>Fix for {0} failed.</source> + <translation>Fix für {0} ist fehlgeschlagen.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="297"/> + <source>Extraneous whitespace cannot be removed.</source> + <translation>Irrelevante Leerzeichen können nicht entfernt werden.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="377"/> + <source>Whitespace around comment sign corrected.</source> + <translation>Leerzeichen um Kommentarzeichen korrigiert.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="515"/> + <source>Imports were put on separate lines.</source> + <translation>Imports wurden auf separate Zeilen verteilt.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="529"/> + <source>Redundant backslash in brackets removed.</source> + <translation>Redundante Backslashes in Klammern entfernt.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="585"/> + <source>Compound statement corrected.</source> + <translation>Compund Statement korrigiert.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="619"/> + <source>Comparison to None/True/False corrected.</source> + <translation>Vergleich mit None/True/False korrigiert.</translation> </message> </context> <context>
--- a/i18n/eric5_en.ts Sat Aug 24 15:05:05 2013 +0200 +++ b/i18n/eric5_en.ts Sun Aug 25 19:56:37 2013 +0200 @@ -31779,57 +31779,57 @@ <context> <name>Pep8Fixer</name> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source>Fix PEP 8 issues</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source><p>Could not save the file <b>{0}</b>. Skipping it.</p><p>Reason: {1}</p></source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="172"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="250"/> <source>Tab converted to 4 spaces.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="186"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="633"/> <source>Whitespace stripped from end of line.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="199"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="646"/> <source>newline added to end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="218"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="665"/> <source>Superfluous trailing blank lines removed from end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="232"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="679"/> <source>'<>' replaced by '!='.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="257"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="483"/> <source>Superfluous blank lines after function decorator removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="282"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> <source>Superfluous blank lines removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="300"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="395"/> <source>One blank line inserted.</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="334"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="429"/> <source>%n blank line(s) inserted.</source> <translation> <numerusform>%n blank line inserted.</numerusform> @@ -31837,7 +31837,7 @@ </translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="336"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="431"/> <source>%n superfluous lines removed</source> <translation> <numerusform>%n superfluous line removed</numerusform> @@ -31845,23 +31845,53 @@ </translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="379"/> - <source>Superfluous whitespace removed.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="481"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="324"/> <source>Missing whitespace added.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="358"/> <source>Extraneous whitespace removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="505"/> - <source>Whitespace after inline comment sign corrected.</source> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="252"/> + <source>Indentation adjusted to be a multiple of four.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="255"/> + <source>Fix for {0} failed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="297"/> + <source>Extraneous whitespace cannot be removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="377"/> + <source>Whitespace around comment sign corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="515"/> + <source>Imports were put on separate lines.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="529"/> + <source>Redundant backslash in brackets removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="585"/> + <source>Compound statement corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="619"/> + <source>Comparison to None/True/False corrected.</source> <translation type="unfinished"></translation> </message> </context>
--- a/i18n/eric5_es.ts Sat Aug 24 15:05:05 2013 +0200 +++ b/i18n/eric5_es.ts Sun Aug 25 19:56:37 2013 +0200 @@ -31942,57 +31942,57 @@ <context> <name>Pep8Fixer</name> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source>Fix PEP 8 issues</source> <translation>Arreglar problemas de PEP 8</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source><p>Could not save the file <b>{0}</b>. Skipping it.</p><p>Reason: {1}</p></source> <translation><p>No se pudo guardar el archivo <b>{0}</b>. Omitiéndolo.</p><p>Razón: {1}</p></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="172"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="250"/> <source>Tab converted to 4 spaces.</source> <translation>Tabulador convertido a 4 espacios.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="186"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="633"/> <source>Whitespace stripped from end of line.</source> <translation>Espacio eliminado del final de la línea.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="199"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="646"/> <source>newline added to end of file.</source> <translation>Carácter de nueva línea añadido al final del archivo.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="218"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="665"/> <source>Superfluous trailing blank lines removed from end of file.</source> <translation>Eliminadas líneas en blanco sobrantes despues de final de archivo.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="232"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="679"/> <source>'<>' replaced by '!='.</source> <translation>'<>' reemplazado por '!='.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="257"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="483"/> <source>Superfluous blank lines after function decorator removed.</source> <translation>Eliminadas líneas en blanco sobrantes después de decorador de función.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="282"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> <source>Superfluous blank lines removed.</source> <translation>Eliminadas líneas en blanco sobrantes.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="300"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="395"/> <source>One blank line inserted.</source> <translation>Insertada una línea en blanco.</translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="334"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="429"/> <source>%n blank line(s) inserted.</source> <translation> <numerusform>Insertada %n línea en blanco.</numerusform> @@ -32000,7 +32000,7 @@ </translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="336"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="431"/> <source>%n superfluous lines removed</source> <translation> <numerusform>Eliminada %n línea en blanco sobrante</numerusform> @@ -32010,22 +32010,62 @@ <message> <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="379"/> <source>Superfluous whitespace removed.</source> - <translation>Eliminadas espacio en blanco sobrante.</translation> - </message> - <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="481"/> + <translation type="obsolete">Eliminadas espacio en blanco sobrante.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="324"/> <source>Missing whitespace added.</source> <translation>Añadido espacio en blanco que faltaba.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="358"/> <source>Extraneous whitespace removed.</source> <translation>Eliminado espacio en blanco extraño.</translation> </message> <message> <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="505"/> <source>Whitespace after inline comment sign corrected.</source> - <translation>Corregido espacio en blanco despues de signo de comentario inline.</translation> + <translation type="obsolete">Corregido espacio en blanco despues de signo de comentario inline.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="252"/> + <source>Indentation adjusted to be a multiple of four.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="255"/> + <source>Fix for {0} failed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="297"/> + <source>Extraneous whitespace cannot be removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="377"/> + <source>Whitespace around comment sign corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="515"/> + <source>Imports were put on separate lines.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="529"/> + <source>Redundant backslash in brackets removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="585"/> + <source>Compound statement corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="619"/> + <source>Comparison to None/True/False corrected.</source> + <translation type="unfinished"></translation> </message> </context> <context>
--- a/i18n/eric5_fr.ts Sat Aug 24 15:05:05 2013 +0200 +++ b/i18n/eric5_fr.ts Sun Aug 25 19:56:37 2013 +0200 @@ -34531,57 +34531,57 @@ <context> <name>Pep8Fixer</name> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source>Fix PEP 8 issues</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source><p>Could not save the file <b>{0}</b>. Skipping it.</p><p>Reason: {1}</p></source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="172"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="250"/> <source>Tab converted to 4 spaces.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="186"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="633"/> <source>Whitespace stripped from end of line.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="199"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="646"/> <source>newline added to end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="218"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="665"/> <source>Superfluous trailing blank lines removed from end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="232"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="679"/> <source>'<>' replaced by '!='.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="257"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="483"/> <source>Superfluous blank lines after function decorator removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="282"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> <source>Superfluous blank lines removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="300"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="395"/> <source>One blank line inserted.</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="334"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="429"/> <source>%n blank line(s) inserted.</source> <translation type="unfinished"> <numerusform></numerusform> @@ -34589,7 +34589,7 @@ </translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="336"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="431"/> <source>%n superfluous lines removed</source> <translation type="unfinished"> <numerusform></numerusform> @@ -34597,23 +34597,53 @@ </translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="379"/> - <source>Superfluous whitespace removed.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="481"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="324"/> <source>Missing whitespace added.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="358"/> <source>Extraneous whitespace removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="505"/> - <source>Whitespace after inline comment sign corrected.</source> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="252"/> + <source>Indentation adjusted to be a multiple of four.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="255"/> + <source>Fix for {0} failed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="297"/> + <source>Extraneous whitespace cannot be removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="377"/> + <source>Whitespace around comment sign corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="515"/> + <source>Imports were put on separate lines.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="529"/> + <source>Redundant backslash in brackets removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="585"/> + <source>Compound statement corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="619"/> + <source>Comparison to None/True/False corrected.</source> <translation type="unfinished"></translation> </message> </context>
--- a/i18n/eric5_it.ts Sat Aug 24 15:05:05 2013 +0200 +++ b/i18n/eric5_it.ts Sun Aug 25 19:56:37 2013 +0200 @@ -33073,57 +33073,57 @@ <context> <name>Pep8Fixer</name> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source>Fix PEP 8 issues</source> <translation>Correggi problemi PEP 8</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source><p>Could not save the file <b>{0}</b>. Skipping it.</p><p>Reason: {1}</p></source> <translation><p>Non posso salvare il file<b>{0}</b>. Lo salto.</p><p>Motivo:{1}</p></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="172"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="250"/> <source>Tab converted to 4 spaces.</source> <translation>Converti Tab a 4 spazi.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="186"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="633"/> <source>Whitespace stripped from end of line.</source> <translation>Elimina gli spazi alla fine della linea.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="199"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="646"/> <source>newline added to end of file.</source> <translation>aggiungi a capo alla fine del file.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="218"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="665"/> <source>Superfluous trailing blank lines removed from end of file.</source> <translation>Linee bianche superflue eliminate dalla fine del file.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="232"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="679"/> <source>'<>' replaced by '!='.</source> <translation>'<>' sostituito da '!='.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="257"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="483"/> <source>Superfluous blank lines after function decorator removed.</source> <translation>Linee bianche superflue eliminate dopo a dichiarazione della funzione.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="282"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> <source>Superfluous blank lines removed.</source> <translation>Linee bianche superflue eliminate.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="300"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="395"/> <source>One blank line inserted.</source> <translation>Una linea vuota inserita.</translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="334"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="429"/> <source>%n blank line(s) inserted.</source> <translation> <numerusform>%n linea vuota inserita.</numerusform> @@ -33131,7 +33131,7 @@ </translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="336"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="431"/> <source>%n superfluous lines removed</source> <translation> <numerusform>%n linea superflua eliminata</numerusform> @@ -33141,22 +33141,62 @@ <message> <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="379"/> <source>Superfluous whitespace removed.</source> - <translation>Spazi superflui eliminati.</translation> - </message> - <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="481"/> + <translation type="obsolete">Spazi superflui eliminati.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="324"/> <source>Missing whitespace added.</source> <translation>Spazi mancanti aggiunti.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="358"/> <source>Extraneous whitespace removed.</source> <translation>Spazio non pertinente eliminato.</translation> </message> <message> <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="505"/> <source>Whitespace after inline comment sign corrected.</source> - <translation>Spazi dopo il carattere di commento inline corretti.</translation> + <translation type="obsolete">Spazi dopo il carattere di commento inline corretti.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="252"/> + <source>Indentation adjusted to be a multiple of four.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="255"/> + <source>Fix for {0} failed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="297"/> + <source>Extraneous whitespace cannot be removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="377"/> + <source>Whitespace around comment sign corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="515"/> + <source>Imports were put on separate lines.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="529"/> + <source>Redundant backslash in brackets removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="585"/> + <source>Compound statement corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="619"/> + <source>Comparison to None/True/False corrected.</source> + <translation type="unfinished"></translation> </message> </context> <context>
--- a/i18n/eric5_ru.ts Sat Aug 24 15:05:05 2013 +0200 +++ b/i18n/eric5_ru.ts Sun Aug 25 19:56:37 2013 +0200 @@ -33226,57 +33226,57 @@ <context> <name>Pep8Fixer</name> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source>Fix PEP 8 issues</source> <translation>Проверка PEP 8</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source><p>Could not save the file <b>{0}</b>. Skipping it.</p><p>Reason: {1}</p></source> <translation><p>Не могу сохранить файл <b>{0}</b>. Пропускаю.</p><p>Причина: {1}</p></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="172"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="250"/> <source>Tab converted to 4 spaces.</source> <translation>Символы табуляции заменены на 4 пробела.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="186"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="633"/> <source>Whitespace stripped from end of line.</source> <translation>Завершающие пробелы обрезаны.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="199"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="646"/> <source>newline added to end of file.</source> <translation>Перевод строки добавлен в конец файла.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="218"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="665"/> <source>Superfluous trailing blank lines removed from end of file.</source> <translation>Удалены пустые строчки в конце файла.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="232"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="679"/> <source>'<>' replaced by '!='.</source> <translation>'<>' заменен на '!='.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="257"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="483"/> <source>Superfluous blank lines after function decorator removed.</source> <translation>Удалены пустые строчки после декоратора функции.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="282"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> <source>Superfluous blank lines removed.</source> <translation>Удалены излишние пустые строчки.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="300"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="395"/> <source>One blank line inserted.</source> <translation>Добавлена одна пустая строка.</translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="334"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="429"/> <source>%n blank line(s) inserted.</source> <translation> <numerusform>Добавлена %n пустая строка.</numerusform> @@ -33285,7 +33285,7 @@ </translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="336"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="431"/> <source>%n superfluous lines removed</source> <translation> <numerusform>Удалена %n излишняя пустая строчка</numerusform> @@ -33296,22 +33296,62 @@ <message> <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="379"/> <source>Superfluous whitespace removed.</source> - <translation>Удалены излишние пробелы.</translation> - </message> - <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="481"/> + <translation type="obsolete">Удалены излишние пробелы.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="324"/> <source>Missing whitespace added.</source> <translation>Добавлены недостающие пробелы.</translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="358"/> <source>Extraneous whitespace removed.</source> <translation>Удалены излишние пробелы.</translation> </message> <message> <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="505"/> <source>Whitespace after inline comment sign corrected.</source> - <translation>Исправлено количество пробелов после символа комментариев.</translation> + <translation type="obsolete">Исправлено количество пробелов после символа комментариев.</translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="252"/> + <source>Indentation adjusted to be a multiple of four.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="255"/> + <source>Fix for {0} failed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="297"/> + <source>Extraneous whitespace cannot be removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="377"/> + <source>Whitespace around comment sign corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="515"/> + <source>Imports were put on separate lines.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="529"/> + <source>Redundant backslash in brackets removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="585"/> + <source>Compound statement corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="619"/> + <source>Comparison to None/True/False corrected.</source> + <translation type="unfinished"></translation> </message> </context> <context>
--- a/i18n/eric5_tr.ts Sat Aug 24 15:05:05 2013 +0200 +++ b/i18n/eric5_tr.ts Sun Aug 25 19:56:37 2013 +0200 @@ -33129,57 +33129,57 @@ <context> <name>Pep8Fixer</name> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source>Fix PEP 8 issues</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source><p>Could not save the file <b>{0}</b>. Skipping it.</p><p>Reason: {1}</p></source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="172"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="250"/> <source>Tab converted to 4 spaces.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="186"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="633"/> <source>Whitespace stripped from end of line.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="199"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="646"/> <source>newline added to end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="218"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="665"/> <source>Superfluous trailing blank lines removed from end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="232"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="679"/> <source>'<>' replaced by '!='.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="257"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="483"/> <source>Superfluous blank lines after function decorator removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="282"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> <source>Superfluous blank lines removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="300"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="395"/> <source>One blank line inserted.</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="334"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="429"/> <source>%n blank line(s) inserted.</source> <translation type="unfinished"> <numerusform></numerusform> @@ -33187,7 +33187,7 @@ </translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="336"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="431"/> <source>%n superfluous lines removed</source> <translation type="unfinished"> <numerusform></numerusform> @@ -33195,23 +33195,53 @@ </translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="379"/> - <source>Superfluous whitespace removed.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="481"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="324"/> <source>Missing whitespace added.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="358"/> <source>Extraneous whitespace removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="505"/> - <source>Whitespace after inline comment sign corrected.</source> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="252"/> + <source>Indentation adjusted to be a multiple of four.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="255"/> + <source>Fix for {0} failed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="297"/> + <source>Extraneous whitespace cannot be removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="377"/> + <source>Whitespace around comment sign corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="515"/> + <source>Imports were put on separate lines.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="529"/> + <source>Redundant backslash in brackets removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="585"/> + <source>Compound statement corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="619"/> + <source>Comparison to None/True/False corrected.</source> <translation type="unfinished"></translation> </message> </context>
--- a/i18n/eric5_zh_CN.GB2312.ts Sat Aug 24 15:05:05 2013 +0200 +++ b/i18n/eric5_zh_CN.GB2312.ts Sun Aug 25 19:56:37 2013 +0200 @@ -34464,87 +34464,117 @@ <context> <name>Pep8Fixer</name> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source>Fix PEP 8 issues</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="102"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="130"/> <source><p>Could not save the file <b>{0}</b>. Skipping it.</p><p>Reason: {1}</p></source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="172"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="250"/> <source>Tab converted to 4 spaces.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="186"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="633"/> <source>Whitespace stripped from end of line.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="199"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="646"/> <source>newline added to end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="218"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="665"/> <source>Superfluous trailing blank lines removed from end of file.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="232"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="679"/> <source>'<>' replaced by '!='.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="257"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="483"/> <source>Superfluous blank lines after function decorator removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="282"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> <source>Superfluous blank lines removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="300"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="395"/> <source>One blank line inserted.</source> <translation type="unfinished"></translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="334"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="429"/> <source>%n blank line(s) inserted.</source> <translation type="unfinished"> <numerusform></numerusform> </translation> </message> <message numerus="yes"> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="336"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="431"/> <source>%n superfluous lines removed</source> <translation type="unfinished"> <numerusform></numerusform> </translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="379"/> - <source>Superfluous whitespace removed.</source> - <translation type="unfinished"></translation> - </message> - <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="481"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="324"/> <source>Missing whitespace added.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="458"/> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="358"/> <source>Extraneous whitespace removed.</source> <translation type="unfinished"></translation> </message> <message> - <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="505"/> - <source>Whitespace after inline comment sign corrected.</source> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="252"/> + <source>Indentation adjusted to be a multiple of four.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="255"/> + <source>Fix for {0} failed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="297"/> + <source>Extraneous whitespace cannot be removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="377"/> + <source>Whitespace around comment sign corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="515"/> + <source>Imports were put on separate lines.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="529"/> + <source>Redundant backslash in brackets removed.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="585"/> + <source>Compound statement corrected.</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="../Plugins/CheckerPlugins/Pep8/Pep8Fixer.py" line="619"/> + <source>Comparison to None/True/False corrected.</source> <translation type="unfinished"></translation> </message> </context>