Sat, 21 Sep 2019 13:03:17 +0200
Started to resolve code style issue M841.
--- a/eric6.e4p Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6.e4p Sat Sep 21 13:03:17 2019 +0200 @@ -2596,6 +2596,25 @@ <value> <dict> <key> + <string>AnnotationsChecker</string> + </key> + <value> + <dict> + <key> + <string>MaximumComplexity</string> + </key> + <value> + <int>3</int> + </value> + <key> + <string>MinimumCoverage</string> + </key> + <value> + <int>75</int> + </value> + </dict> + </value> + <key> <string>BlankLines</string> </key> <value> @@ -2676,7 +2695,7 @@ <string>ExcludeMessages</string> </key> <value> - <string>C101, E265, E266, E305, E402, M201, M301, M302, M303, M304, M305, M306, M307, M308, M311, M312, M313, M314, M315, M321, M701, M702, M811, M834, M841, N802, N803, N807, N808, N821, W293, W504, A</string> + <string>A, C101, E265, E266, E305, E402, M201, M301, M302, M303, M304, M305, M306, M307, M308, M311, M312, M313, M314, M315, M321, M701, M702, M811, M834, N802, N803, N807, N808, N821, W293, W504, A</string> </value> <key> <string>FixCodes</string>
--- a/eric6/CondaInterface/Conda.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/CondaInterface/Conda.py Sat Sep 21 13:03:17 2019 +0200 @@ -71,8 +71,8 @@ ok, resultDict = dlg.getResult() if ok: - if "actions" in resultDict and \ - "PREFIX" in resultDict["actions"]: + if ("actions" in resultDict and + "PREFIX" in resultDict["actions"]): prefix = resultDict["actions"]["PREFIX"] elif "prefix" in resultDict: prefix = resultDict["prefix"] @@ -502,8 +502,8 @@ raise RuntimeError("One of 'name' or 'prefix' must be given.") if packages: - from UI.DeleteFilesConfirmationDialog import \ - DeleteFilesConfirmationDialog + from UI.DeleteFilesConfirmationDialog import ( + DeleteFilesConfirmationDialog) dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Uninstall Packages"),
--- a/eric6/CondaInterface/CondaExecDialog.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/CondaInterface/CondaExecDialog.py Sat Sep 21 13:03:17 2019 +0200 @@ -117,8 +117,8 @@ @param giveUp flag indicating to not start another attempt @type bool """ - 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) @@ -150,8 +150,8 @@ if "error" in self.__result: self.__logError(self.__result["error"]) self.__statusOk = False - elif "success" in self.__result and \ - not self.__result["success"]: + elif ("success" in self.__result and + not self.__result["success"]): self.__logError( self.tr("Conda command '{0}' did not return success.") .format(self.__condaCommand))
--- a/eric6/CondaInterface/CondaExportDialog.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/CondaInterface/CondaExportDialog.py Sat Sep 21 13:03:17 2019 +0200 @@ -11,8 +11,9 @@ import os from PyQt5.QtCore import pyqtSlot, Qt -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton, \ - QApplication +from PyQt5.QtWidgets import ( + QDialog, QDialogButtonBox, QAbstractButton, QApplication +) from E5Gui import E5MessageBox, E5FileDialog from E5Gui.E5PathPicker import E5PathPickerModes
--- a/eric6/CondaInterface/CondaPackagesWidget.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/CondaInterface/CondaPackagesWidget.py Sat Sep 21 13:03:17 2019 +0200 @@ -12,8 +12,10 @@ from PyQt5.QtCore import pyqtSlot, Qt from PyQt5.QtGui import QCursor -from PyQt5.QtWidgets import QWidget, QToolButton, QMenu, QTreeWidgetItem, \ - QApplication, QLineEdit, QDialog +from PyQt5.QtWidgets import ( + QWidget, QToolButton, QMenu, QTreeWidgetItem, QApplication, QLineEdit, + QDialog +) from E5Gui import E5FileDialog, E5MessageBox, E5TextInputDialog from E5Gui.E5Application import e5App @@ -223,8 +225,8 @@ # 1. populate with installed packages self.packagesList.setUpdatesEnabled(False) - installedPackages = \ - self.__conda.getInstalledPackages(prefix=prefix) + installedPackages = self.__conda.getInstalledPackages( + prefix=prefix) for package, version, build in installedPackages: itm = QTreeWidgetItem(self.packagesList, [package, version]) itm.setData(1, self.PackageVersionRole, version) @@ -235,8 +237,8 @@ # 2. update with update information self.packagesList.setUpdatesEnabled(False) - updateablePackages = \ - self.__conda.getUpdateablePackages(prefix=prefix) + updateablePackages = self.__conda.getUpdateablePackages( + prefix=prefix) for package, version, build in updateablePackages: items = self.packagesList.findItems( package, Qt.MatchExactly | Qt.MatchCaseSensitive) @@ -613,8 +615,8 @@ """ Private slot to clone a conda environment. """ - from .CondaNewEnvironmentDataDialog import \ - CondaNewEnvironmentDataDialog + from .CondaNewEnvironmentDataDialog import ( + CondaNewEnvironmentDataDialog) prefix = self.environmentsComboBox.itemData( self.environmentsComboBox.currentIndex()) @@ -629,8 +631,8 @@ "--clone", prefix, ] - ok, prefix, interpreter = \ - self.__conda.createCondaEnvironment(args) + ok, prefix, interpreter = self.__conda.createCondaEnvironment( + args) if ok: e5App().getObject("VirtualEnvManager").addVirtualEnv( virtEnvName, prefix, interpreter, isConda=True) @@ -640,8 +642,8 @@ """ Private slot to create a conda environment from a requirements file. """ - from .CondaNewEnvironmentDataDialog import \ - CondaNewEnvironmentDataDialog + from .CondaNewEnvironmentDataDialog import ( + CondaNewEnvironmentDataDialog) dlg = CondaNewEnvironmentDataDialog(self.tr("Create Environment"), True, self) @@ -653,8 +655,7 @@ "--file", requirements, ] - ok, prefix, interpreter = \ - self.__conda.createCondaEnvironment(args) + ok, prefix, interpreter = self.__conda.createCondaEnvironment(args) if ok: e5App().getObject("VirtualEnvManager").addVirtualEnv( virtEnvName, prefix, interpreter, isConda=True)
--- a/eric6/CondaInterface/__init__.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/CondaInterface/__init__.py Sat Sep 21 13:03:17 2019 +0200 @@ -26,8 +26,8 @@ """ Private module function to (re-)initialize the conda interface. """ - global __CondaVersionStr, __CondaVersion, __CondaRootPrefix, \ - __CondaUserConfig, __initialized + global __CondaVersionStr, __CondaVersion, __CondaRootPrefix + global __CondaUserConfig, __initialized if not __initialized: exe = Preferences.getConda("CondaExecutable")
--- a/eric6/Cooperation/ChatWidget.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/Cooperation/ChatWidget.py Sat Sep 21 13:03:17 2019 +0200 @@ -401,8 +401,8 @@ self.editorCommand.emit(hashStr, fileName, message) from QScintilla.Editor import Editor - if message.startswith(Editor.StartEditToken + Editor.Separator) or \ - message.startswith(Editor.EndEditToken + Editor.Separator): + if (message.startswith(Editor.StartEditToken + Editor.Separator) or + message.startswith(Editor.EndEditToken + Editor.Separator)): vm = e5App().getObject("ViewManager") aw = vm.activeWindow() if aw: @@ -494,29 +494,24 @@ Private slot to initialize the chat edit context menu. """ self.__chatMenu = QMenu(self) - self.__copyChatAct = \ - self.__chatMenu.addAction( - UI.PixmapCache.getIcon("editCopy.png"), - self.tr("Copy"), self.__copyChat) + self.__copyChatAct = self.__chatMenu.addAction( + UI.PixmapCache.getIcon("editCopy.png"), + self.tr("Copy"), self.__copyChat) self.__chatMenu.addSeparator() - self.__cutAllChatAct = \ - self.__chatMenu.addAction( - UI.PixmapCache.getIcon("editCut.png"), - self.tr("Cut all"), self.__cutAllChat) - self.__copyAllChatAct = \ - self.__chatMenu.addAction( - UI.PixmapCache.getIcon("editCopy.png"), - self.tr("Copy all"), self.__copyAllChat) + self.__cutAllChatAct = self.__chatMenu.addAction( + UI.PixmapCache.getIcon("editCut.png"), + self.tr("Cut all"), self.__cutAllChat) + self.__copyAllChatAct = self.__chatMenu.addAction( + UI.PixmapCache.getIcon("editCopy.png"), + self.tr("Copy all"), self.__copyAllChat) self.__chatMenu.addSeparator() - self.__clearChatAct = \ - self.__chatMenu.addAction( - UI.PixmapCache.getIcon("editDelete.png"), - self.tr("Clear"), self.__clearChat) + self.__clearChatAct = self.__chatMenu.addAction( + UI.PixmapCache.getIcon("editDelete.png"), + self.tr("Clear"), self.__clearChat) self.__chatMenu.addSeparator() - self.__saveChatAct = \ - self.__chatMenu.addAction( - UI.PixmapCache.getIcon("fileSave.png"), - self.tr("Save"), self.__saveChat) + self.__saveChatAct = self.__chatMenu.addAction( + UI.PixmapCache.getIcon("fileSave.png"), + self.tr("Save"), self.__saveChat) self.on_chatEdit_copyAvailable(False) @@ -621,18 +616,15 @@ Private slot to initialize the users list context menu. """ self.__usersMenu = QMenu(self) - self.__kickUserAct = \ - self.__usersMenu.addAction( - UI.PixmapCache.getIcon("chatKickUser.png"), - self.tr("Kick User"), self.__kickUser) - self.__banUserAct = \ - self.__usersMenu.addAction( - UI.PixmapCache.getIcon("chatBanUser.png"), - self.tr("Ban User"), self.__banUser) - self.__banKickUserAct = \ - self.__usersMenu.addAction( - UI.PixmapCache.getIcon("chatBanKickUser.png"), - self.tr("Ban and Kick User"), self.__banKickUser) + self.__kickUserAct = self.__usersMenu.addAction( + UI.PixmapCache.getIcon("chatKickUser.png"), + self.tr("Kick User"), self.__kickUser) + self.__banUserAct = self.__usersMenu.addAction( + UI.PixmapCache.getIcon("chatBanUser.png"), + self.tr("Ban User"), self.__banUser) + self.__banKickUserAct = self.__usersMenu.addAction( + UI.PixmapCache.getIcon("chatBanKickUser.png"), + self.tr("Ban and Kick User"), self.__banKickUser) @pyqtSlot(QPoint) def on_usersList_customContextMenuRequested(self, pos):
--- a/eric6/Cooperation/Connection.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/Cooperation/Connection.py Sat Sep 21 13:03:17 2019 +0200 @@ -178,8 +178,8 @@ return try: - user, serverPort = \ - str(self.__buffer, encoding="utf-8").split(":") + user, serverPort = ( + str(self.__buffer, encoding="utf-8").split(":")) except ValueError: self.abort() return @@ -211,8 +211,8 @@ self.abort() return - if self.__serverPort != self.peerPort() and \ - not Preferences.getCooperation("AutoAcceptConnections"): + if (self.__serverPort != self.peerPort() and + not Preferences.getCooperation("AutoAcceptConnections")): # don't ask for reverse connections or # if we shall accept automatically res = E5MessageBox.yesNo( @@ -300,9 +300,9 @@ @return data length (integer) """ - if self.bytesAvailable() <= 0 or \ - self.__readDataIntoBuffer() <= 0 or \ - not self.__buffer.endsWith(SeparatorToken_b): + if (self.bytesAvailable() <= 0 or + self.__readDataIntoBuffer() <= 0 or + not self.__buffer.endsWith(SeparatorToken_b)): return 0 self.__buffer.chop(len(SeparatorToken_b)) @@ -346,8 +346,8 @@ return False self.__buffer.clear() - self.__numBytesForCurrentDataType = \ - self.__dataLengthForCurrentDataType() + self.__numBytesForCurrentDataType = ( + self.__dataLengthForCurrentDataType()) return True def __hasEnoughData(self): @@ -361,11 +361,11 @@ self.__transferTimerId = 0 if self.__numBytesForCurrentDataType <= 0: - self.__numBytesForCurrentDataType = \ - self.__dataLengthForCurrentDataType() + self.__numBytesForCurrentDataType = ( + self.__dataLengthForCurrentDataType()) - if self.bytesAvailable() < self.__numBytesForCurrentDataType or \ - self.__numBytesForCurrentDataType <= 0: + if (self.bytesAvailable() < self.__numBytesForCurrentDataType or + self.__numBytesForCurrentDataType <= 0): self.__transferTimerId = self.startTimer(TransferTimeout) return False @@ -399,8 +399,8 @@ participantsList = msg.split(SeparatorToken) self.participants.emit(participantsList[:]) elif self.__currentDataType == Connection.Editor: - hashStr, fn, msg = \ - str(self.__buffer, encoding="utf-8").split(SeparatorToken) + hashStr, fn, msg = ( + str(self.__buffer, encoding="utf-8").split(SeparatorToken)) self.editorCommand.emit(hashStr, fn, msg) self.__currentDataType = Connection.Undefined
--- a/eric6/Cooperation/CooperationClient.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/Cooperation/CooperationClient.py Sat Sep 21 13:03:17 2019 +0200 @@ -11,8 +11,9 @@ import collections from PyQt5.QtCore import QObject, pyqtSignal, QProcess, QRegExp -from PyQt5.QtNetwork import QHostInfo, QHostAddress, QAbstractSocket, \ - QNetworkInterface +from PyQt5.QtNetwork import ( + QHostInfo, QHostAddress, QAbstractSocket, QNetworkInterface +) from .CooperationServer import CooperationServer from .Connection import Connection @@ -161,8 +162,8 @@ @param connection reference to the connection to be removed (Connection) """ - if connection.peerAddress() in self.__peers and \ - connection in self.__peers[connection.peerAddress()]: + if (connection.peerAddress() in self.__peers and + connection in self.__peers[connection.peerAddress()]): self.__peers[connection.peerAddress()].remove(connection) nick = connection.name() if nick != "":
--- a/eric6/DataViews/CodeMetricsDialog.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/DataViews/CodeMetricsDialog.py Sat Sep 21 13:03:17 2019 +0200 @@ -12,8 +12,10 @@ import fnmatch from PyQt5.QtCore import pyqtSlot, Qt, QLocale -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMenu, QHeaderView, \ - QTreeWidgetItem, QApplication +from PyQt5.QtWidgets import ( + QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, + QApplication +) from .Ui_CodeMetricsDialog import Ui_CodeMetricsDialog from . import CodeMetrics @@ -256,8 +258,8 @@ 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("OTHERTOOLSPARMS", "CodeMetrics", self.__data)
--- a/eric6/DataViews/PyCoverageDialog.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/DataViews/PyCoverageDialog.py Sat Sep 21 13:03:17 2019 +0200 @@ -11,8 +11,10 @@ import os from PyQt5.QtCore import pyqtSlot, Qt -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMenu, QHeaderView, \ - QTreeWidgetItem, QApplication +from PyQt5.QtWidgets import ( + QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, + QApplication +) from E5Gui import E5MessageBox from E5Gui.E5Application import e5App @@ -195,8 +197,8 @@ return try: - statements, excluded, missing, readable = \ - cover.analysis2(file)[1:] + statements, excluded, missing, readable = ( + cover.analysis2(file)[1:]) readableEx = (excluded and self.__format_lines(excluded) or '') n = len(statements)
--- a/eric6/DataViews/PyProfileDialog.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/DataViews/PyProfileDialog.py Sat Sep 21 13:03:17 2019 +0200 @@ -12,8 +12,10 @@ import pickle from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMenu, QHeaderView, \ - QTreeWidgetItem, QApplication +from PyQt5.QtWidgets import ( + QDialog, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, + QApplication +) from E5Gui import E5MessageBox @@ -172,14 +174,15 @@ if self.cancelled: return - if not (self.ericpath and - func[0].startswith(self.ericpath)) and \ - not func[0].startswith("DebugClients") and \ - func[0] != "profile" and \ - not (exclude and ( - func[0].startswith(self.pyLibPath) or func[0] == "")): - if self.file is None or func[0].startswith(self.file) or \ - func[0].startswith(self.pyLibPath): + if (not (self.ericpath and + func[0].startswith(self.ericpath)) and + not func[0].startswith("DebugClients") and + func[0] != "profile" and + not (exclude and (func[0].startswith(self.pyLibPath) or + func[0] == "") + )): + if (self.file is None or func[0].startswith(self.file) or + func[0].startswith(self.pyLibPath)): # calculate the totals total_calls += nc prim_calls += cc
--- a/eric6/DebugClients/Python/DebugClientBase.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/DebugClients/Python/DebugClientBase.py Sat Sep 21 13:03:17 2019 +0200 @@ -612,8 +612,8 @@ code = self.compile_command(self.buffer, self.readstream.name) except (OverflowError, SyntaxError, ValueError): # Report the exception - sys.last_type, sys.last_value, sys.last_traceback = \ - sys.exc_info() + sys.last_type, sys.last_value, sys.last_traceback = ( + sys.exc_info()) self.sendJsonCommand("ClientOutput", { "text": "".join(traceback.format_exception_only( sys.last_type, sys.last_value)) @@ -648,9 +648,9 @@ cf = cf.f_back frmnr -= 1 _globals = cf.f_globals - _locals = \ + _locals = ( self.currentThread.getFrameLocals( - self.framenr) + self.framenr)) ## reset sys.stdout to our redirector ## (unconditionally) if "sys" in _globals: @@ -825,8 +825,8 @@ testLoader = unittest.TestLoader() test = testLoader.discover( discoveryStart, top_level_dir=top_level_dir) - if hasattr(testLoader, "errors") and \ - bool(testLoader.errors): + if (hasattr(testLoader, "errors") and + bool(testLoader.errors)): self.sendJsonCommand("ResponseUTDiscover", { "testCasesList": [], "exception": "DiscoveryError", @@ -978,9 +978,9 @@ testCases.extend(self.__assembleTestCasesList(test, start)) else: testId = test.id() - if "ModuleImportFailure" not in testId and \ - "LoadTestsFailure" not in testId and \ - "_FailedTest" not in testId: + if ("ModuleImportFailure" not in testId and + "LoadTestsFailure" not in testId and + "_FailedTest" not in testId): filename = os.path.join( start, test.__module__.replace(".", os.sep) + ".py")
--- a/eric6/DebugClients/Python/DebugClientCapabilities.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/DebugClients/Python/DebugClientCapabilities.py Sat Sep 21 13:03:17 2019 +0200 @@ -15,8 +15,8 @@ HasUnittest = 0x0020 HasShell = 0x0040 -HasAll = HasDebugger | HasInterpreter | HasProfiler | \ - HasCoverage | HasCompleter | HasUnittest | HasShell +HasAll = (HasDebugger | HasInterpreter | HasProfiler | + HasCoverage | HasCompleter | HasUnittest | HasShell) # # eflag: noqa = M702
--- a/eric6/DebugClients/Python/DebugVariables.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/DebugClients/Python/DebugVariables.py Sat Sep 21 13:03:17 2019 +0200 @@ -432,12 +432,12 @@ d = super(NdArrayResolver, self).getDictionary(var) if var.size > 1024 * 1024: - d['min'] = 'ndarray too big, calculating min would slow down' \ - ' debugging' - d['max'] = 'ndarray too big, calculating max would slow down' \ - ' debugging' - d['mean'] = 'ndarray too big, calculating mean would slow down' \ - ' debugging' + d['min'] = ( + 'ndarray too big, calculating min would slow down debugging') + d['max'] = ( + 'ndarray too big, calculating max would slow down debugging') + d['mean'] = ( + 'ndarray too big, calculating mean would slow down debugging') elif self.__isNumeric(var): if var.size == 0: d['min'] = 'empty array'
--- a/eric6/DebugClients/Python/FlexCompleter.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/DebugClients/Python/FlexCompleter.py Sat Sep 21 13:03:17 2019 +0200 @@ -201,8 +201,8 @@ noprefix = None while True: for word in words: - if word[:n] == attr and \ - not (noprefix and word[:n + 1] == noprefix): + if (word[:n] == attr and + not (noprefix and word[:n + 1] == noprefix)): match = "{0}.{1}".format(expr, word) try: val = getattr(thisobject, word)
--- a/eric6/DebugClients/Python/PyProfile.py Thu Sep 19 19:39:04 2019 +0200 +++ b/eric6/DebugClients/Python/PyProfile.py Sat Sep 21 13:03:17 2019 +0200 @@ -125,8 +125,8 @@ versionExt = '.py3' # get module name from __file__ - if not isinstance(frame, profile.Profile.fake_frame) and \ - '__file__' in frame.f_globals: + if (not isinstance(frame, profile.Profile.fake_frame) and + '__file__' in frame.f_globals): root, ext = os.path.splitext(frame.f_globals['__file__']) if ext in ['.pyc', '.py', versionExt, '.pyo']: fixedName = root + '.py'