--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Sat Apr 10 17:54:58 2021 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Sat Apr 10 18:31:17 2021 +0200 @@ -71,7 +71,7 @@ anything @type bool """ - super(CodeStyleFixer, self).__init__() + super().__init__() self.__filename = filename self.__origName = "" @@ -378,7 +378,7 @@ except (SyntaxError, tokenize.TokenError): return None - line = line - 1 + line -= 1 ls = None le = None for i in range(0, len(logical_start)): @@ -533,7 +533,7 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 + line -= 1 quotes = re.match(r"""\s*[ru]?('''|'|\")""", self.__source[line]).group(1) left, right = self.__source[line].split(quotes, 1) @@ -565,7 +565,7 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 + line -= 1 if code == "D112": insertChar = "r" else: @@ -600,7 +600,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 if not self.__source[line].lstrip().startswith( ('"""', 'r"""', 'u"""')): # only correctly formatted docstrings will be fixed @@ -643,7 +643,7 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 + line -= 1 newText = "" if ( self.__source[line].rstrip().endswith(('"""', "'''")) and @@ -694,7 +694,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 self.__source[line - 1] = "" # Blank line before function/method docstring removed. return (1, "FIXD141", [], 0) @@ -724,7 +724,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 self.__source[line] = self.__eol + self.__source[line] # Blank line inserted before class docstring. return (1, "FIXD142", [], 0) @@ -754,7 +754,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 self.__source[line] += self.__eol # Blank line inserted after class docstring. return (1, "FIXD143", [], 0) @@ -784,7 +784,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 if not self.__source[line].rstrip().endswith("."): # only correct summary lines can be fixed here return (0, "", 0) @@ -818,7 +818,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 self.__source[line] = self.__eol + self.__source[line] # Blank line inserted after last paragraph of docstring. return (1, "FIXD145", [], 0) @@ -848,7 +848,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 indent = self.__getIndent(self.__source[line]) source = self.__source[line].strip() if code == "D221": @@ -902,7 +902,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 self.__source[line - 1] = "" if code == "D242": # Blank line before class docstring removed. @@ -937,7 +937,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 self.__source[line + 1] = "" if code == "D243": # Blank line after class docstring removed. @@ -972,7 +972,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 self.__source[line - 1] = "" # Blank line after last paragraph removed. return (1, "FIXD247", [], 0) @@ -1079,7 +1079,7 @@ modified = self.__fixReindent(line, pos, logical) if not modified: # fall back to simple method - line = line - 1 + line -= 1 text = self.__source[line] indentation = self.__getIndent(text) self.__source[line] = ( @@ -1301,7 +1301,7 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 + line -= 1 text = self.__source[line] if '"""' in text or "'''" in text or text.rstrip().endswith('\\'): @@ -1333,7 +1333,7 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 + line -= 1 text = self.__source[line] if '"""' in text or "'''" in text or text.rstrip().endswith('\\'): @@ -1363,7 +1363,7 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 + line -= 1 text = self.__source[line] if '"""' in text or "'''" in text or text.rstrip().endswith('\\'): @@ -1408,8 +1408,8 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 - pos = pos + 1 + line -= 1 + pos += 1 self.__source[line] = ( self.__source[line][:pos] + " " + @@ -1436,7 +1436,7 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 + line -= 1 text = self.__source[line] # This is necessary since pycodestyle sometimes reports columns that @@ -1474,7 +1474,7 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 + line -= 1 text = self.__source[line] left = text[:pos].rstrip(' \t#') right = text[pos:].lstrip(' \t#') @@ -1600,7 +1600,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 text = self.__source[line] if not text.lstrip().startswith("import"): return (0, "", [], 0) @@ -1650,7 +1650,7 @@ self.__multilineStringLines() ) isDocString = line in docStringLines - line = line - 1 + line -= 1 text = self.__source[line] if line > 0: prevText = self.__source[line - 1] @@ -1725,9 +1725,9 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 text = self.__source[line] - pos = pos + 1 + pos += 1 newText = ( text[:pos] + @@ -1765,7 +1765,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 text = self.__source[line] if text.rstrip().endswith("\\"): @@ -1802,7 +1802,7 @@ message and an ID for a deferred fix @rtype tuple of (int, str, list or int, int) """ - line = line - 1 + line -= 1 text = self.__source[line] rightPos = pos + 2 @@ -1848,7 +1848,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 text = self.__source[line] if code == "N804": arg = "cls" @@ -1901,7 +1901,7 @@ @rtype tuple of (int, str, list or int, int) """ if apply: - line = line - 1 + line -= 1 text = self.__source[line] index = text.find("(") + 1 left = text[:index] @@ -1920,7 +1920,7 @@ self.__source[line] = newText else: # they are on the next line - line = line + 1 + line += 1 text = self.__source[line] indent = self.__getIndent(text) right = text.lstrip()