Sat, 21 Sep 2019 20:30:56 +0200
Continued to resolve code style issue M841.
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleAddBuiltinIgnoreDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleAddBuiltinIgnoreDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -12,8 +12,9 @@ from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog, QDialogButtonBox -from .Ui_CodeStyleAddBuiltinIgnoreDialog import \ +from .Ui_CodeStyleAddBuiltinIgnoreDialog import ( Ui_CodeStyleAddBuiltinIgnoreDialog +) class CodeStyleAddBuiltinIgnoreDialog(QDialog,
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleChecker.py Sat Sep 21 20:30:56 2019 +0200 @@ -121,8 +121,10 @@ """ if lineFlags: - if "__IGNORE_WARNING__" in lineFlags or \ - "noqa" in lineFlags: + if ( + "__IGNORE_WARNING__" in lineFlags or + "noqa" in lineFlags + ): # ignore all warning codes return True @@ -197,8 +199,9 @@ # Start worker processes for _ in range(NumberOfProcesses): - multiprocessing.Process(target=worker, args=(taskQueue, doneQueue))\ - .start() + multiprocessing.Process( + target=worker, args=(taskQueue, doneQueue) + ).start() # Get and send results endIndex = len(argumentsList) - initialTasks
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -13,8 +13,10 @@ from PyQt5.QtCore import pyqtSlot, Qt, QTimer from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QAbstractButton, \ - QDialogButtonBox, QApplication, QHeaderView, QListWidgetItem +from PyQt5.QtWidgets import ( + QDialog, QTreeWidgetItem, QAbstractButton, QDialogButtonBox, QApplication, + QHeaderView, QListWidgetItem +) from E5Gui.E5Application import e5App @@ -199,8 +201,10 @@ itm.setIcon(1, UI.PixmapCache.getIcon("syntaxError.png")) if fixed: itm.setIcon(0, UI.PixmapCache.getIcon("issueFixed.png")) - elif code in FixableCodeStyleIssues and not autofixing and \ - code not in self.__noFixCodesList: + elif ( + code in FixableCodeStyleIssues and not autofixing and + code not in self.__noFixCodesList + ): itm.setIcon(0, UI.PixmapCache.getIcon("issueFixable.png")) fixable = True @@ -301,8 +305,10 @@ self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) self.__data = self.__project.getData("CHECKERSPARMS", "Pep8Checker") - if self.__data is None or \ - len(self.__data) < 6: + if ( + self.__data is None or + len(self.__data) < 6 + ): # initialize the data structure self.__data = { "ExcludeFiles": "", @@ -336,8 +342,10 @@ self.__data["LineComplexityScore"] = 10 if "ValidEncodings" not in self.__data: self.__data["ValidEncodings"] = "latin-1, utf-8" - if "CopyrightMinFileSize" not in self.__data or \ - "CopyrightAuthor" not in self.__data: + if ( + "CopyrightMinFileSize" not in self.__data or + "CopyrightAuthor" not in self.__data + ): self.__data["CopyrightMinFileSize"] = 0 self.__data["CopyrightAuthor"] = "" if "FutureChecker" not in self.__data: @@ -437,9 +445,10 @@ filterList = [f.strip() for f in filterString.split(",") if f.strip()] for fileFilter in filterList: - self.files = \ - [f for f in self.files - if not fnmatch.fnmatch(f, fileFilter.strip())] + self.files = [ + f for f in self.files + if not fnmatch.fnmatch(f, fileFilter.strip()) + ] self.__errorItem = None self.__resetStatistics() @@ -457,11 +466,13 @@ repeatMessages = self.repeatCheckBox.isChecked() fixCodes = self.fixIssuesEdit.text() noFixCodes = self.noFixIssuesEdit.text() - self.__noFixCodesList = \ - [c.strip() for c in noFixCodes.split(",") if c.strip()] + self.__noFixCodesList = [ + c.strip() for c in noFixCodes.split(",") if c.strip() + ] fixIssues = self.fixIssuesCheckBox.isChecked() and repeatMessages - self.showIgnored = self.ignoredCheckBox.isChecked() and \ - repeatMessages + self.showIgnored = ( + self.ignoredCheckBox.isChecked() and repeatMessages + ) maxLineLength = self.lineLengthSpinBox.value() maxDocLineLength = self.docLineLengthSpinBox.value() blankLines = ( @@ -529,8 +540,7 @@ options = self.__options[:] flags = Utilities.extractFlags(source) if "noqa" in flags and isinstance(flags["noqa"], basestring): - excludeMessages = \ - options[0].strip().rstrip(",") + excludeMessages = options[0].strip().rstrip(",") if excludeMessages: excludeMessages += "," excludeMessages += flags["noqa"] @@ -1335,8 +1345,9 @@ """ Private slot to add a built-in assignment to be ignored. """ - from .CodeStyleAddBuiltinIgnoreDialog import \ + from .CodeStyleAddBuiltinIgnoreDialog import ( CodeStyleAddBuiltinIgnoreDialog + ) dlg = CodeStyleAddBuiltinIgnoreDialog(self) if dlg.exec_() == QDialog.Accepted: left, right = dlg.getData()
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py Sat Sep 21 20:30:56 2019 +0200 @@ -288,9 +288,11 @@ else: code = message.split(None, 1)[0].strip() - if line <= len(self.__source) and \ - self.__codeMatch(code) and \ - code in self.__fixes: + if ( + line <= len(self.__source) and + self.__codeMatch(code) and + code in self.__fixes + ): res = self.__fixes[code](code, line, pos) if res[0] == 1: self.__modified = True @@ -568,8 +570,11 @@ else: return (0, "", 0) - newText = self.__getIndent(self.__source[line]) + \ - insertChar + self.__source[line].lstrip() + newText = ( + self.__getIndent(self.__source[line]) + + insertChar + + self.__source[line].lstrip() + ) self.__source[line] = newText # Introductory quotes corrected to be {0}""" return (1, ('FD112', (insertChar,)), 0) @@ -596,8 +601,10 @@ # only correctly formatted docstrings will be fixed return (0, "", 0) - docstring = self.__source[line].rstrip() + \ + docstring = ( + self.__source[line].rstrip() + self.__source[line + 1].strip() + ) if docstring.endswith('"""'): docstring += self.__eol else: @@ -629,17 +636,25 @@ """ line = line - 1 newText = "" - if self.__source[line].rstrip().endswith(('"""', "'''")) and \ - self.__source[line].lstrip().startswith(('"""', 'r"""', 'u"""')): + if ( + self.__source[line].rstrip().endswith(('"""', "'''")) and + self.__source[line].lstrip().startswith(('"""', 'r"""', 'u"""')) + ): # it is a one-liner - newText = self.__source[line].rstrip()[:-3].rstrip() + "." + \ - self.__source[line].rstrip()[-3:] + self.__eol + newText = ( + self.__source[line].rstrip()[:-3].rstrip() + + "." + + self.__source[line].rstrip()[-3:] + + self.__eol + ) else: - if line < len(self.__source) - 1 and \ + if ( + line < len(self.__source) - 1 and (not self.__source[line + 1].strip() or self.__source[line + 1].lstrip().startswith("@") or (self.__source[line + 1].strip() in ('"""', "'''") and - not self.__source[line].lstrip().startswith("@"))): + not self.__source[line].lstrip().startswith("@"))) + ): newText = self.__source[line].rstrip() + "." + self.__eol if newText: @@ -812,8 +827,14 @@ else: # trailing first, second = source[:-3].strip(), source[-3:] - newText = indent + first + self.__eol + \ - indent + second + self.__eol + newText = ( + indent + + first + + self.__eol + + indent + + second + + self.__eol + ) self.__source[line] = newText if code == "D221": # Leading quotes put on separate line. @@ -1004,8 +1025,10 @@ line = line - 1 text = self.__source[line] indentation = self.__getIndent(text) - self.__source[line] = indentation + \ + self.__source[line] = ( + indentation + self.__indentWord + text.lstrip() + ) # Missing indentation of continuation line corrected. return (1, "FE122", 0) return (0, "", 0) @@ -1076,8 +1099,10 @@ if not modified: row = line - 1 text = self.__source[row] - self.__source[row] = self.__getIndent(text) + \ + self.__source[row] = ( + self.__getIndent(text) + self.__indentWord + text.lstrip() + ) # Indentation level changed. return (1, "FE125", 0) return (0, "", 0) @@ -1109,8 +1134,10 @@ logicalLines = logical[2] row = line - 1 text = self.__source[row] - newText = self.__getIndent(logicalLines[0]) + \ + newText = ( + self.__getIndent(logicalLines[0]) + self.__indentWord + text.lstrip() + ) if newText == text: # fall back to slower method changed = self.__fixReindent(line, pos, logical) @@ -1151,8 +1178,11 @@ newText = text if logicalLines[0].rstrip().endswith('\\'): - newText = self.__getIndent(logicalLines[0]) + \ - self.__indentWord + text.lstrip() + newText = ( + self.__getIndent(logicalLines[0]) + + self.__indentWord + + text.lstrip() + ) else: startIndex = None for symbol in '([{': @@ -1291,8 +1321,11 @@ """ line = line - 1 pos = pos + 1 - self.__source[line] = self.__source[line][:pos] + \ - " " + self.__source[line][pos:] + self.__source[line] = ( + self.__source[line][:pos] + + " " + + self.__source[line][pos:] + ) # Missing whitespace added. return (1, "FE231", 0) @@ -1323,8 +1356,6 @@ newText = text[:col].rstrip() + text[col:].lstrip() # There could be an escaped newline - # like '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() @@ -1471,8 +1502,13 @@ if ';' in text: return (0, "", 0) - newText = text[:pos].rstrip("\t ,") + self.__eol + \ - self.__getIndent(text) + "import " + text[pos:].lstrip("\t ,") + newText = ( + text[:pos].rstrip("\t ,") + + self.__eol + + self.__getIndent(text) + + "import " + + text[pos:].lstrip("\t ,") + ) self.__source[line] = newText # Imports were put on separate lines. return (1, "FE401", 0) @@ -1497,8 +1533,9 @@ fix (integer) """ if apply: - multilineStringLines, docStringLines = \ + multilineStringLines, docStringLines = ( self.__multilineStringLines() + ) isDocString = line in docStringLines line = line - 1 text = self.__source[line] @@ -1544,8 +1581,10 @@ a message for the fix (string) and an ID for a deferred fix (integer) """ - self.__source[line - 1] = \ - self.__source[line - 1].rstrip("\n\r \t\\") + self.__eol + self.__source[line - 1] = ( + self.__source[line - 1].rstrip("\n\r \t\\") + + self.__eol + ) # Redundant backslash in brackets removed. return (1, "FE502", 0) @@ -1569,9 +1608,14 @@ text = self.__source[line] pos = pos + 1 - newText = text[:pos] + self.__eol + self.__getIndent(text) + \ - self.__indentWord + text[pos:].lstrip("\n\r \t\\") + \ + newText = ( + text[:pos] + + self.__eol + + self.__getIndent(text) + + self.__indentWord + + text[pos:].lstrip("\n\r \t\\") + self.__eol + ) self.__source[line] = newText # Compound statement corrected. return (1, "FE701", 0) @@ -1679,8 +1723,14 @@ arg = "self" if text.rstrip().endswith("("): - newText = text + self.__getIndent(text) + \ - self.__indentWord + arg + "," + self.__eol + newText = ( + text + + self.__getIndent(text) + + self.__indentWord + + arg + + "," + + self.__eol + ) else: index = text.find("(") + 1 left = text[:index] @@ -1746,8 +1796,9 @@ right = right.lstrip(", ") if right.startswith("):"): # merge with previous line - self.__source[line - 1] = \ + self.__source[line - 1] = ( self.__source[line - 1].rstrip() + right + ) self.__source[line] = "" else: self.__source[line] = indent + right @@ -1918,10 +1969,11 @@ for j in range(i - 1, -1, -1): jline, jlevel = stats[j] if jlevel >= 0: - want = \ - have + \ - self.__getlspace(after[jline - 1]) - \ + want = ( + have + + self.__getlspace(after[jline - 1]) - self.__getlspace(lines[jline]) + ) break if want < 0: # Still no luck -- leave it alone. @@ -2212,8 +2264,9 @@ # pycodestyle. visual_indent = indent_chances.get(start[1]) last_indent = start - rel_indent[row] = \ + rel_indent[row] = ( pycodestyle.expand_indent(line) - indent_level + ) hang = rel_indent[row] - rel_indent[open_row] if token_type == tokenize.OP and text in ']})': @@ -2309,8 +2362,12 @@ return True, newText, "" elif '#' in self.__text: pos = self.__text.rfind("#") - newText = self.__text[:pos].rstrip() + self.__eol + \ - self.__getIndent(self.__text) + self.__text[pos:] + newText = ( + self.__text[:pos].rstrip() + + self.__eol + + self.__getIndent(self.__text) + + self.__text[pos:] + ) if newText == self.__text: return False, "", "" else: @@ -2332,18 +2389,30 @@ if self.__nextText.lstrip().startswith("@"): # eric doc comment # create a new line and indent it - newText = first + self.__eol + \ - self.__getIndent(first) + self.__indentWord + \ + newText = ( + first + + self.__eol + + self.__getIndent(first) + + self.__indentWord + second + ) newNext = "" else: newText = first + self.__eol - newNext = self.__getIndent(self.__nextText) + \ - second.rstrip() + " " + self.__nextText.lstrip() + newNext = ( + self.__getIndent(self.__nextText) + + second.rstrip() + + " " + + self.__nextText.lstrip() + ) else: # empty line, add a new line - newText = first + self.__eol + self.__getIndent(first) + \ + newText = ( + first + + self.__eol + + self.__getIndent(first) + second + ) newNext = "" return True, newText, newNext @@ -2359,8 +2428,12 @@ if source.rstrip().endswith("\\"): # just join the continuation line and let the next run # handle it once it tokenizes ok - newText = indent + source.rstrip()[:-1].rstrip() + " " + \ + newText = ( + indent + + source.rstrip()[:-1].rstrip() + + " " + self.__nextText.lstrip() + ) if indent: newNext = indent else: @@ -2442,9 +2515,11 @@ len(indentation) + 72) MIN_CHARACTER_REPEAT = 5 - if len(newText) - len(newText.rstrip(newText[-1])) >= \ - MIN_CHARACTER_REPEAT and \ - not newText[-1].isalnum(): + if ( + len(newText) - len(newText.rstrip(newText[-1])) >= + MIN_CHARACTER_REPEAT and + not newText[-1].isalnum() + ): # Trim comments that end with things like --------- return newText[:maxLength] + self.__eol elif isLast and re.match(r"\s*#+\s*\w+", newText): @@ -2504,13 +2579,21 @@ newText += self.__getIndent(newText) + second + self.__eol newNext = "" else: - newNext = self.__getIndent(newNext) + \ - second + " " + newNext.lstrip() + newNext = ( + self.__getIndent(newNext) + + second + + " " + + newNext.lstrip() + ) else: # empty line, add a new line newText = first + self.__eol - newNext = self.__getIndent(newNext) + \ - second + self.__eol + newNext.lstrip() + newNext = ( + self.__getIndent(newNext) + + second + + self.__eol + + newNext.lstrip() + ) return newText, newNext else: return None @@ -2672,8 +2755,10 @@ for ending in '([{': # Avoid lonely opening. They result in longer lines. - if currentLine.endswith(ending) and \ - len(currentLine.strip()) <= len(self.__indentWord): + if ( + currentLine.endswith(ending) and + len(currentLine.strip()) <= len(self.__indentWord) + ): rank += 100 if currentLine.endswith('%'):
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyleChecker.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyleChecker.py Sat Sep 21 20:30:56 2019 +0200 @@ -634,11 +634,13 @@ while True: start, end = None, None while not (kind == tokenize.NAME and value == 'def'): - kind, value, (line, char), _, _ = \ + kind, value, (line, char), _, _ = ( next(tokenGenerator) + ) start = line - 1, char - kind, value, (line, char), _, _ = \ + kind, value, (line, char), _, _ = ( self.__skipIndentedBlock(tokenGenerator) + ) end = line - 1, char startLine = classContext.start() + start[0] endLine = classContext.start() + end[0] @@ -646,11 +648,15 @@ self.__source[startLine:endLine], startLine, "def") if startLine > 0: - if self.__source[startLine - 1].strip() == \ - "@staticmethod": + if ( + self.__source[startLine - 1].strip() == + "@staticmethod" + ): context.setSpecial("staticmethod") - elif self.__source[startLine - 1].strip() == \ - "@classmethod": + elif ( + self.__source[startLine - 1].strip() == + "@classmethod" + ): context.setSpecial("classmethod") contexts.append(context) except StopIteration: @@ -703,8 +709,11 @@ not docstring.strip('\'"')): self.__error(context.start(), 0, "D101") - if self.__docType == "eric" and \ - docstring.strip('\'"').strip() == "Module documentation goes here.": + if ( + self.__docType == "eric" and + docstring.strip('\'"').strip() == + "Module documentation goes here." + ): self.__error(docstringContext.end(), 0, "D201") return @@ -734,9 +743,11 @@ not docstring.strip('\'"')): self.__error(context.start(), 0, code) - if self.__docType == "eric" and \ - docstring.strip('\'"').strip() == \ - "Function documentation goes here.": + if ( + self.__docType == "eric" and + docstring.strip('\'"').strip() == + "Function documentation goes here." + ): self.__error(docstringContext.end(), 0, "D202") return @@ -767,8 +778,10 @@ self.__error(context.start(), 0, code) return - if self.__docType == "eric" and \ - docstring.strip('\'"').strip() == "Class documentation goes here.": + if ( + self.__docType == "eric" and + docstring.strip('\'"').strip() == "Class documentation goes here." + ): self.__error(docstringContext.end(), 0, "D206") return @@ -814,8 +827,10 @@ return docstring = docstringContext.ssource().strip() - if not docstring.startswith('u"""') and \ - any(ord(char) > 127 for char in docstring): + if ( + not docstring.startswith('u"""') and + any(ord(char) > 127 for char in docstring) + ): self.__error(docstringContext.start(), 0, "D113") def __checkOneLiner(self, docstringContext, context): @@ -927,8 +942,10 @@ functionName = context.source()[0].lstrip().split()[1].split("(")[0] summary, lineNumber = self.__getSummaryLine(docstringContext) - if functionName + "(" in summary.replace(" ", "") and \ - not functionName + "()" in summary.replace(" ", ""): + if ( + functionName + "(" in summary.replace(" ", "") and + not functionName + "()" in summary.replace(" ", "") + ): # report only, if it is not an abbreviated form (i.e. function() ) self.__error(docstringContext.start() + lineNumber, 0, "D133") @@ -965,9 +982,11 @@ contextLines = context.source() cti = 0 - while cti < len(contextLines) and \ - not contextLines[cti].strip().startswith( - ('"""', 'r"""', 'u"""', "'''", "r'''", "u'''")): + while ( + cti < len(contextLines) and + not contextLines[cti].strip().startswith( + ('"""', 'r"""', 'u"""', "'''", "r'''", "u'''")) + ): cti += 1 if cti == len(contextLines): return @@ -988,9 +1007,11 @@ contextLines = context.source() cti = 0 - while cti < len(contextLines) and \ + while ( + cti < len(contextLines) and not contextLines[cti].strip().startswith( - ('"""', 'r"""', 'u"""', "'''", "r'''", "u'''")): + ('"""', 'r"""', 'u"""', "'''", "r'''", "u'''")) + ): cti += 1 if cti == len(contextLines): return @@ -1001,8 +1022,10 @@ # it is a multi line docstring cti += 1 - while cti < len(contextLines) and \ - not contextLines[cti].strip().endswith(('"""', "'''")): + while ( + cti < len(contextLines) and + not contextLines[cti].strip().endswith(('"""', "'''")) + ): cti += 1 end = cti if cti >= len(contextLines) - 1: @@ -1089,8 +1112,11 @@ if summaryLines[-1].lstrip().startswith("@"): summaryLines.pop(-1) summary = " ".join([s.strip() for s in summaryLines if s]) - if summary and not summary.endswith(".") and \ - not summary.split(None, 1)[0].lower() == "constructor": + if ( + summary and + not summary.endswith(".") and + not summary.split(None, 1)[0].lower() == "constructor" + ): self.__error( docstringContext.start() + lineNumber + len(summaryLines) - 1, @@ -1199,16 +1225,20 @@ if token[1] == "raise": exceptions.add(tokens[i + 1][0]) if tokens[i + 1][0] == tokenize.NAME: - if tokensLen > (i + 2) and \ - tokens[i + 2][1] == ".": + if ( + tokensLen > (i + 2) and + tokens[i + 2][1] == "." + ): raisedExceptions.add("{0}.{1}".format( tokens[i + 1][1], tokens[i + 3][1])) else: raisedExceptions.add(tokens[i + 1][1]) - if "@exception" not in docstringContext.ssource() and \ - "@throws" not in docstringContext.ssource() and \ - "@raise" not in docstringContext.ssource(): + if ( + "@exception" not in docstringContext.ssource() and + "@throws" not in docstringContext.ssource() and + "@raise" not in docstringContext.ssource() + ): if (exceptions - {tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE} != set()): @@ -1329,9 +1359,11 @@ contextLines = context.source() isClassContext = contextLines[0].lstrip().startswith("class ") cti = 0 - while cti < len(contextLines) and \ + while ( + cti < len(contextLines) and not contextLines[cti].strip().startswith( - ('"""', 'r"""', 'u"""', "'''", "r'''", "u'''")): + ('"""', 'r"""', 'u"""', "'''", "r'''", "u'''")) + ): cti += 1 if cti == len(contextLines): return @@ -1342,8 +1374,10 @@ # it is a multi line docstring cti += 1 - while cti < len(contextLines) and \ - not contextLines[cti].strip().endswith(('"""', "'''")): + while ( + cti < len(contextLines) and + not contextLines[cti].strip().endswith(('"""', "'''")) + ): cti += 1 end = cti if cti >= len(contextLines) - 1: @@ -1394,15 +1428,18 @@ if summary: # check, if the first word is 'Constructor', 'Public', # 'Protected' or 'Private' - functionName, arguments = context.source()[0].lstrip()\ - .split()[1].split("(", 1) + functionName, arguments = ( + context.source()[0].lstrip().split()[1].split("(", 1) + ) firstWord = summary.strip().split(None, 1)[0].lower() if functionName == '__init__': if firstWord != 'constructor': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'constructor') - elif functionName.startswith('__') and \ - functionName.endswith('__'): + elif ( + functionName.startswith('__') and + functionName.endswith('__') + ): if firstWord != 'special': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'special') @@ -1416,8 +1453,10 @@ if firstWord != 'private': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'private static') - elif functionName.startswith('_') or \ - functionName.endswith('Event'): + elif ( + functionName.startswith('_') or + functionName.endswith('Event') + ): if firstWord != 'protected': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'protected static') @@ -1425,8 +1464,10 @@ if firstWord != 'public': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'public static') - elif arguments.startswith(('cls,', 'cls)')) or \ - context.special() == "classmethod": + elif ( + arguments.startswith(('cls,', 'cls)')) or + context.special() == "classmethod" + ): secondWord = summary.strip().split(None, 2)[1].lower() if firstWord != 'class' and secondWord != 'class': self.__error(docstringContext.start() + lineNumber, 0, @@ -1436,8 +1477,10 @@ if firstWord != 'private': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'private class') - elif functionName.startswith('_') or \ - functionName.endswith('Event'): + elif ( + functionName.startswith('_') or + functionName.endswith('Event') + ): if firstWord != 'protected': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'protected class') @@ -1449,8 +1492,10 @@ if firstWord != 'private': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'private') - elif functionName.startswith('_') or \ - functionName.endswith('Event'): + elif ( + functionName.startswith('_') or + functionName.endswith('Event') + ): if firstWord != 'protected': self.__error(docstringContext.start() + lineNumber, 0, "D232", 'protected')
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/MiscellaneousChecker.py Sat Sep 21 20:30:56 2019 +0200 @@ -361,8 +361,9 @@ copyrightAuthor = copyrightArgs.get( "Author", self.__defaultArgs["CopyrightChecker"]["Author"]) - copyrightRegexStr = \ + copyrightRegexStr = ( r"Copyright\s+(\(C\)\s+)?(\d{{4}}\s+-\s+)?\d{{4}}\s+{author}" + ) tocheck = max(1024, copyrightMinFileSize) topOfSource = source[:tocheck] @@ -427,9 +428,11 @@ Private method to check for print statements. """ for node in ast.walk(self.__tree): - if (isinstance(node, ast.Call) and - getattr(node.func, 'id', None) == 'print') or \ - (hasattr(ast, 'Print') and isinstance(node, ast.Print)): + if ( + (isinstance(node, ast.Call) and + getattr(node.func, 'id', None) == 'print') or + (hasattr(ast, 'Print') and isinstance(node, ast.Print)) + ): self.__error(node.lineno - 1, node.col_offset, "M801") def __checkTuple(self): @@ -437,8 +440,10 @@ Private method to check for one element tuples. """ for node in ast.walk(self.__tree): - if isinstance(node, ast.Tuple) and \ - len(node.elts) == 1: + if ( + isinstance(node, ast.Tuple) and + len(node.elts) == 1 + ): self.__error(node.lineno - 1, node.col_offset, "M811") def __checkFuture(self): @@ -650,34 +655,44 @@ if isinstance(node, ast.Assign): # assign statement for element in node.targets: - if isinstance(element, ast.Name) and \ - element.id in self.__builtins: + if ( + isinstance(element, ast.Name) and + element.id in self.__builtins + ): value = node.value - if isinstance(value, ast.Name) and \ - element.id in ignoreBuiltinAssignments and \ - value.id in ignoreBuiltinAssignments[element.id]: + if ( + isinstance(value, ast.Name) and + element.id in ignoreBuiltinAssignments and + value.id in ignoreBuiltinAssignments[element.id] + ): # ignore compatibility assignments continue self.__error(element.lineno - 1, element.col_offset, "M131", element.id) elif isinstance(element, (ast.Tuple, ast.List)): for tupleElement in element.elts: - if isinstance(tupleElement, ast.Name) and \ - tupleElement.id in self.__builtins: + if ( + isinstance(tupleElement, ast.Name) and + tupleElement.id in self.__builtins + ): self.__error(tupleElement.lineno - 1, tupleElement.col_offset, "M131", tupleElement.id) elif isinstance(node, ast.For): # for loop target = node.target - if isinstance(target, ast.Name) and \ - target.id in self.__builtins: + if ( + isinstance(target, ast.Name) and + target.id in self.__builtins + ): self.__error(target.lineno - 1, target.col_offset, "M131", target.id) elif isinstance(target, (ast.Tuple, ast.List)): for element in target.elts: - if isinstance(element, ast.Name) and \ - element.id in self.__builtins: + if ( + isinstance(element, ast.Name) and + element.id in self.__builtins + ): self.__error(element.lineno - 1, element.col_offset, "M131", element.id) @@ -686,14 +701,18 @@ # (asynchronous) function definition if sys.version_info >= (3, 0): for arg in node.args.args: - if isinstance(arg, ast.arg) and \ - arg.arg in self.__builtins: + if ( + isinstance(arg, ast.arg) and + arg.arg in self.__builtins + ): self.__error(arg.lineno - 1, arg.col_offset, "M132", arg.arg) else: for arg in node.args.args: - if isinstance(arg, ast.Name) and \ - arg.id in self.__builtins: + if ( + isinstance(arg, ast.Name) and + arg.id in self.__builtins + ): self.__error(arg.lineno - 1, arg.col_offset, "M132", arg.id) @@ -863,8 +882,10 @@ if not all(isinstance(key, ast.Str) for key in node.keys): return False - if "__IGNORE_WARNING__" in self.__source[node.lineno - 1] or \ - "__IGNORE_WARNING_M201__" in self.__source[node.lineno - 1]: + if ( + "__IGNORE_WARNING__" in self.__source[node.lineno - 1] or + "__IGNORE_WARNING_M201__" in self.__source[node.lineno - 1] + ): return False lineNumbers = [key.lineno for key in node.keys] @@ -895,8 +916,10 @@ Private method to check the 'gettext' import statement. """ for node in ast.walk(self.__tree): - if isinstance(node, ast.ImportFrom) and \ - any(name.asname == '_' for name in node.names): + if ( + isinstance(node, ast.ImportFrom) and + any(name.asname == '_' for name in node.names) + ): self.__error(node.lineno - 1, node.col_offset, "M711", node.names[0].name) @@ -1158,8 +1181,10 @@ @return flag indicating we are inside the extra keyword @rtype bool """ - return self.__currentExtraKeyword is not None and \ + return ( + self.__currentExtraKeyword is not None and self.__currentExtraKeyword != node + ) def __detectLoggingLevel(self, node): """ @@ -1231,8 +1256,11 @@ for index, child in enumerate(ast.iter_child_nodes(node)): if index == 1: self.__currentLoggingArgument = child - if index > 1 and isinstance(child, ast.keyword) and \ - child.arg == "extra": + if ( + index > 1 and + isinstance(child, ast.keyword) and + child.arg == "extra" + ): self.__currentExtraKeyword = child super(LoggingVisitor, self).visit(child) @@ -1308,8 +1336,7 @@ """ self.__nodeStack.append(node) self.__nodeWindow.append(node) - self.__nodeWindow = \ - self.__nodeWindow[-BugBearVisitor.NodeWindowSize:] + self.__nodeWindow = self.__nodeWindow[-BugBearVisitor.NodeWindowSize:] super(BugBearVisitor, self).visit(node) @@ -1405,8 +1432,11 @@ if '.'.join(callPath) == 'sys.maxint' and sys.version_info >= (3, 0): self.violations.append((node, "M504")) - elif len(callPath) == 2 and callPath[1] == 'message' and \ - sys.version_info >= (2, 6): + elif ( + len(callPath) == 2 and + callPath[1] == 'message' and + sys.version_info >= (2, 6) + ): name = callPath[0] for elem in reversed(self.__nodeStack[:-1]): if isinstance(elem, ast.ExceptHandler) and elem.name == name: @@ -1429,8 +1459,10 @@ elif len(node.targets) == 1: target = node.targets[0] - if isinstance(target, ast.Attribute) and \ - isinstance(target.value, ast.Name): + if ( + isinstance(target, ast.Attribute) and + isinstance(target.value, ast.Name) + ): if (target.value.id, target.attr) == ('os', 'environ'): self.violations.append((node, "M506")) @@ -1454,8 +1486,10 @@ @param node reference to the node to be processed @type ast.Assert """ - if isinstance(node.test, ast.NameConstant) and \ - node.test.value is False: + if ( + isinstance(node.test, ast.NameConstant) and + node.test.value is False + ): self.violations.append((node, "M503")) self.generic_visit(node)
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/NamingStyleChecker.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/NamingStyleChecker.py Sat Sep 21 20:30:56 2019 +0200 @@ -321,8 +321,10 @@ """ functionType = getattr(node, "function_type", "function") name = node.name - if (functionType == "function" and "__" in (name[:2], name[-2:])) or \ - not self.LowercaseRegex.match(name): + if ( + (functionType == "function" and "__" in (name[:2], name[-2:])) or + not self.LowercaseRegex.match(name) + ): yield self.__error(node, "N802") def __checkFunctionArgumentNames(self, node, parents): @@ -425,8 +427,9 @@ if moduleName == "__init__": # we got a package - packageName = \ + packageName = ( os.path.split(os.path.dirname(self.__filename))[1] + ) if packageName.lower() != packageName: yield self.__error(node, "N808")
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/translations.py Sat Sep 21 20:30:56 2019 +0200 @@ -1105,8 +1105,8 @@ return message else: return QCoreApplication.translate( - "CodeStyleFixer", " no message defined for code '{0}'")\ - .format(message) + "CodeStyleFixer", " no message defined for code '{0}'" + ).format(message) # # eflag: noqa = M201
--- a/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheck.py Sat Sep 21 20:30:56 2019 +0200 @@ -166,8 +166,9 @@ # Start worker processes for _ in range(NumberOfProcesses): - multiprocessing.Process(target=worker, args=(taskQueue, doneQueue))\ - .start() + multiprocessing.Process( + target=worker, args=(taskQueue, doneQueue) + ).start() # Get and send results endIndex = len(argumentsList) - initialTasks @@ -333,8 +334,10 @@ flagsLine=True) except IndexError: pass - if "__IGNORE_WARNING__" not in lineFlags and \ - "noqa" not in lineFlags: + if ( + "__IGNORE_WARNING__" not in lineFlags and + "noqa" not in lineFlags + ): results.append((_fn, lineno, col, "", message, msg_args)) except SyntaxError as err: if err.text.strip():
--- a/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckService.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckService.py Sat Sep 21 20:30:56 2019 +0200 @@ -57,8 +57,9 @@ if pyVer: return 'Python{0}'.format(pyVer) - for lang, (_env, _getArgs, getExt) in \ - self.__supportedLanguages.items(): + for lang, (_env, _getArgs, getExt) in ( + self.__supportedLanguages.items() + ): if filename.endswith(tuple(getExt())): return lang
--- a/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/SyntaxChecker/SyntaxCheckerDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -12,8 +12,9 @@ import fnmatch from PyQt5.QtCore import pyqtSlot, Qt, QTimer -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem, \ - QApplication, QHeaderView +from PyQt5.QtWidgets import ( + QDialog, QDialogButtonBox, QTreeWidgetItem, QApplication, QHeaderView +) from E5Gui.E5Application import e5App @@ -119,8 +120,10 @@ @param sourcecode faulty line of code (string) @param isWarning flag indicating a warning message (boolean) """ - if self.__lastFileItem is None or \ - self.__lastFileItem.data(0, self.filenameRole) != filename: + if ( + self.__lastFileItem is None or + self.__lastFileItem.data(0, self.filenameRole) != filename + ): # It's a new file self.__lastFileItem = QTreeWidgetItem(self.resultList, [ self.__project.getRelativePath(filename)]) @@ -428,8 +431,10 @@ fileList = self.__fileList[:] filterString = self.excludeFilesEdit.text() - if "ExcludeFiles" not in self.__data or \ - filterString != self.__data["ExcludeFiles"]: + if ( + "ExcludeFiles" not in self.__data or + filterString != self.__data["ExcludeFiles"] + ): self.__data["ExcludeFiles"] = filterString self.__project.setData("CHECKERSPARMS", "SyntaxChecker", self.__data) @@ -437,8 +442,9 @@ if f.strip()] if filterList: for fileFilter in filterList: - fileList = \ - [f for f in fileList if not fnmatch.fnmatch(f, fileFilter)] + fileList = [ + f for f in fileList if not fnmatch.fnmatch(f, fileFilter) + ] self.resultList.clear() self.noResults = True
--- a/eric6/Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/SyntaxChecker/jsCheckSyntax.py Sat Sep 21 20:30:56 2019 +0200 @@ -108,8 +108,9 @@ # Start worker processes for _ in range(NumberOfProcesses): - multiprocessing.Process(target=worker, args=(taskQueue, doneQueue))\ - .start() + multiprocessing.Process( + target=worker, args=(taskQueue, doneQueue) + ).start() # Get and send results endIndex = len(argumentsList) - initialTasks
--- a/eric6/Plugins/CheckerPlugins/SyntaxChecker/pyflakes/translations.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/SyntaxChecker/pyflakes/translations.py Sat Sep 21 20:30:56 2019 +0200 @@ -136,5 +136,5 @@ return msg.format(*message_args) else: return QCoreApplication.translate( - "pyFlakes", "no message defined for code '{0}'")\ - .format(message_id) + "pyFlakes", "no message defined for code '{0}'" + ).format(message_id)
--- a/eric6/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/Tabnanny/Tabnanny.py Sat Sep 21 20:30:56 2019 +0200 @@ -172,8 +172,9 @@ # Start worker processes for _ in range(NumberOfProcesses): - multiprocessing.Process(target=worker, args=(taskQueue, doneQueue))\ - .start() + multiprocessing.Process( + target=worker, args=(taskQueue, doneQueue) + ).start() # Get and send results endIndex = len(argumentsList) - initialTasks
--- a/eric6/Plugins/CheckerPlugins/Tabnanny/TabnannyDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/CheckerPlugins/Tabnanny/TabnannyDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -13,8 +13,9 @@ import fnmatch from PyQt5.QtCore import pyqtSlot, Qt, QTimer -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QTreeWidgetItem, \ - QApplication, QHeaderView +from PyQt5.QtWidgets import ( + QDialog, QDialogButtonBox, QTreeWidgetItem, QApplication, QHeaderView +) from E5Gui.E5Application import e5App @@ -356,16 +357,19 @@ fileList = self.__fileList[:] filterString = self.excludeFilesEdit.text() - if "ExcludeFiles" not in self.__data or \ - filterString != self.__data["ExcludeFiles"]: + if ( + "ExcludeFiles" not in self.__data or + filterString != self.__data["ExcludeFiles"] + ): self.__data["ExcludeFiles"] = filterString self.__project.setData("CHECKERSPARMS", "Tabnanny", self.__data) filterList = [f.strip() for f in filterString.split(",") if f.strip()] if filterList: for fileFilter in filterList: - fileList = \ - [f for f in fileList if not fnmatch.fnmatch(f, fileFilter)] + fileList = [ + f for f in fileList if not fnmatch.fnmatch(f, fileFilter) + ] self.resultList.clear() self.noResults = True
--- a/eric6/Plugins/DocumentationPlugins/Ericapi/EricapiConfigDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/DocumentationPlugins/Ericapi/EricapiConfigDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -63,8 +63,8 @@ # combine it with the values of parms if parms is not None: self.parameters.update(parms) - self.parameters['outputFile'] = \ - Utilities.toNativeSeparators(self.parameters['outputFile']) + self.parameters['outputFile'] = Utilities.toNativeSeparators( + self.parameters['outputFile']) self.recursionCheckBox.setChecked(self.parameters['useRecursion']) self.includePrivateCheckBox.setChecked( @@ -146,30 +146,40 @@ parms['basePackage'] = self.parameters['basePackage'] args.append('-b') args.append(self.parameters['basePackage']) - if self.parameters['ignoreDirectories'] != \ - self.defaults['ignoreDirectories']: - parms['ignoreDirectories'] = \ + if ( + self.parameters['ignoreDirectories'] != + self.defaults['ignoreDirectories'] + ): + parms['ignoreDirectories'] = ( self.parameters['ignoreDirectories'][:] + ) for d in self.parameters['ignoreDirectories']: args.append('-x') args.append(d) - if self.parameters['ignoreFilePatterns'] != \ - self.defaults['ignoreFilePatterns']: - parms['ignoreFilePatterns'] = \ + if ( + self.parameters['ignoreFilePatterns'] != + self.defaults['ignoreFilePatterns'] + ): + parms['ignoreFilePatterns'] = ( self.parameters['ignoreFilePatterns'][:] + ) for pattern in self.parameters['ignoreFilePatterns']: args.append("--exclude-file={0}".format(pattern)) if self.parameters['useRecursion'] != self.defaults['useRecursion']: parms['useRecursion'] = self.parameters['useRecursion'] args.append('-r') - if self.parameters['sourceExtensions'] != \ - self.defaults['sourceExtensions']: + if ( + self.parameters['sourceExtensions'] != + self.defaults['sourceExtensions'] + ): parms['sourceExtensions'] = self.parameters['sourceExtensions'][:] for ext in self.parameters['sourceExtensions']: args.append('-t') args.append(ext) - if self.parameters['includePrivate'] != \ - self.defaults['includePrivate']: + if ( + self.parameters['includePrivate'] != + self.defaults['includePrivate'] + ): parms['includePrivate'] = self.parameters['includePrivate'] args.append('-p') parms['languages'] = self.parameters['languages'][:] @@ -250,8 +260,9 @@ It saves the values in the parameters dictionary. """ self.parameters['useRecursion'] = self.recursionCheckBox.isChecked() - self.parameters['includePrivate'] = \ + self.parameters['includePrivate'] = ( self.includePrivateCheckBox.isChecked() + ) outfile = self.outputFilePicker.text() if outfile != '': outfile = os.path.normpath(outfile) @@ -263,11 +274,13 @@ self.parameters['ignoreDirectories'].append( os.path.normpath(itm.text())) extensions = self.sourceExtEdit.text().split(',') - self.parameters['sourceExtensions'] = \ - [ext.strip() for ext in extensions if len(ext) > 0] + self.parameters['sourceExtensions'] = [ + ext.strip() for ext in extensions if len(ext) > 0 + ] patterns = self.excludeFilesEdit.text().split(',') - self.parameters['ignoreFilePatterns'] = \ - [pattern.strip() for pattern in patterns] + self.parameters['ignoreFilePatterns'] = [ + pattern.strip() for pattern in patterns + ] self.parameters['languages'] = [] for itm in self.languagesList.selectedItems(): self.parameters['languages'].append(itm.text())
--- a/eric6/Plugins/DocumentationPlugins/Ericapi/EricapiExecDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/DocumentationPlugins/Ericapi/EricapiExecDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -112,8 +112,10 @@ It is called when the process finished or the user pressed the button. """ - if self.process is not None and \ - self.process.state() != QProcess.NotRunning: + if ( + self.process is not None and + self.process.state() != QProcess.NotRunning + ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000)
--- a/eric6/Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/DocumentationPlugins/Ericdoc/EricdocConfigDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -19,8 +19,9 @@ from E5Gui.E5PathPicker import E5PathPickerModes from .Ui_EricdocConfigDialog import Ui_EricdocConfigDialog -from DocumentationTools.Config import eric6docDefaultColors, \ - eric6docColorParameterNames +from DocumentationTools.Config import ( + eric6docDefaultColors, eric6docColorParameterNames +) import Utilities from eric6config import getConfig @@ -92,13 +93,16 @@ self.colors[key] = parms[key] else: self.parameters[key] = parms[key] - self.parameters['outputDirectory'] = \ - Utilities.toNativeSeparators(self.parameters['outputDirectory']) - self.parameters['qtHelpOutputDirectory'] = \ + self.parameters['outputDirectory'] = Utilities.toNativeSeparators( + self.parameters['outputDirectory'] + ) + self.parameters['qtHelpOutputDirectory'] = ( Utilities.toNativeSeparators( self.parameters['qtHelpOutputDirectory']) - self.parameters['cssFile'] = \ - Utilities.toNativeSeparators(self.parameters['cssFile']) + ) + self.parameters['cssFile'] = Utilities.toNativeSeparators( + self.parameters['cssFile'] + ) if self.parameters['cssFile'].startswith("%PYTHON%"): self.parameters['cssFile'] = self.parameters['cssFile'].replace( "%PYTHON%", Utilities.getPythonModulesDirectory()) @@ -181,8 +185,10 @@ # 2. the commandline options # 2a. general commandline options - if self.parameters['outputDirectory'] != \ - self.defaults['outputDirectory']: + if ( + self.parameters['outputDirectory'] != + self.defaults['outputDirectory'] + ): parms['outputDirectory'] = Utilities.fromNativeSeparators( self.project.getRelativePath( self.parameters['outputDirectory'])) @@ -193,20 +199,27 @@ args.append(os.path.join( self.ppath, self.parameters['outputDirectory'])) else: - self.parameters['outputDirectory'] = \ + self.parameters['outputDirectory'] = ( self.defaults['outputDirectory'] + ) parms['outputDirectory'] = self.parameters['outputDirectory'] - if self.parameters['ignoreDirectories'] != \ - self.defaults['ignoreDirectories']: - parms['ignoreDirectories'] = \ + if ( + self.parameters['ignoreDirectories'] != + self.defaults['ignoreDirectories'] + ): + parms['ignoreDirectories'] = ( self.parameters['ignoreDirectories'][:] + ) for d in self.parameters['ignoreDirectories']: args.append('-x') args.append(d) - if self.parameters['ignoreFilePatterns'] != \ - self.defaults['ignoreFilePatterns']: - parms['ignoreFilePatterns'] = \ + if ( + self.parameters['ignoreFilePatterns'] != + self.defaults['ignoreFilePatterns'] + ): + parms['ignoreFilePatterns'] = ( self.parameters['ignoreFilePatterns'][:] + ) for pattern in self.parameters['ignoreFilePatterns']: if pattern.strip(): args.append("--exclude-file={0}".format(pattern.strip())) @@ -219,8 +232,10 @@ if self.parameters['noempty'] != self.defaults['noempty']: parms['noempty'] = self.parameters['noempty'] args.append('-e') - if self.parameters['sourceExtensions'] != \ - self.defaults['sourceExtensions']: + if ( + self.parameters['sourceExtensions'] != + self.defaults['sourceExtensions'] + ): parms['sourceExtensions'] = self.parameters['sourceExtensions'][:] for ext in self.parameters['sourceExtensions']: if ext.strip(): @@ -249,8 +264,10 @@ parms['qtHelpEnabled'] = self.parameters['qtHelpEnabled'] if self.parameters['qtHelpEnabled']: args.append('--create-qhp') - if self.parameters['qtHelpOutputDirectory'] != \ - self.defaults['qtHelpOutputDirectory']: + if ( + self.parameters['qtHelpOutputDirectory'] != + self.defaults['qtHelpOutputDirectory'] + ): parms['qtHelpOutputDirectory'] = Utilities.fromNativeSeparators( self.project.getRelativePath( self.parameters['qtHelpOutputDirectory'])) @@ -261,36 +278,49 @@ args.append("--qhp-outdir={0}".format( os.path.join(self.ppath, self.parameters['qtHelpOutputDirectory']))) - if self.parameters['qtHelpNamespace'] != \ - self.defaults['qtHelpNamespace']: + if ( + self.parameters['qtHelpNamespace'] != + self.defaults['qtHelpNamespace'] + ): parms['qtHelpNamespace'] = self.parameters['qtHelpNamespace'] args.append("--qhp-namespace={0}".format( self.parameters['qtHelpNamespace'])) - if self.parameters['qtHelpVirtualFolder'] != \ - self.defaults['qtHelpVirtualFolder']: - parms['qtHelpVirtualFolder'] = \ + if ( + self.parameters['qtHelpVirtualFolder'] != + self.defaults['qtHelpVirtualFolder'] + ): + parms['qtHelpVirtualFolder'] = ( self.parameters['qtHelpVirtualFolder'] + ) args.append("--qhp-virtualfolder={0}".format( self.parameters['qtHelpVirtualFolder'])) - if self.parameters['qtHelpFilterName'] != \ - self.defaults['qtHelpFilterName']: + if ( + self.parameters['qtHelpFilterName'] != + self.defaults['qtHelpFilterName'] + ): parms['qtHelpFilterName'] = self.parameters['qtHelpFilterName'] args.append("--qhp-filtername={0}".format( self.parameters['qtHelpFilterName'])) - if self.parameters['qtHelpFilterAttributes'] != \ - self.defaults['qtHelpFilterAttributes']: - parms['qtHelpFilterAttributes'] = \ + if ( + self.parameters['qtHelpFilterAttributes'] != + self.defaults['qtHelpFilterAttributes'] + ): + parms['qtHelpFilterAttributes'] = ( self.parameters['qtHelpFilterAttributes'] + ) args.append("--qhp-filterattribs={0}".format( self.parameters['qtHelpFilterAttributes'])) if self.parameters['qtHelpTitle'] != self.defaults['qtHelpTitle']: parms['qtHelpTitle'] = self.parameters['qtHelpTitle'] args.append("--qhp-title={0}".format( self.parameters['qtHelpTitle'])) - if self.parameters['qtHelpCreateCollection'] != \ - self.defaults['qtHelpCreateCollection']: - parms['qtHelpCreateCollection'] = \ + if ( + self.parameters['qtHelpCreateCollection'] != + self.defaults['qtHelpCreateCollection'] + ): + parms['qtHelpCreateCollection'] = ( self.parameters['qtHelpCreateCollection'] + ) args.append('--create-qhc') return (args, parms) @@ -525,22 +555,26 @@ cssFile = os.path.normpath(cssFile) self.parameters['cssFile'] = cssFile extensions = self.sourceExtEdit.text().split(',') - self.parameters['sourceExtensions'] = \ - [ext.strip() for ext in extensions if ext.strip()] + self.parameters['sourceExtensions'] = [ + ext.strip() for ext in extensions if ext.strip() + ] patterns = self.excludeFilesEdit.text().split(',') - self.parameters['ignoreFilePatterns'] = \ - [pattern.strip() for pattern in patterns if pattern.strip()] + self.parameters['ignoreFilePatterns'] = [ + pattern.strip() for pattern in patterns if pattern.strip() + ] self.parameters['qtHelpEnabled'] = self.qtHelpGroup.isChecked() self.parameters['qtHelpOutputDirectory'] = self.qtHelpDirPicker.text() self.parameters['qtHelpNamespace'] = self.qtHelpNamespaceEdit.text() self.parameters['qtHelpVirtualFolder'] = self.qtHelpFolderEdit.text() self.parameters['qtHelpFilterName'] = self.qtHelpFilterNameEdit.text() - self.parameters['qtHelpFilterAttributes'] = \ + self.parameters['qtHelpFilterAttributes'] = ( self.qtHelpFilterAttributesEdit.text() + ) self.parameters['qtHelpTitle'] = self.qtHelpTitleEdit.text() - self.parameters['qtHelpCreateCollection'] = \ + self.parameters['qtHelpCreateCollection'] = ( self.qtHelpGenerateCollectionCheckBox.isChecked() + ) # call the accept slot of the base class super(EricdocConfigDialog, self).accept()
--- a/eric6/Plugins/PluginCodeStyleChecker.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginCodeStyleChecker.py Sat Sep 21 20:30:56 2019 +0200 @@ -29,12 +29,14 @@ className = "CodeStyleCheckerPlugin" packageName = "__core__" shortDescription = "Show the Python Code Style Checker dialog." -longDescription = """This plugin implements the Python Code Style""" \ - """ Checker dialog. A PEP-8 checker is used to check Python source""" \ - """ files for compliance to the code style conventions given in PEP-8.""" \ - """ A PEP-257 checker is used to check Python source files for""" \ - """ compliance to docstring conventions given in PEP-257 and an""" \ +longDescription = ( + """This plugin implements the Python Code Style""" + """ Checker dialog. A PEP-8 checker is used to check Python source""" + """ files for compliance to the code style conventions given in PEP-8.""" + """ A PEP-257 checker is used to check Python source files for""" + """ compliance to docstring conventions given in PEP-257 and an""" """ eric6 variant is used to check against eric conventions.""" +) pyqtApi = 2 # End-Of-Header @@ -226,8 +228,9 @@ lineno (int), position (int), text (str), fixed (bool), autofixing (bool), fixedMsg (str)) """ - from CheckerPlugins.CodeStyleChecker.translations import \ + from CheckerPlugins.CodeStyleChecker.translations import ( getTranslatedMessage + ) fixes = 0 for result in results: @@ -280,8 +283,8 @@ self.__editorAct.triggered.connect(self.__editorCodeStyleCheck) e5App().getObject("Project").showMenu.connect(self.__projectShowMenu) - e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\ - .showMenu.connect(self.__projectBrowserShowMenu) + e5App().getObject("ProjectBrowser").getProjectBrowser( + "sources").showMenu.connect(self.__projectBrowserShowMenu) e5App().getObject("ViewManager").editorOpenedEd.connect( self.__editorOpened) e5App().getObject("ViewManager").editorClosedEd.connect( @@ -298,8 +301,8 @@ """ e5App().getObject("Project").showMenu.disconnect( self.__projectShowMenu) - e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\ - .showMenu.disconnect(self.__projectBrowserShowMenu) + e5App().getObject("ProjectBrowser").getProjectBrowser( + "sources").showMenu.disconnect(self.__projectBrowserShowMenu) e5App().getObject("ViewManager").editorOpenedEd.disconnect( self.__editorOpened) e5App().getObject("ViewManager").editorClosedEd.disconnect( @@ -343,9 +346,11 @@ @param menuName name of the menu to be shown (string) @param menu reference to the menu (QMenu) """ - if menuName == "Checks" and \ - e5App().getObject("Project").getProjectLanguage() in \ - ["Python3", "Python2", "Python", "MicroPython"]: + if ( + menuName == "Checks" and + e5App().getObject("Project").getProjectLanguage() in + ["Python3", "Python2", "Python", "MicroPython"] + ): self.__projectBrowserMenu = menu if self.__projectBrowserAct is None: self.__projectBrowserAct = E5Action( @@ -375,9 +380,10 @@ tuple(Preferences.getPython("Python3Extensions")) + tuple(Preferences.getPython("PythonExtensions")))] - from CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog import \ - CodeStyleCheckerDialog - self.__projectCodeStyleCheckerDialog = CodeStyleCheckerDialog(self) + from CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog + self.__projectCodeStyleCheckerDialog = ( + CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) + ) self.__projectCodeStyleCheckerDialog.show() self.__projectCodeStyleCheckerDialog.prepare(files, project) @@ -386,8 +392,9 @@ Private method to handle the code style check context menu action of the project sources browser. """ - browser = e5App().getObject("ProjectBrowser")\ - .getProjectBrowser("sources") + browser = ( + e5App().getObject("ProjectBrowser").getProjectBrowser("sources") + ) if browser.getSelectedItemsCount([ProjectBrowserFileItem]) > 1: fn = [] for itm in browser.getSelectedItems([ProjectBrowserFileItem]): @@ -402,10 +409,10 @@ fn = itm.dirName() isDir = True - from CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog import \ - CodeStyleCheckerDialog - self.__projectBrowserCodeStyleCheckerDialog = CodeStyleCheckerDialog( - self) + from CheckerPlugins.CodeStyleChecker import CodeStyleCheckerDialog + self.__projectBrowserCodeStyleCheckerDialog = ( + CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) + ) self.__projectBrowserCodeStyleCheckerDialog.show() if isDir: self.__projectBrowserCodeStyleCheckerDialog.start( @@ -459,10 +466,12 @@ editor = e5App().getObject("ViewManager").activeWindow() if editor is not None: if editor.checkDirty() and editor.getFileName() is not None: - from CheckerPlugins.CodeStyleChecker.CodeStyleCheckerDialog \ - import CodeStyleCheckerDialog - self.__editorCodeStyleCheckerDialog = CodeStyleCheckerDialog( - self) + from CheckerPlugins.CodeStyleChecker import ( + CodeStyleCheckerDialog + ) + self.__editorCodeStyleCheckerDialog = ( + CodeStyleCheckerDialog.CodeStyleCheckerDialog(self) + ) self.__editorCodeStyleCheckerDialog.show() self.__editorCodeStyleCheckerDialog.start( editor.getFileName(),
--- a/eric6/Plugins/PluginEricapi.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginEricapi.py Sat Sep 21 20:30:56 2019 +0200 @@ -31,9 +31,11 @@ className = "EricapiPlugin" packageName = "__core__" shortDescription = "Show the Ericapi dialogs." -longDescription = """This plugin implements the Ericapi dialogs.""" \ - """ Ericapi is used to generate a QScintilla API file for Python and""" \ +longDescription = ( + """This plugin implements the Ericapi dialogs.""" + """ Ericapi is used to generate a QScintilla API file for Python and""" """ Ruby projects.""" +) pyqtApi = 2 # End-Of-Header @@ -147,8 +149,9 @@ """ Private slot to perform the eric6_api api generation. """ - from DocumentationPlugins.Ericapi.EricapiConfigDialog import \ + from DocumentationPlugins.Ericapi.EricapiConfigDialog import ( EricapiConfigDialog + ) eolTranslation = { '\r': 'cr', '\n': 'lf', @@ -167,8 +170,9 @@ "--eol={0}".format(eolTranslation[project.getEolString()])) # now do the call - from DocumentationPlugins.Ericapi.EricapiExecDialog import \ + from DocumentationPlugins.Ericapi.EricapiExecDialog import ( EricapiExecDialog + ) dia = EricapiExecDialog("Ericapi") res = dia.start(args, project.ppath) if res:
--- a/eric6/Plugins/PluginEricdoc.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginEricdoc.py Sat Sep 21 20:30:56 2019 +0200 @@ -31,9 +31,11 @@ className = "EricdocPlugin" packageName = "__core__" shortDescription = "Show the Ericdoc dialogs." -longDescription = """This plugin implements the Ericdoc dialogs.""" \ - """ Ericdoc is used to generate a source code documentation""" \ +longDescription = ( + """This plugin implements the Ericdoc dialogs.""" + """ Ericdoc is used to generate a source code documentation""" """ for Python and Ruby projects.""" +) pyqtApi = 2 # End-Of-Header @@ -140,11 +142,10 @@ """ menu = e5App().getObject("Project").getMenu("Apidoc") if menu: - self.__projectAct = \ - E5Action( - self.tr('Generate documentation (eric6_doc)'), - self.tr('Generate &documentation (eric6_doc)'), 0, 0, - self, 'doc_eric6_doc') + self.__projectAct = E5Action( + self.tr('Generate documentation (eric6_doc)'), + self.tr('Generate &documentation (eric6_doc)'), 0, 0, + self, 'doc_eric6_doc') self.__projectAct.setStatusTip( self.tr('Generate API documentation using eric6_doc')) self.__projectAct.setWhatsThis(self.tr( @@ -190,8 +191,9 @@ """ Private slot to perform the eric6_doc api documentation generation. """ - from DocumentationPlugins.Ericdoc.EricdocConfigDialog import \ + from DocumentationPlugins.Ericdoc.EricdocConfigDialog import ( EricdocConfigDialog + ) eolTranslation = { '\r': 'cr', '\n': 'lf', @@ -210,8 +212,9 @@ "--eol={0}".format(eolTranslation[project.getEolString()])) # now do the call - from DocumentationPlugins.Ericdoc.EricdocExecDialog import \ + from DocumentationPlugins.Ericdoc.EricdocExecDialog import ( EricdocExecDialog + ) dia = EricdocExecDialog("Ericdoc") res = dia.start(args, project.ppath) if res:
--- a/eric6/Plugins/PluginSyntaxChecker.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginSyntaxChecker.py Sat Sep 21 20:30:56 2019 +0200 @@ -30,9 +30,11 @@ className = "SyntaxCheckerPlugin" packageName = "__core__" shortDescription = "Show the Syntax Checker dialog." -longDescription = """This plugin implements the Syntax Checker dialog.""" \ - """ Syntax Checker is used to check Python source files for correct""" \ +longDescription = ( + """This plugin implements the Syntax Checker dialog.""" + """ Syntax Checker is used to check Python source files for correct""" """ syntax.""" +) pyqtApi = 2 # End-Of-Header @@ -53,8 +55,9 @@ self.__ui = ui self.__initialize() - from Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckService import \ + from Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckService import ( SyntaxCheckService + ) self.syntaxCheckService = SyntaxCheckService() e5App().registerObject("SyntaxCheckService", self.syntaxCheckService) @@ -126,8 +129,9 @@ (file name, line number, column, codestring (only at syntax errors), the message, a list with arguments for the message) """ - from CheckerPlugins.SyntaxChecker.pyflakes.translations import \ + from CheckerPlugins.SyntaxChecker.pyflakes.translations import ( getTranslatedFlakesMessage + ) warnings = problems.get('warnings', []) for warning in warnings: # Translate messages @@ -170,8 +174,8 @@ self.__editorAct.triggered.connect(self.__editorSyntaxCheck) e5App().getObject("Project").showMenu.connect(self.__projectShowMenu) - e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\ - .showMenu.connect(self.__projectBrowserShowMenu) + e5App().getObject("ProjectBrowser").getProjectBrowser( + "sources").showMenu.connect(self.__projectBrowserShowMenu) e5App().getObject("ViewManager").editorOpenedEd.connect( self.__editorOpened) e5App().getObject("ViewManager").editorClosedEd.connect( @@ -188,8 +192,8 @@ """ e5App().getObject("Project").showMenu.disconnect( self.__projectShowMenu) - e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\ - .showMenu.disconnect(self.__projectBrowserShowMenu) + e5App().getObject("ProjectBrowser").getProjectBrowser( + "sources").showMenu.disconnect(self.__projectBrowserShowMenu) e5App().getObject("ViewManager").editorOpenedEd.disconnect( self.__editorOpened) e5App().getObject("ViewManager").editorClosedEd.disconnect( @@ -233,9 +237,11 @@ @param menuName name of the menu to be shown (string) @param menu reference to the menu (QMenu) """ - if menuName == "Checks" and \ - e5App().getObject("Project").getProjectLanguage() in \ - self.syntaxCheckService.getLanguages(): + if ( + menuName == "Checks" and + e5App().getObject("Project").getProjectLanguage() in + self.syntaxCheckService.getLanguages() + ): self.__projectBrowserMenu = menu if self.__projectBrowserAct is None: self.__projectBrowserAct = E5Action( @@ -263,8 +269,9 @@ for file in project.pdata["SOURCES"] if file.endswith(extensions)] - from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \ + from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( SyntaxCheckerDialog + ) self.__projectSyntaxCheckerDialog = SyntaxCheckerDialog() self.__projectSyntaxCheckerDialog.show() self.__projectSyntaxCheckerDialog.prepare(files, project) @@ -287,8 +294,9 @@ except AttributeError: fn = itm.dirName() - from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \ + from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( SyntaxCheckerDialog + ) self.__projectBrowserSyntaxCheckerDialog = SyntaxCheckerDialog() self.__projectBrowserSyntaxCheckerDialog.show() self.__projectBrowserSyntaxCheckerDialog.start(fn) @@ -338,8 +346,9 @@ """ editor = e5App().getObject("ViewManager").activeWindow() if editor is not None: - from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import \ + from CheckerPlugins.SyntaxChecker.SyntaxCheckerDialog import ( SyntaxCheckerDialog + ) self.__editorSyntaxCheckerDialog = SyntaxCheckerDialog() self.__editorSyntaxCheckerDialog.show() if editor.isJavascriptFile():
--- a/eric6/Plugins/PluginTabnanny.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginTabnanny.py Sat Sep 21 20:30:56 2019 +0200 @@ -29,9 +29,11 @@ className = "TabnannyPlugin" packageName = "__core__" shortDescription = "Show the Tabnanny dialog." -longDescription = """This plugin implements the Tabnanny dialog.""" \ - """ Tabnanny is used to check Python source files for correct""" \ +longDescription = ( + """This plugin implements the Tabnanny dialog.""" + """ Tabnanny is used to check Python source files for correct""" """ indentations.""" +) pyqtApi = 2 # End-Of-Header @@ -237,8 +239,8 @@ self.__editorAct.triggered.connect(self.__editorTabnanny) e5App().getObject("Project").showMenu.connect(self.__projectShowMenu) - e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\ - .showMenu.connect(self.__projectBrowserShowMenu) + e5App().getObject("ProjectBrowser").getProjectBrowser( + "sources").showMenu.connect(self.__projectBrowserShowMenu) e5App().getObject("ViewManager").editorOpenedEd.connect( self.__editorOpened) e5App().getObject("ViewManager").editorClosedEd.connect( @@ -255,8 +257,8 @@ """ e5App().getObject("Project").showMenu.disconnect( self.__projectShowMenu) - e5App().getObject("ProjectBrowser").getProjectBrowser("sources")\ - .showMenu.disconnect(self.__projectBrowserShowMenu) + e5App().getObject("ProjectBrowser").getProjectBrowser( + "sources").showMenu.disconnect(self.__projectBrowserShowMenu) e5App().getObject("ViewManager").editorOpenedEd.disconnect( self.__editorOpened) e5App().getObject("ViewManager").editorClosedEd.disconnect( @@ -300,9 +302,11 @@ @param menuName name of the menu to be shown (string) @param menu reference to the menu (QMenu) """ - if menuName == "Checks" and \ - e5App().getObject("Project").getProjectLanguage() in \ - ["Python3", "Python2", "Python", "MicroPython"]: + if ( + menuName == "Checks" and + e5App().getObject("Project").getProjectLanguage() in + ["Python3", "Python2", "Python", "MicroPython"] + ): self.__projectBrowserMenu = menu if self.__projectBrowserAct is None: self.__projectBrowserAct = E5Action( @@ -404,8 +408,9 @@ editor = e5App().getObject("ViewManager").activeWindow() if editor is not None: if editor.checkDirty() and editor.getFileName() is not None: - from CheckerPlugins.Tabnanny.TabnannyDialog import \ + from CheckerPlugins.Tabnanny.TabnannyDialog import ( TabnannyDialog + ) self.__editorTabnannyDialog = TabnannyDialog(self) self.__editorTabnannyDialog.show() self.__editorTabnannyDialog.start(editor.getFileName())
--- a/eric6/Plugins/PluginTranslator.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginTranslator.py Sat Sep 21 20:30:56 2019 +0200 @@ -29,9 +29,10 @@ className = "TranslatorPlugin" packageName = "__core__" shortDescription = "Translation utility using various translators." -longDescription = \ - """This plug-in implements a utility to translate text using""" \ +longDescription = ( + """This plug-in implements a utility to translate text using""" """ various online translation services.""" +) needsRestart = False pyqtApi = 2 # End-Of-Header @@ -48,9 +49,8 @@ @param configDlg reference to the configuration dialog @return reference to the configuration page """ - from UiExtensionPlugins.Translator.ConfigurationPage.TranslatorPage \ - import TranslatorPage - page = TranslatorPage(translatorPluginObject) + from UiExtensionPlugins.Translator.ConfigurationPage import TranslatorPage + page = TranslatorPage.TranslatorPage(translatorPluginObject) return page
--- a/eric6/Plugins/PluginVcsGit.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginVcsGit.py Sat Sep 21 20:30:56 2019 +0200 @@ -33,8 +33,9 @@ className = "VcsGitPlugin" packageName = "__core__" shortDescription = "Implements the Git version control interface." -longDescription = \ +longDescription = ( """This plugin provides the Git version control interface.""" +) pyqtApi = 2 # End-Of-Header @@ -111,8 +112,9 @@ @return reference to the configuration page """ global gitCfgPluginObject - from VcsPlugins.vcsGit.ConfigurationPage.GitPage import \ + from VcsPlugins.vcsGit.ConfigurationPage.GitPage import ( GitPage + ) if gitCfgPluginObject is None: gitCfgPluginObject = VcsGitPlugin(None) page = GitPage(gitCfgPluginObject)
--- a/eric6/Plugins/PluginVcsMercurial.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginVcsMercurial.py Sat Sep 21 20:30:56 2019 +0200 @@ -33,8 +33,9 @@ className = "VcsMercurialPlugin" packageName = "__core__" shortDescription = "Implements the Mercurial version control interface." -longDescription = \ +longDescription = ( """This plugin provides the Mercurial version control interface.""" +) pyqtApi = 2 # End-Of-Header @@ -110,8 +111,9 @@ @return reference to the configuration page """ global mercurialCfgPluginObject - from VcsPlugins.vcsMercurial.ConfigurationPage.MercurialPage import \ + from VcsPlugins.vcsMercurial.ConfigurationPage.MercurialPage import ( MercurialPage + ) if mercurialCfgPluginObject is None: mercurialCfgPluginObject = VcsMercurialPlugin(None) page = MercurialPage(mercurialCfgPluginObject) @@ -313,12 +315,16 @@ @return list of global options (list of string) """ args = [] - if self.getPreferences("Encoding") != \ - self.MercurialDefaults["Encoding"]: + if ( + self.getPreferences("Encoding") != + self.MercurialDefaults["Encoding"] + ): args.append("--encoding") args.append(self.getPreferences("Encoding")) - if self.getPreferences("EncodingMode") != \ - self.MercurialDefaults["EncodingMode"]: + if ( + self.getPreferences("EncodingMode") != + self.MercurialDefaults["EncodingMode"] + ): args.append("--encodingmode") args.append(self.getPreferences("EncodingMode")) if self.getPreferences("ConsiderHidden"):
--- a/eric6/Plugins/PluginVcsPySvn.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginVcsPySvn.py Sat Sep 21 20:30:56 2019 +0200 @@ -31,8 +31,9 @@ className = "VcsPySvnPlugin" packageName = "__core__" shortDescription = "Implements the PySvn version control interface." -longDescription = \ +longDescription = ( """This plugin provides the PySvn version control interface.""" +) pyqtApi = 2 # End-Of-Header @@ -105,8 +106,9 @@ @return reference to the configuration page """ global subversionCfgPluginObject - from VcsPlugins.vcsPySvn.ConfigurationPage.SubversionPage import \ + from VcsPlugins.vcsPySvn.ConfigurationPage.SubversionPage import ( SubversionPage + ) if subversionCfgPluginObject is None: subversionCfgPluginObject = VcsPySvnPlugin(None) page = SubversionPage(subversionCfgPluginObject)
--- a/eric6/Plugins/PluginVcsSubversion.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginVcsSubversion.py Sat Sep 21 20:30:56 2019 +0200 @@ -33,8 +33,9 @@ className = "VcsSubversionPlugin" packageName = "__core__" shortDescription = "Implements the Subversion version control interface." -longDescription = \ +longDescription = ( """This plugin provides the Subversion version control interface.""" +) pyqtApi = 2 # End-Of-Header @@ -111,8 +112,9 @@ @return reference to the configuration page """ global subversionCfgPluginObject - from VcsPlugins.vcsSubversion.ConfigurationPage.SubversionPage import \ + from VcsPlugins.vcsSubversion.ConfigurationPage.SubversionPage import ( SubversionPage + ) if subversionCfgPluginObject is None: subversionCfgPluginObject = VcsSubversionPlugin(None) page = SubversionPage(subversionCfgPluginObject)
--- a/eric6/Plugins/PluginWizardDotDesktop.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardDotDesktop.py Sat Sep 21 20:30:56 2019 +0200 @@ -26,9 +26,10 @@ className = "DotDesktopWizard" packageName = "__core__" shortDescription = "Wizard for the creation of a .desktop file." -longDescription = \ - """This plug-in implements a wizard to generate code for""" \ +longDescription = ( + """This plug-in implements a wizard to generate code for""" """ a .desktop file.""" +) needsRestart = False pyqtApi = 2 # End-of-Header @@ -128,8 +129,9 @@ e5App().getObject("ViewManager").newEditor() editor = e5App().getObject("ViewManager").activeWindow() - from WizardPlugins.DotDesktopWizard.DotDesktopWizardDialog import \ + from WizardPlugins.DotDesktopWizard.DotDesktopWizardDialog import ( DotDesktopWizardDialog + ) dlg = DotDesktopWizardDialog(None) if dlg.exec_() == QDialog.Accepted: code = dlg.getCode()
--- a/eric6/Plugins/PluginWizardE5MessageBox.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardE5MessageBox.py Sat Sep 21 20:30:56 2019 +0200 @@ -100,8 +100,9 @@ @param editor reference to the current editor @return the generated code (string) """ - from WizardPlugins.E5MessageBoxWizard.E5MessageBoxWizardDialog import \ + from WizardPlugins.E5MessageBoxWizard.E5MessageBoxWizardDialog import ( E5MessageBoxWizardDialog + ) dlg = E5MessageBoxWizardDialog(None) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition()
--- a/eric6/Plugins/PluginWizardEricPlugin.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardEricPlugin.py Sat Sep 21 20:30:56 2019 +0200 @@ -28,9 +28,10 @@ className = "WizardEricPluginWizard" packageName = "__core__" shortDescription = "Wizard for the creation of an eric plug-in file." -longDescription = \ - """This plug-in implements a wizard to generate code for""" \ +longDescription = ( + """This plug-in implements a wizard to generate code for""" """ an eric plug-in main script file.""" +) needsRestart = False pyqtApi = 2 # End-of-Header @@ -115,8 +116,9 @@ @return generated code (string), the plug-in package name (string) and a flag indicating success (boolean) """ - from WizardPlugins.EricPluginWizard.PluginWizardDialog import \ + from WizardPlugins.EricPluginWizard.PluginWizardDialog import ( PluginWizardDialog + ) dlg = PluginWizardDialog(None) if dlg.exec_() == QDialog.Accepted: return (dlg.getCode(), dlg.packageName(), True)
--- a/eric6/Plugins/PluginWizardPyRegExp.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardPyRegExp.py Sat Sep 21 20:30:56 2019 +0200 @@ -100,8 +100,9 @@ @param editor reference to the current editor @return the generated code (string) """ - from WizardPlugins.PyRegExpWizard.PyRegExpWizardDialog import \ + from WizardPlugins.PyRegExpWizard.PyRegExpWizardDialog import ( PyRegExpWizardDialog + ) dlg = PyRegExpWizardDialog(None, True) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition()
--- a/eric6/Plugins/PluginWizardQColorDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardQColorDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -100,8 +100,9 @@ @param editor reference to the current editor @return the generated code (string) and a success flag (boolean) """ - from WizardPlugins.ColorDialogWizard.ColorDialogWizardDialog import \ + from WizardPlugins.ColorDialogWizard.ColorDialogWizardDialog import ( ColorDialogWizardDialog + ) dlg = ColorDialogWizardDialog(None) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition()
--- a/eric6/Plugins/PluginWizardQFileDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardQFileDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -128,8 +128,9 @@ @type int @return the generated code (string) """ - from WizardPlugins.FileDialogWizard.FileDialogWizardDialog import \ + from WizardPlugins.FileDialogWizard.FileDialogWizardDialog import ( FileDialogWizardDialog + ) dlg = FileDialogWizardDialog(variant, None) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition()
--- a/eric6/Plugins/PluginWizardQFontDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardQFontDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -100,8 +100,9 @@ @param editor reference to the current editor @return the generated code (string) """ - from WizardPlugins.FontDialogWizard.FontDialogWizardDialog import \ + from WizardPlugins.FontDialogWizard.FontDialogWizardDialog import ( FontDialogWizardDialog + ) dlg = FontDialogWizardDialog(None) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition()
--- a/eric6/Plugins/PluginWizardQInputDialog.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardQInputDialog.py Sat Sep 21 20:30:56 2019 +0200 @@ -100,8 +100,9 @@ @param editor reference to the current editor @return the generated code (string) """ - from WizardPlugins.InputDialogWizard.InputDialogWizardDialog import \ + from WizardPlugins.InputDialogWizard.InputDialogWizardDialog import ( InputDialogWizardDialog + ) dlg = InputDialogWizardDialog(None) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition()
--- a/eric6/Plugins/PluginWizardQMessageBox.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardQMessageBox.py Sat Sep 21 20:30:56 2019 +0200 @@ -100,8 +100,9 @@ @param editor reference to the current editor @return the generated code (string) """ - from WizardPlugins.MessageBoxWizard.MessageBoxWizardDialog import \ + from WizardPlugins.MessageBoxWizard.MessageBoxWizardDialog import ( MessageBoxWizardDialog + ) dlg = MessageBoxWizardDialog(None) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition()
--- a/eric6/Plugins/PluginWizardQRegExp.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardQRegExp.py Sat Sep 21 20:30:56 2019 +0200 @@ -100,8 +100,9 @@ @param editor reference to the current editor @return the generated code (string) """ - from WizardPlugins.QRegExpWizard.QRegExpWizardDialog import \ + from WizardPlugins.QRegExpWizard.QRegExpWizardDialog import ( QRegExpWizardDialog + ) dlg = QRegExpWizardDialog(None, True) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition()
--- a/eric6/Plugins/PluginWizardQRegularExpression.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardQRegularExpression.py Sat Sep 21 20:30:56 2019 +0200 @@ -100,10 +100,11 @@ @param editor reference to the current editor @return the generated code (string) """ - from WizardPlugins.QRegularExpressionWizard\ - .QRegularExpressionWizardDialog import \ + from WizardPlugins.QRegularExpressionWizard import ( QRegularExpressionWizardDialog - dlg = QRegularExpressionWizardDialog(None, True) + ) + dlg = QRegularExpressionWizardDialog.QRegularExpressionWizardDialog( + None, True) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition() indLevel = editor.indentation(line) // editor.indentationWidth()
--- a/eric6/Plugins/PluginWizardSetup.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/PluginWizardSetup.py Sat Sep 21 20:30:56 2019 +0200 @@ -26,10 +26,11 @@ className = "SetupWizard" packageName = "__core__" shortDescription = "Wizard for the creation of a setup.py file." -longDescription = \ - """This plug-in implements a wizard to generate code for""" \ - """ a setup.py file. It supports the 'distutils' and 'setuptools'""" \ +longDescription = ( + """This plug-in implements a wizard to generate code for""" + """ a setup.py file. It supports the 'distutils' and 'setuptools'""" """ variants.""" +) needsRestart = False pyqtApi = 2 # End-of-Header @@ -113,8 +114,9 @@ @param editor reference to the current editor @return the generated code (string) """ - from WizardPlugins.SetupWizard.SetupWizardDialog import \ + from WizardPlugins.SetupWizard.SetupWizardDialog import ( SetupWizardDialog + ) dlg = SetupWizardDialog(None) if dlg.exec_() == QDialog.Accepted: line, index = editor.getCursorPosition()
--- a/eric6/Plugins/UiExtensionPlugins/Translator/ConfigurationPage/TranslatorPage.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/ConfigurationPage/TranslatorPage.py Sat Sep 21 20:30:56 2019 +0200 @@ -13,8 +13,9 @@ from E5Gui import E5MessageBox -from Preferences.ConfigurationPages.ConfigurationPageBase import \ +from Preferences.ConfigurationPages.ConfigurationPageBase import ( ConfigurationPageBase +) from .Ui_TranslatorPage import Ui_TranslatorPage from ..TranslatorLanguagesDb import TranslatorLanguagesDb @@ -193,8 +194,10 @@ @param item reference to the changed item (QListWidgetItem) """ - if self.__enableLanguageWarning and \ - len(self.__checkedLanguageItems()) < 2: + if ( + self.__enableLanguageWarning and + len(self.__checkedLanguageItems()) < 2 + ): E5MessageBox.warning( self, self.tr("Enabled Languages"),
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/DeepLEngine.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/DeepLEngine.py Sat Sep 21 20:30:56 2019 +0200 @@ -82,8 +82,10 @@ "auth_key={0}&source_lang={1}&target_lang={2}&text=".format( apiKey, originalLanguage.upper(), translationLanguage.upper()) .encode("utf-8")) - encodedText = QByteArray(Utilities.html_encode(text).encode("utf-8"))\ + encodedText = ( + QByteArray(Utilities.html_encode(text).encode("utf-8")) .toPercentEncoding() + ) request = params + encodedText response, ok = requestObject.post(QUrl(self.TranslatorUrl), request) if ok:
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV1Engine.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV1Engine.py Sat Sep 21 20:30:56 2019 +0200 @@ -83,8 +83,10 @@ params = QByteArray( "client=gtx&sl={0}&tl={1}&dt=t&dt=bd&ie=utf-8&oe=utf-8&q=".format( originalLanguage, translationLanguage).encode("utf-8")) - encodedText = QByteArray(Utilities.html_encode(text).encode("utf-8"))\ + encodedText = ( + QByteArray(Utilities.html_encode(text).encode("utf-8")) .toPercentEncoding() + ) request = params + encodedText response, ok = requestObject.post(QUrl(self.TranslatorUrl), request) if ok: @@ -101,8 +103,10 @@ for sentence in sentences: result += sentence["trans"].replace("\n", "<br/>") - if self.plugin.getPreferences("GoogleEnableDictionary") and \ - "dict" in responseDict: + if ( + self.plugin.getPreferences("GoogleEnableDictionary") and + "dict" in responseDict + ): dictionary = responseDict["dict"] for value in dictionary: result += "<hr/><u><b>{0}</b> - {1}</u><br/>".format( @@ -120,10 +124,13 @@ result += "<br/>" elif isinstance(responseDict, list): sentences = responseDict[0] - result = "".join([s[0] for s in sentences])\ - .replace("\n", "<br/>") - if self.plugin.getPreferences("GoogleEnableDictionary") and \ - len(responseDict) > 2: + result = ( + "".join([s[0] for s in sentences]).replace("\n", "<br/>") + ) + if ( + self.plugin.getPreferences("GoogleEnableDictionary") and + len(responseDict) > 2 + ): if not responseDict[1]: result = self.tr("No translation found.") ok = False
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV2Engine.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/GoogleV2Engine.py Sat Sep 21 20:30:56 2019 +0200 @@ -82,8 +82,10 @@ except ValueError: return self.tr("Invalid response received"), False - if "data" not in responseDict or \ - "translations" not in responseDict["data"]: + if ( + "data" not in responseDict or + "translations" not in responseDict["data"] + ): return self.tr("No translation available."), False result = ""
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/IbmWatsonEngine.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/IbmWatsonEngine.py Sat Sep 21 20:30:56 2019 +0200 @@ -11,8 +11,9 @@ import json from PyQt5.QtCore import QUrl, QByteArray, QTimer -from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, \ - QNetworkReply +from PyQt5.QtNetwork import ( + QNetworkAccessManager, QNetworkRequest, QNetworkReply +) from E5Gui import E5MessageBox
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/MicrosoftEngine.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/MicrosoftEngine.py Sat Sep 21 20:30:56 2019 +0200 @@ -18,8 +18,9 @@ Class implementing the translation engine for the Microsoft translation service. """ - AccessTokenUrl = \ + AccessTokenUrl = ( "https://api.cognitive.microsoft.com/sts/v1.0/issueToken" + ) TranslatorUrl = "https://api.microsofttranslator.com/V2/Http.svc/Translate" TextToSpeechUrl = "https://api.microsofttranslator.com/V2/Http.svc/Speak" @@ -102,8 +103,10 @@ (TranslatorRequest) @return access token (string) """ - if self.plugin.getPreferences("MsAuthTokenExpire") > \ - QDateTime.currentDateTime(): + if ( + self.plugin.getPreferences("MsAuthTokenExpire") > + QDateTime.currentDateTime() + ): return self.plugin.getPreferences("MsAuthToken") # Token expired, get a new one @@ -158,8 +161,10 @@ response, ok = requestObject.get(url, extraHeaders=[authHeader]) if ok: response = str(response, "utf-8", "replace").strip() - if response.startswith("<string") and \ - response.endswith("</string>"): + if ( + response.startswith("<string") and + response.endswith("</string>") + ): result = response.split(">", 1)[1].rsplit("<", 1)[0] else: result = self.tr("No translation available.")
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/PromtEngine.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/PromtEngine.py Sat Sep 21 20:30:56 2019 +0200 @@ -22,9 +22,10 @@ Class implementing the translation engine for the Promt translation service. """ - TranslatorUrl = \ - "http://www.online-translator.com/services/"\ + TranslatorUrl = ( + "http://www.online-translator.com/services/" "TranslationService.asmx/GetTranslation" + ) def __init__(self, plugin, parent=None): """
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/YandexEngine.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/YandexEngine.py Sat Sep 21 20:30:56 2019 +0200 @@ -93,8 +93,10 @@ params = QByteArray( "key={0}&lang={1}-{2}&text=".format( apiKey, originalLanguage, translationLanguage).encode("utf-8")) - encodedText = QByteArray(Utilities.html_encode(text).encode("utf-8"))\ + encodedText = ( + QByteArray(Utilities.html_encode(text).encode("utf-8")) .toPercentEncoding() + ) request = params + encodedText response, ok = requestObject.post(QUrl(self.TranslatorUrl), request) if ok: @@ -107,8 +109,9 @@ try: error = self.__errors[responseDict["code"]] except KeyError: - error = self.tr("Unknown error code ({0}) received.")\ - .format(responseDict["code"]) + error = self.tr( + "Unknown error code ({0}) received." + ).format(responseDict["code"]) return error, False sentences = responseDict["text"]
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/__init__.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorEngines/__init__.py Sat Sep 21 20:30:56 2019 +0200 @@ -53,8 +53,8 @@ return QCoreApplication.translate("TranslatorEngines", "IBM Watson") else: return QCoreApplication.translate( - "TranslatorEngines", "Unknow translation service name ({0})")\ - .format(name) + "TranslatorEngines", "Unknow translation service name ({0})" + ).format(name) def getTranslationEngine(name, plugin, parent=None):
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorRequest.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorRequest.py Sat Sep 21 20:30:56 2019 +0200 @@ -10,8 +10,9 @@ from PyQt5.QtCore import QObject, QEventLoop, QByteArray -from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, \ - QNetworkReply +from PyQt5.QtNetwork import ( + QNetworkAccessManager, QNetworkRequest, QNetworkReply +) from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired
--- a/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorWidget.py Sat Sep 21 18:30:02 2019 +0200 +++ b/eric6/Plugins/UiExtensionPlugins/Translator/TranslatorWidget.py Sat Sep 21 20:30:56 2019 +0200 @@ -245,10 +245,11 @@ self.__plugin.setPreferences( "OriginalLanguage", self.origLanguageComboBox.itemData(index)) - supportedTargetCodes = \ + supportedTargetCodes = ( self.__translationEngine.supportedTargetLanguages( self.origLanguageComboBox.itemData(index) ) + ) if supportedTargetCodes is not None: enabledCodes = self.__plugin.getPreferences("EnabledLanguages") transLanguage = self.transLanguageComboBox.itemData( @@ -303,8 +304,10 @@ """ engineName = self.engineComboBox.itemData( self.engineComboBox.currentIndex()) - if self.__translationEngine is not None and \ - self.__translationEngine.engineName() != engineName: + if ( + self.__translationEngine is not None and + self.__translationEngine.engineName() != engineName + ): self.__translationEngine.availableTranslationsLoaded.disconnect( self.__availableTranslationsLoaded) self.__translationEngine.deleteLater() @@ -350,8 +353,10 @@ """ Private slot to set the state of the clear button. """ - enable = bool(self.origEdit.toPlainText()) or \ + enable = ( + bool(self.origEdit.toPlainText()) or bool(self.transEdit.toPlainText()) + ) self.clearButton.setEnabled(enable) def __updateTranslateButton(self):