Tue, 24 Sep 2019 19:44:17 +0200
Continued to resolve code style issue M841.
--- a/eric6/Project/AddDirectoryDialog.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/AddDirectoryDialog.py Tue Sep 24 19:44:17 2019 +0200 @@ -121,8 +121,8 @@ the selected file type, the source and target directory and a flag indicating a recursive add """ - filetype = \ - self.filterComboBox.itemData(self.filterComboBox.currentIndex()) + filetype = self.filterComboBox.itemData( + self.filterComboBox.currentIndex()) return ( filetype, self.sourceDirPicker.text(),
--- a/eric6/Project/AddFileDialog.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/AddFileDialog.py Tue Sep 24 19:44:17 2019 +0200 @@ -85,62 +85,63 @@ "Interface Files ({3});;" "Protocol Files ({4});;" "Translation Files ({5});;" - "All Files (*)")\ - .format( - " ".join(patterns["SOURCES"]), - " ".join(patterns["FORMS"]), - " ".join(patterns["RESOURCES"]), - " ".join(patterns["INTERFACES"]), - " ".join(patterns["PROTOCOLS"]), - " ".join(patterns["TRANSLATIONS"])) + "All Files (*)" + ).format( + " ".join(patterns["SOURCES"]), + " ".join(patterns["FORMS"]), + " ".join(patterns["RESOURCES"]), + " ".join(patterns["INTERFACES"]), + " ".join(patterns["PROTOCOLS"]), + " ".join(patterns["TRANSLATIONS"]) + ) caption = self.tr("Select Files") elif self.fileTypeFilter == 'form': patterns = [] for pattern, filetype in list(self.filetypes.items()): if filetype == "FORMS": patterns.append(pattern) - dfilter = self.tr("Forms Files ({0})")\ - .format(" ".join(patterns)) + dfilter = self.tr("Forms Files ({0})").format( + " ".join(patterns)) caption = self.tr("Select user-interface files") elif self.fileTypeFilter == "resource": patterns = [] for pattern, filetype in list(self.filetypes.items()): if filetype == "RESOURCES": patterns.append(pattern) - dfilter = self.tr("Resource Files ({0})")\ - .format(" ".join(patterns)) + dfilter = self.tr("Resource Files ({0})").format( + " ".join(patterns)) caption = self.tr("Select resource files") elif self.fileTypeFilter == 'source': patterns = [] for pattern, filetype in list(self.filetypes.items()): if filetype == "SOURCES": patterns.append(pattern) - dfilter = self.tr("Source Files ({0});;All Files (*)")\ - .format(" ".join(patterns)) + dfilter = self.tr("Source Files ({0});;All Files (*)").format( + " ".join(patterns)) caption = self.tr("Select source files") elif self.fileTypeFilter == 'interface': patterns = [] for pattern, filetype in list(self.filetypes.items()): if filetype == "INTERFACES": patterns.append(pattern) - dfilter = self.tr("Interface Files ({0})")\ - .format(" ".join(patterns)) + dfilter = self.tr("Interface Files ({0})").format( + " ".join(patterns)) caption = self.tr("Select interface files") elif self.fileTypeFilter == 'protocol': patterns = [] for pattern, filetype in list(self.filetypes.items()): if filetype == "PROTOCOLS": patterns.append(pattern) - dfilter = self.tr("Protocol Files ({0})")\ - .format(" ".join(patterns)) + dfilter = self.tr("Protocol Files ({0})").format( + " ".join(patterns)) caption = self.tr("Select protocol files") elif self.fileTypeFilter == 'translation': patterns = [] for pattern, filetype in list(self.filetypes.items()): if filetype == "TRANSLATIONS": patterns.append(pattern) - dfilter = self.tr("Translation Files ({0})")\ - .format(" ".join(patterns)) + dfilter = self.tr("Translation Files ({0})").format( + " ".join(patterns)) caption = self.tr("Select translation files") elif self.fileTypeFilter == 'others': dfilter = self.tr("All Files (*)")
--- a/eric6/Project/CreateDialogCodeDialog.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/CreateDialogCodeDialog.py Tue Sep 24 19:44:17 2019 +0200 @@ -12,8 +12,10 @@ import os import json -from PyQt5.QtCore import pyqtSlot, Qt, QMetaObject, QRegExp, \ - QSortFilterProxyModel, QProcess, QProcessEnvironment +from PyQt5.QtCore import ( + pyqtSlot, Qt, QMetaObject, QRegExp, QSortFilterProxyModel, QProcess, + QProcessEnvironment +) from PyQt5.QtGui import QStandardItemModel, QBrush, QStandardItem from PyQt5.QtWidgets import QDialog, QDialogButtonBox @@ -123,9 +125,11 @@ CreateDialogCodeDialog.Separator) self.classNameCombo.addItems(sorted(vagueClassesList)) - if os.path.exists(self.srcFile) and \ - self.__module is not None and \ - self.classNameCombo.count() == 0: + if ( + os.path.exists(self.srcFile) and + self.__module is not None and + self.classNameCombo.count() == 0 + ): self.__initError = True E5MessageBox.critical( self, @@ -284,14 +288,19 @@ # I. always check for * mapped = mapped.replace("*", "") - if self.project.getProjectLanguage() != "Python2" or \ - self.project.getProjectType in ("PySide", "PySide2"): + if ( + self.project.getProjectLanguage() != "Python2" or + self.project.getProjectType in ("PySide", "PySide2") + ): # 1. check for const mapped = mapped.replace("const ", "") # 2. replace QString and QStringList - mapped = mapped.replace("QStringList", "list")\ - .replace("QString", "str") + mapped = ( + mapped + .replace("QStringList", "list") + .replace("QString", "str") + ) # 3. replace double by float mapped = mapped.replace("double", "float") @@ -322,8 +331,10 @@ itm.appendRow(itm2) if self.__module is not None: - if methodDict["methods"][0] in signatureList or \ - methodDict["methods"][1] in signatureList: + if ( + methodDict["methods"][0] in signatureList or + methodDict["methods"][1] in signatureList + ): itm2.setFlags( Qt.ItemFlags(Qt.ItemIsEnabled)) itm2.setCheckState(Qt.Checked) @@ -355,8 +366,10 @@ Private slot to generate the code as requested by the user. """ # first decide on extension - if self.filenameEdit.text().endswith(".py") or \ - self.filenameEdit.text().endswith(".pyw"): + if ( + self.filenameEdit.text().endswith(".py") or + self.filenameEdit.text().endswith(".pyw") + ): self.__generatePythonCode() elif self.filenameEdit.text().endswith(".rb"): pass @@ -432,13 +445,15 @@ objName = self.__objectName() if objName: - template = template\ + template = ( + template .replace( "$FORMFILE$", - os.path.splitext(os.path.basename(self.formFile))[0])\ - .replace("$FORMCLASS$", objName)\ - .replace("$CLASSNAME$", self.classNameCombo.currentText())\ + os.path.splitext(os.path.basename(self.formFile))[0]) + .replace("$FORMCLASS$", objName) + .replace("$CLASSNAME$", self.classNameCombo.currentText()) .replace("$SUPERCLASS$", self.__className()) + ) sourceImpl = template.splitlines(True) appendAtIndex = -1 @@ -501,8 +516,10 @@ topItem = self.slotsModel.item(row) for childRow in range(topItem.rowCount()): child = topItem.child(childRow) - if child.checkState() and \ - child.flags() & Qt.ItemFlags(Qt.ItemIsUserCheckable): + if ( + child.checkState() and + child.flags() & Qt.ItemFlags(Qt.ItemIsUserCheckable) + ): slotsCode.append('{0}\n'.format(indentStr)) slotsCode.append('{0}{1}\n'.format( indentStr, @@ -515,8 +532,10 @@ slotsCode.append( '{0}Slot documentation goes here.\n'.format( indentStr2)) - if child.data(returnTypeRole) or \ - child.data(parameterTypesListRole): + if ( + child.data(returnTypeRole) or + child.data(parameterTypesListRole) + ): slotsCode.append('{0}\n'.format(indentStr2)) if child.data(parameterTypesListRole): for name, type_ in zip(
--- a/eric6/Project/DebuggerPropertiesDialog.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/DebuggerPropertiesDialog.py Tue Sep 24 19:44:17 2019 +0200 @@ -137,11 +137,13 @@ """ Public method to store the entered/modified data. """ - self.project.debugProperties["VIRTUALENV"] = \ + self.project.debugProperties["VIRTUALENV"] = ( self.venvComboBox.currentText() + ) - self.project.debugProperties["DEBUGCLIENT"] = \ + self.project.debugProperties["DEBUGCLIENT"] = ( self.debugClientPicker.text(toNative=False) + ) if not self.project.debugProperties["DEBUGCLIENT"]: if self.project.pdata["PROGLANGUAGE"] in ["Python", "Python2", "Python3"]: @@ -152,30 +154,42 @@ debugClient = "" self.project.debugProperties["DEBUGCLIENT"] = debugClient - self.project.debugProperties["ENVIRONMENTOVERRIDE"] = \ + self.project.debugProperties["ENVIRONMENTOVERRIDE"] = ( self.debugEnvironmentOverrideCheckBox.isChecked() - self.project.debugProperties["ENVIRONMENTSTRING"] = \ + ) + self.project.debugProperties["ENVIRONMENTSTRING"] = ( self.debugEnvironmentEdit.text() - self.project.debugProperties["REMOTEDEBUGGER"] = \ + ) + self.project.debugProperties["REMOTEDEBUGGER"] = ( self.remoteDebuggerGroup.isChecked() - self.project.debugProperties["REMOTEHOST"] = \ + ) + self.project.debugProperties["REMOTEHOST"] = ( self.remoteHostEdit.text() - self.project.debugProperties["REMOTECOMMAND"] = \ + ) + self.project.debugProperties["REMOTECOMMAND"] = ( self.remoteCommandEdit.text() - self.project.debugProperties["PATHTRANSLATION"] = \ + ) + self.project.debugProperties["PATHTRANSLATION"] = ( self.pathTranslationGroup.isChecked() - self.project.debugProperties["REMOTEPATH"] = \ + ) + self.project.debugProperties["REMOTEPATH"] = ( self.translationRemoteEdit.text() - self.project.debugProperties["LOCALPATH"] = \ + ) + self.project.debugProperties["LOCALPATH"] = ( self.translationLocalEdit.text() - self.project.debugProperties["CONSOLEDEBUGGER"] = \ + ) + self.project.debugProperties["CONSOLEDEBUGGER"] = ( self.consoleDebuggerGroup.isChecked() - self.project.debugProperties["CONSOLECOMMAND"] = \ + ) + self.project.debugProperties["CONSOLECOMMAND"] = ( self.consoleCommandEdit.text() - self.project.debugProperties["REDIRECT"] = \ + ) + self.project.debugProperties["REDIRECT"] = ( self.redirectCheckBox.isChecked() - self.project.debugProperties["NOENCODING"] = \ + ) + self.project.debugProperties["NOENCODING"] = ( self.noEncodingCheckBox.isChecked() + ) self.project.debugPropertiesLoaded = True self.project.debugPropertiesChanged = True
--- a/eric6/Project/LexerAssociationDialog.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/LexerAssociationDialog.py Tue Sep 24 19:44:17 2019 +0200 @@ -44,9 +44,11 @@ self.extras = ["-----------", self.tr("Alternative")] import QScintilla.Lexers - languages = [''] + \ - sorted(QScintilla.Lexers.getSupportedLanguages().keys()) + \ + languages = ( + [''] + + sorted(QScintilla.Lexers.getSupportedLanguages().keys()) + self.extras + ) for lang in languages: self.editorLexerCombo.addItem( QScintilla.Lexers.getLanguageIcon(lang, False),
--- a/eric6/Project/NewDialogClassDialog.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/NewDialogClassDialog.py Tue Sep 24 19:44:17 2019 +0200 @@ -85,6 +85,8 @@ @return tuple giving the classname (string) and the file name (string) """ - return self.classnameEdit.text(), \ + return ( + self.classnameEdit.text(), os.path.join(self.pathnamePicker.text(), self.filenameEdit.text()) + )
--- a/eric6/Project/Project.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/Project.py Tue Sep 24 19:44:17 2019 +0200 @@ -16,11 +16,14 @@ import copy import zipfile -from PyQt5.QtCore import pyqtSlot, QFile, QFileInfo, pyqtSignal, \ - QCryptographicHash, QIODevice, QByteArray, QObject, Qt, QProcess +from PyQt5.QtCore import ( + pyqtSlot, QFile, QFileInfo, pyqtSignal, QCryptographicHash, QIODevice, + QByteArray, QObject, Qt, QProcess +) from PyQt5.QtGui import QCursor, QKeySequence -from PyQt5.QtWidgets import QLineEdit, QToolBar, QDialog, QInputDialog, \ - QApplication, QMenu, QAction +from PyQt5.QtWidgets import ( + QLineEdit, QToolBar, QDialog, QInputDialog, QApplication, QMenu, QAction +) from PyQt5.Qsci import QsciScintilla from E5Gui.E5Application import e5App @@ -338,8 +341,10 @@ @return flag indicating presence of the project type (boolean) """ if progLanguage: - return progLanguage in self.__projectProgLanguages and \ + return ( + progLanguage in self.__projectProgLanguages and type_ in self.__projectProgLanguages[progLanguage] + ) else: return type_ in self.__projectTypes @@ -398,8 +403,9 @@ self.__projectTypes[type_] = description self.__fileTypeCallbacks[type_] = fileTypeCallback self.__lexerAssociationCallbacks[type_] = lexerAssociationCallback - self.__binaryTranslationsCallbacks[type_] = \ + self.__binaryTranslationsCallbacks[type_] = ( binaryTranslationsCallback + ) if progLanguages: for progLanguage in progLanguages: self.__projectProgLanguages[progLanguage].append(type_) @@ -533,10 +539,12 @@ @param key key of the data entry to get (string). @return a copy of the requested data or None """ - if category in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS", - "PACKAGERSPARMS", "DOCUMENTATIONPARMS", - "OTHERTOOLSPARMS"] and \ - key in self.pdata[category]: + if ( + category in ["PROJECTTYPESPECIFICDATA", "CHECKERSPARMS", + "PACKAGERSPARMS", "DOCUMENTATIONPARMS", + "OTHERTOOLSPARMS"] and + key in self.pdata[category] + ): return copy.deepcopy(self.pdata[category][key]) else: return None @@ -634,8 +642,7 @@ try: if self.__fileTypeCallbacks[ self.pdata["PROJECTTYPE"]] is not None: - ftypes = \ - self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"]]() + ftypes = self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"]]() self.pdata["FILETYPES"].update(ftypes) except KeyError: pass @@ -659,8 +666,7 @@ try: if self.__fileTypeCallbacks[ self.pdata["PROJECTTYPE"]] is not None: - ftypes = \ - self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"]]() + ftypes = self.__fileTypeCallbacks[self.pdata["PROJECTTYPE"]]() for pattern, ftype in list(ftypes.items()): if pattern not in self.pdata["FILETYPES"]: self.pdata["FILETYPES"][pattern] = ftype @@ -812,8 +818,8 @@ if res: if self.pdata["TRANSLATIONPATTERN"]: - self.translationsRoot = \ - self.pdata["TRANSLATIONPATTERN"].split("%language%")[0] + self.translationsRoot = self.pdata["TRANSLATIONPATTERN"].split( + "%language%")[0] elif self.pdata["MAINSCRIPT"]: self.translationsRoot = os.path.splitext( self.pdata["MAINSCRIPT"])[0] @@ -837,12 +843,14 @@ self.__checkFilesExist("OTHERS") # get the names of subdirectories the files are stored in - for fn in self.pdata["SOURCES"] + \ - self.pdata["FORMS"] + \ - self.pdata["INTERFACES"] + \ - self.pdata["PROTOCOLS"] + \ - self.pdata["RESOURCES"] + \ - self.pdata["TRANSLATIONS"]: + for fn in ( + self.pdata["SOURCES"] + + self.pdata["FORMS"] + + self.pdata["INTERFACES"] + + self.pdata["PROTOCOLS"] + + self.pdata["RESOURCES"] + + self.pdata["TRANSLATIONS"] + ): dn = os.path.dirname(fn) if dn not in self.subdirs: self.subdirs.append(dn) @@ -876,10 +884,9 @@ @return flag indicating success """ if self.vcs is not None: - self.pdata["VCSOPTIONS"] = \ - copy.deepcopy(self.vcs.vcsGetOptions()) - self.pdata["VCSOTHERDATA"] = \ - copy.deepcopy(self.vcs.vcsGetOtherData()) + self.pdata["VCSOPTIONS"] = copy.deepcopy(self.vcs.vcsGetOptions()) + self.pdata["VCSOTHERDATA"] = copy.deepcopy( + self.vcs.vcsGetOtherData()) if not self.pdata["HASH"]: hashStr = str(QCryptographicHash.hash( @@ -1311,8 +1318,10 @@ @return value of the property """ if key == "INTERPRETER": - return e5App().getObject("VirtualEnvManager")\ + return ( + e5App().getObject("VirtualEnvManager") .getVirtualenvInterpreter(self.debugProperties["VIRTUALENV"]) + ) else: return self.debugProperties[key] @@ -1392,11 +1401,12 @@ dlg = AddLanguageDialog(self.parent()) if dlg.exec_() == QDialog.Accepted: lang = dlg.getSelectedLanguage() - if self.pdata["PROJECTTYPE"] in \ - ["Qt4", "Qt4C", "PyQt5", "PyQt5C", "E6Plugin", - "PySide", "PySideC", "PySide2", "PySide2C"]: - langFile = self.pdata["TRANSLATIONPATTERN"]\ - .replace("%language%", lang) + if self.pdata["PROJECTTYPE"] in [ + "Qt4", "Qt4C", "PyQt5", "PyQt5C", "E6Plugin", + "PySide", "PySideC", "PySide2", "PySide2C" + ]: + langFile = self.pdata["TRANSLATIONPATTERN"].replace( + "%language%", lang) self.appendFile(langFile) self.projectLanguageAddedByCode.emit(lang) @@ -1428,13 +1438,17 @@ for langFile in self.pdata["TRANSLATIONS"][:]: qmFile = self.__binaryTranslationFile(langFile) if qmFile: - if qmFile not in self.pdata["TRANSLATIONS"] and \ - os.path.exists(os.path.join(self.ppath, qmFile)): + if ( + qmFile not in self.pdata["TRANSLATIONS"] and + os.path.exists(os.path.join(self.ppath, qmFile)) + ): self.appendFile(qmFile) if tbPath: qmFile = os.path.join(tbPath, os.path.basename(qmFile)) - if qmFile not in self.pdata["TRANSLATIONS"] and \ - os.path.exists(os.path.join(self.ppath, qmFile)): + if ( + qmFile not in self.pdata["TRANSLATIONS"] and + os.path.exists(os.path.join(self.ppath, qmFile)) + ): self.appendFile(qmFile) def removeLanguageFile(self, langFile): @@ -1570,8 +1584,8 @@ if newfn not in self.pdata["INTERFACES"]: self.pdata["INTERFACES"].append(newfn) self.projectInterfaceAdded.emit(newfn) - updateModel and \ - self.__model.addNewItem("INTERFACES", newfn) + (updateModel and + self.__model.addNewItem("INTERFACES", newfn)) dirty = True else: updateModel and self.repopulateItem(newfn) @@ -1579,8 +1593,8 @@ if newfn not in self.pdata["PROTOCOLS"]: self.pdata["PROTOCOLS"].append(newfn) self.projectProtocolAdded.emit(newfn) - updateModel and \ - self.__model.addNewItem("PROTOCOLS", newfn) + (updateModel and + self.__model.addNewItem("PROTOCOLS", newfn)) dirty = True else: updateModel and self.repopulateItem(newfn) @@ -1706,8 +1720,10 @@ " any files belonging to the selected category.</p>")) return - if not Utilities.samepath(target, source) and \ - not os.path.isdir(target): + if ( + not Utilities.samepath(target, source) and + not os.path.isdir(target) + ): try: os.makedirs(target) except IOError as why: @@ -1977,13 +1993,15 @@ """Reason: {1}</p>""").format(oldfn, str(msg))) return False - if fn in self.pdata["SOURCES"] or \ - fn in self.pdata["FORMS"] or \ - fn in self.pdata["TRANSLATIONS"] or \ - fn in self.pdata["INTERFACES"] or \ - fn in self.pdata["PROTOCOLS"] or \ - fn in self.pdata["RESOURCES"] or \ - fn in self.pdata["OTHERS"]: + if ( + fn in self.pdata["SOURCES"] or + fn in self.pdata["FORMS"] or + fn in self.pdata["TRANSLATIONS"] or + fn in self.pdata["INTERFACES"] or + fn in self.pdata["PROTOCOLS"] or + fn in self.pdata["RESOURCES"] or + fn in self.pdata["OTHERS"] + ): self.renameFileInPdata(oldfn, newfn, isSourceFile) return True @@ -2261,12 +2279,14 @@ @return flag indicating, if the project contains the file (boolean) """ fn = self.getRelativePath(fn) - if fn in self.pdata["SOURCES"] or \ - fn in self.pdata["FORMS"] or \ - fn in self.pdata["INTERFACES"] or \ - fn in self.pdata["PROTOCOLS"] or \ - fn in self.pdata["RESOURCES"] or \ - fn in self.pdata["OTHERS"]: + if ( + fn in self.pdata["SOURCES"] or + fn in self.pdata["FORMS"] or + fn in self.pdata["INTERFACES"] or + fn in self.pdata["PROTOCOLS"] or + fn in self.pdata["RESOURCES"] or + fn in self.pdata["OTHERS"] + ): return True else: return False @@ -2347,8 +2367,9 @@ # create an empty __init__.py file to make it a Python package # (only for Python and Python3) - if self.pdata["PROGLANGUAGE"] in \ - ["Python", "Python2", "Python3", "MicroPython"]: + if self.pdata["PROGLANGUAGE"] in [ + "Python", "Python2", "Python3", "MicroPython" + ]: fn = os.path.join(self.ppath, "__init__.py") f = open(fn, "w", encoding="utf-8") f.close() @@ -2460,8 +2481,9 @@ addAllToVcs = res # create an empty __init__.py file to make it a Python package # if none exists (only for Python and Python3) - if self.pdata["PROGLANGUAGE"] in \ - ["Python", "Python2", "Python3", "MicroPython"]: + if self.pdata["PROGLANGUAGE"] in [ + "Python", "Python2", "Python3", "MicroPython" + ]: fn = os.path.join(self.ppath, "__init__.py") if not os.path.exists(fn): f = open(fn, "w", encoding="utf-8") @@ -2511,8 +2533,9 @@ else: vcores = False if vcores: - from VCS.CommandOptionsDialog import \ + from VCS.CommandOptionsDialog import ( VcsCommandOptionsDialog + ) codlg = VcsCommandOptionsDialog(self.vcs) if codlg.exec_() == QDialog.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) @@ -2534,10 +2557,15 @@ break # put the project under VCS control - if self.vcs is None and self.vcsSoftwareAvailable() and \ - self.vcsRequested: - vcsSystemsDict = e5App().getObject("PluginManager")\ + if ( + self.vcs is None and + self.vcsSoftwareAvailable() and + self.vcsRequested + ): + vcsSystemsDict = ( + e5App().getObject("PluginManager") .getPluginDisplayStrings("version_control") + ) vcsSystemsDisplay = [self.tr("None")] keys = sorted(vcsSystemsDict.keys()) for key in keys: @@ -2579,8 +2607,9 @@ else: vcores = False if vcores: - from VCS.CommandOptionsDialog import \ + from VCS.CommandOptionsDialog import ( VcsCommandOptionsDialog + ) codlg = VcsCommandOptionsDialog(self.vcs) if codlg.exec_() == QDialog.Accepted: self.vcs.vcsSetOptions(codlg.getOptions()) @@ -2641,8 +2670,10 @@ if tslist: if '_' in os.path.basename(tslist[0]): # the first entry determines the mainscript name - mainscriptname = os.path.splitext(mainscript)[0] or \ + mainscriptname = ( + os.path.splitext(mainscript)[0] or os.path.basename(tslist[0]).split('_')[0] + ) self.pdata["TRANSLATIONPATTERN"] = os.path.join( os.path.dirname(tslist[0]), "{0}_%language%{1}".format( @@ -2662,10 +2693,10 @@ if pattern: self.pdata["TRANSLATIONPATTERN"] = pattern if self.pdata["TRANSLATIONPATTERN"]: - self.pdata["TRANSLATIONPATTERN"] = \ - self.getRelativePath(self.pdata["TRANSLATIONPATTERN"]) - pattern = self.pdata["TRANSLATIONPATTERN"]\ - .replace("%language%", "*") + self.pdata["TRANSLATIONPATTERN"] = self.getRelativePath( + self.pdata["TRANSLATIONPATTERN"]) + pattern = self.pdata["TRANSLATIONPATTERN"].replace( + "%language%", "*") for ts in tslist: if fnmatch.fnmatch(ts, pattern): self.pdata["TRANSLATIONS"].append(ts) @@ -2674,16 +2705,17 @@ tpd = os.path.join(self.ppath, self.pdata["TRANSLATIONSBINPATH"]) pattern = os.path.basename( - self.pdata["TRANSLATIONPATTERN"])\ - .replace("%language%", "*") + self.pdata["TRANSLATIONPATTERN"]).replace( + "%language%", "*") pattern = self.__binaryTranslationFile(pattern) qmlist = Utilities.direntries(tpd, True, pattern) for qm in qmlist: self.pdata["TRANSLATIONS"].append(qm) self.projectLanguageAdded.emit(qm) if not self.pdata["MAINSCRIPT"] and bool(mainscriptname): - if self.pdata["PROGLANGUAGE"] in \ - ["Python", "Python2", "Python3", "MicroPython"]: + if self.pdata["PROGLANGUAGE"] in [ + "Python", "Python2", "Python3", "MicroPython" + ]: self.pdata["MAINSCRIPT"] = '{0}.py'.format(mainscriptname) elif self.pdata["PROGLANGUAGE"] == "Ruby": self.pdata["MAINSCRIPT"] = '{0}.rb'.format(mainscriptname) @@ -2774,12 +2806,14 @@ if dlg.exec_() == QDialog.Accepted: dlg.storeData() - if (self.pdata["VCS"] and - self.pdata["VCS"] != vcsSystem) or \ - (self.pudata["VCSOVERRIDE"] and - self.pudata["VCSOVERRIDE"] != vcsSystemOverride) or \ - (vcsSystemOverride is not None and - not self.pudata["VCSOVERRIDE"]): + if ( + (self.pdata["VCS"] and + self.pdata["VCS"] != vcsSystem) or + (self.pudata["VCSOVERRIDE"] and + self.pudata["VCSOVERRIDE"] != vcsSystemOverride) or + (vcsSystemOverride is not None and + not self.pudata["VCSOVERRIDE"]) + ): # stop the VCS monitor thread and shutdown VCS if self.vcs is not None: self.vcs.stopStatusMonitor() @@ -2916,14 +2950,16 @@ if self.vcs is None and self.isDirty() == oldState: # check, if project is version controlled pluginManager = e5App().getObject("PluginManager") - for indicator, vcsData in \ - pluginManager.getVcsSystemIndicators().items(): + for indicator, vcsData in ( + pluginManager.getVcsSystemIndicators().items() + ): if os.path.exists( os.path.join(self.ppath, indicator)): if len(vcsData) > 1: vcsList = [] - for _vcsSystemStr, vcsSystemDisplay in \ - vcsData: + for _vcsSystemStr, vcsSystemDisplay in ( + vcsData + ): vcsList.append(vcsSystemDisplay) QApplication.restoreOverrideCursor() res, vcs_ok = QInputDialog.getItem( @@ -2937,8 +2973,9 @@ QCursor(Qt.WaitCursor)) QApplication.processEvents() if vcs_ok: - for vcsSystemStr, vcsSystemDisplay in \ - vcsData: + for vcsSystemStr, vcsSystemDisplay in ( + vcsData + ): if res == vcsSystemDisplay: vcsSystem = vcsSystemStr break @@ -2951,9 +2988,11 @@ self.pdata["VCS"] = vcsSystem self.vcs = self.initVCS() self.setDirty(True) - if self.vcs is not None and \ + if ( + self.vcs is not None and (self.vcs.vcsRegisteredState(self.ppath) != - self.vcs.canBeCommitted): + self.vcs.canBeCommitted) + ): self.pdata["VCS"] = 'None' self.vcs = self.initVCS() self.closeAct.setEnabled(True) @@ -3000,8 +3039,8 @@ self.ui.taskViewer.setProjectOpen(True) # rescan project tasks if Preferences.getProject("TasksProjectRescanOnOpen"): - e5App().getObject("TaskViewer")\ - .regenerateProjectTasks(quiet=True) + e5App().getObject("TaskViewer" + ).regenerateProjectTasks(quiet=True) if restoreSession: # open the main script @@ -3069,8 +3108,10 @@ if self.ppath: defaultPath = self.ppath else: - defaultPath = Preferences.getMultiProject("Workspace") or \ + defaultPath = ( + Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() + ) fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( self.parent(), self.tr("Save project as"), @@ -3174,9 +3215,11 @@ self.__writeSession(quiet=True) # save the project debugger properties file being quiet about error - if Preferences.getProject("AutoSaveDbgProperties") and \ - self.isDebugPropertiesLoaded() and \ - not noSave and self.debugPropertiesChanged: + if ( + Preferences.getProject("AutoSaveDbgProperties") and + self.isDebugPropertiesLoaded() and + not noSave and self.debugPropertiesChanged + ): self.__writeDebugProperties(True) vm = e5App().getObject("ViewManager") @@ -3491,9 +3534,11 @@ if self.ppath: if path == self.ppath: return True - elif Utilities.normcasepath(Utilities.toNativeSeparators(path))\ - .startswith(Utilities.normcasepath( - Utilities.toNativeSeparators(self.ppath + "/"))): + elif ( + Utilities.normcasepath(Utilities.toNativeSeparators(path)) + .startswith(Utilities.normcasepath( + Utilities.toNativeSeparators(self.ppath + "/"))) + ): return True else: return False @@ -4574,8 +4619,10 @@ except OSError: newSources = [] if self.pdata["TRANSLATIONPATTERN"]: - pattern = self.pdata["TRANSLATIONPATTERN"]\ + pattern = ( + self.pdata["TRANSLATIONPATTERN"] .replace("%language%", "*") + ) else: pattern = "*.ts" binpattern = self.__binaryTranslationFile(pattern) @@ -4583,9 +4630,11 @@ # ignore hidden files and directories if ns.startswith('.'): continue - if Utilities.isWindowsPlatform() and \ - os.path.isdir(os.path.join(curpath, ns)) and \ - ns.startswith('_'): + if ( + Utilities.isWindowsPlatform() and + os.path.isdir(os.path.join(curpath, ns)) and + ns.startswith('_') + ): # dot net hack continue @@ -4614,25 +4663,32 @@ filetype = self.pdata["FILETYPES"][pattern] break - if (filetype == "SOURCES" and - fn not in self.pdata["SOURCES"]) or \ - (filetype == "FORMS" and - fn not in self.pdata["FORMS"]) or \ - (filetype == "INTERFACES" and - fn not in self.pdata["INTERFACES"]) or \ - (filetype == "PROTOCOLS" and - fn not in self.pdata["PROTOCOLS"]) or \ - (filetype == "RESOURCES" and - fn not in self.pdata["RESOURCES"]) or \ - (filetype == "OTHERS" and fn not in self.pdata["OTHERS"]): + if ( + (filetype == "SOURCES" and + fn not in self.pdata["SOURCES"]) or + (filetype == "FORMS" and + fn not in self.pdata["FORMS"]) or + (filetype == "INTERFACES" and + fn not in self.pdata["INTERFACES"]) or + (filetype == "PROTOCOLS" and + fn not in self.pdata["PROTOCOLS"]) or + (filetype == "RESOURCES" and + fn not in self.pdata["RESOURCES"]) or + (filetype == "OTHERS" and + fn not in self.pdata["OTHERS"]) + ): if autoInclude and AI: self.appendFile(ns) else: newFiles.append(ns) - elif filetype == "TRANSLATIONS" and \ - fn not in self.pdata["TRANSLATIONS"]: - if fnmatch.fnmatch(ns, pattern) or \ - fnmatch.fnmatch(ns, binpattern): + elif ( + filetype == "TRANSLATIONS" and + fn not in self.pdata["TRANSLATIONS"] + ): + if ( + fnmatch.fnmatch(ns, pattern) or + fnmatch.fnmatch(ns, binpattern) + ): if autoInclude and AI: self.appendFile(ns) else: @@ -4757,8 +4813,10 @@ forProject = False if forProject and self.pdata["VCS"] and self.pdata["VCS"] != 'None': - if self.pudata["VCSOVERRIDE"] and \ - not nooverride: + if ( + self.pudata["VCSOVERRIDE"] and + not nooverride + ): vcsSystem = self.pudata["VCSOVERRIDE"] override = True @@ -4855,8 +4913,10 @@ @return flag indicating availability of VCS software (boolean) """ - vcsSystemsDict = e5App().getObject("PluginManager")\ + vcsSystemsDict = ( + e5App().getObject("PluginManager") .getPluginDisplayStrings("version_control") + ) return len(vcsSystemsDict) != 0 def __vcsStatusChanged(self): @@ -5378,10 +5438,11 @@ self.__createZipDirEntries( os.path.split(name)[0], archiveFile) if snapshot and name == self.pdata["MAINSCRIPT"]: - snapshotSource, version = \ + snapshotSource, version = ( self.__createSnapshotSource( os.path.join(self.ppath, self.pdata["MAINSCRIPT"])) + ) archiveFile.writestr(name, snapshotSource) else: archiveFile.write(os.path.join(self.ppath, name), @@ -5483,8 +5544,8 @@ if sourcelines[lineno].startswith("version = "): # found the line to modify datestr = time.strftime("%Y%m%d") - lineend = sourcelines[lineno]\ - .replace(sourcelines[lineno].rstrip(), "") + lineend = sourcelines[lineno].replace( + sourcelines[lineno].rstrip(), "") sversion = "{0}-snapshot-{1}".format( sourcelines[lineno].replace("version = ", "") .strip()[1:-1], @@ -5521,8 +5582,10 @@ for sourceline in sourcelines: if sourceline.startswith("version = "): - version = sourceline.replace("version = ", "").strip()\ + version = ( + sourceline.replace("version = ", "").strip() .replace('"', "").replace("'", "") + ) break return version @@ -5584,8 +5647,10 @@ through a menu action) @type bool """ - if not self.pdata["MAKEPARAMS"]["MakeEnabled"] or \ - self.__makeProcess is not None: + if ( + not self.pdata["MAKEPARAMS"]["MakeEnabled"] or + self.__makeProcess is not None + ): return if self.pdata["MAKEPARAMS"]["MakeExecutable"]: @@ -5677,8 +5742,8 @@ if self.pdata["MAKEPARAMS"]["MakeTarget"]: message = self.tr( """<p>There are changes that require the configured""" - """ make target <b>{0}</b> to be rebuilt.</p>""")\ - .format(self.pdata["MAKEPARAMS"]["MakeTarget"]) + """ make target <b>{0}</b> to be rebuilt.</p>""" + ).format(self.pdata["MAKEPARAMS"]["MakeTarget"]) else: message = self.tr( """<p>There are changes that require the default""" @@ -5771,8 +5836,9 @@ @return flag indicating default parameter set @rtype bool """ - return self.pdata["RCCPARAMS"] == \ - self.getDefaultRccCompilerParameters() + return ( + self.pdata["RCCPARAMS"] == self.getDefaultRccCompilerParameters() + ) def getDefaultRccCompilerParameters(self): """
--- a/eric6/Project/ProjectBaseBrowser.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/ProjectBaseBrowser.py Tue Sep 24 19:44:17 2019 +0200 @@ -755,5 +755,5 @@ """ Protected method to open the configuration dialog. """ - e5App().getObject("UserInterface")\ - .showPreferences("projectBrowserPage") + e5App().getObject("UserInterface").showPreferences( + "projectBrowserPage")
--- a/eric6/Project/ProjectBrowser.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/ProjectBrowser.py Tue Sep 24 19:44:17 2019 +0200 @@ -18,9 +18,11 @@ import UI.PixmapCache import Preferences -from .ProjectBrowserFlags import SourcesBrowserFlag, FormsBrowserFlag, \ - ResourcesBrowserFlag, TranslationsBrowserFlag, InterfacesBrowserFlag, \ - OthersBrowserFlag, ProtocolsBrowserFlag, AllBrowsersFlag +from .ProjectBrowserFlags import ( + SourcesBrowserFlag, FormsBrowserFlag, ResourcesBrowserFlag, + TranslationsBrowserFlag, InterfacesBrowserFlag, OthersBrowserFlag, + ProtocolsBrowserFlag, AllBrowsersFlag +) class ProjectBrowser(E5TabWidget): @@ -281,8 +283,9 @@ if not self.project.isOpen(): icon = UI.PixmapCache.getIcon("projectSources.png") else: - if self.project.getProjectLanguage() in \ - ["Python", "Python2", "Python3"]: + if self.project.getProjectLanguage() in [ + "Python", "Python2", "Python3" + ]: if self.project.isMixedLanguageProject(): icon = UI.PixmapCache.getIcon("projectSourcesPyMixed.png") else: @@ -325,8 +328,10 @@ @param fn filename of the changed file (string) @param lineno one based line number of the item (integer) """ - if Preferences.getProject("FollowEditor") and \ - Preferences.getProject("FollowCursorLine"): + if ( + Preferences.getProject("FollowEditor") and + Preferences.getProject("FollowCursorLine") + ): if self.project.isProjectSource(fn): self.psBrowser.selectFileLine(fn, lineno)
--- a/eric6/Project/ProjectBrowserSortFilterProxyModel.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/ProjectBrowserSortFilterProxyModel.py Tue Sep 24 19:44:17 2019 +0200 @@ -49,9 +49,11 @@ try: if self.__filterType not in sitem.getProjectTypes(): return False - if self.hideGeneratedForms and \ - self.__filterType == ProjectBrowserSourceType and \ - sitem.data(0).startswith("Ui_"): + if ( + self.hideGeneratedForms and + self.__filterType == ProjectBrowserSourceType and + sitem.data(0).startswith("Ui_") + ): return False except AttributeError: pass
--- a/eric6/Project/ProjectOthersBrowser.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/ProjectOthersBrowser.py Tue Sep 24 19:44:17 2019 +0200 @@ -15,9 +15,10 @@ from E5Gui import E5MessageBox -from .ProjectBrowserModel import ProjectBrowserFileItem, \ - ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem, \ - ProjectBrowserOthersType +from .ProjectBrowserModel import ( + ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem, + ProjectBrowserDirectoryItem, ProjectBrowserOthersType +) from .ProjectBaseBrowser import ProjectBaseBrowser import Utilities.MimeTypes @@ -210,8 +211,11 @@ for act in self.menuActions: act.setEnabled(True) itm = self.model().item(self.currentIndex()) - if isinstance(itm, ProjectBrowserSimpleDirectoryItem) or \ - isinstance(itm, ProjectBrowserDirectoryItem): + if isinstance( + itm, + (ProjectBrowserSimpleDirectoryItem, + ProjectBrowserDirectoryItem) + ): self.renameFileAct.setEnabled(False) else: self.vcsHelper.showContextMenu(menu, self.menuActions) @@ -342,8 +346,9 @@ del dirFullNames del dirNames - from UI.DeleteFilesConfirmationDialog import \ + from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog + ) dlg = DeleteFilesConfirmationDialog( self.parent(), self.tr("Delete files/directories"),
--- a/eric6/Project/QuickFindFileDialog.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/QuickFindFileDialog.py Tue Sep 24 19:44:17 2019 +0200 @@ -14,8 +14,9 @@ import os from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QEvent -from PyQt5.QtWidgets import QWidget, QHeaderView, QApplication, \ - QDialogButtonBox, QTreeWidgetItem +from PyQt5.QtWidgets import ( + QWidget, QHeaderView, QApplication, QDialogButtonBox, QTreeWidgetItem +) from .Ui_QuickFindFile import Ui_QuickFindFile
--- a/eric6/Project/SpellingPropertiesDialog.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/SpellingPropertiesDialog.py Tue Sep 24 19:44:17 2019 +0200 @@ -75,12 +75,14 @@ Public method to store the entered/modified data. """ if self.spellingComboBox.currentIndex() == 0: - self.project.pdata["SPELLLANGUAGE"] = \ + self.project.pdata["SPELLLANGUAGE"] = ( Preferences.getEditor("SpellCheckingDefaultLanguage") + ) else: - self.project.pdata["SPELLLANGUAGE"] = \ + self.project.pdata["SPELLLANGUAGE"] = ( self.spellingComboBox.currentText() - self.project.pdata["SPELLWORDS"] = \ - self.project.getRelativePath(self.pwlPicker.text()) - self.project.pdata["SPELLEXCLUDES"] = \ - self.project.getRelativePath(self.pelPicker.text()) + ) + self.project.pdata["SPELLWORDS"] = self.project.getRelativePath( + self.pwlPicker.text()) + self.project.pdata["SPELLEXCLUDES"] = self.project.getRelativePath( + self.pelPicker.text())
--- a/eric6/Project/TranslationPropertiesDialog.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/TranslationPropertiesDialog.py Tue Sep 24 19:44:17 2019 +0200 @@ -62,10 +62,10 @@ for pattern, filetype in list(self.project.pdata["FILETYPES"].items()): if filetype in patterns: patterns[filetype].append(pattern) - self.filters = self.tr("Source Files ({0});;")\ - .format(" ".join(patterns["SOURCES"])) - self.filters += self.tr("Forms Files ({0});;")\ - .format(" ".join(patterns["FORMS"])) + self.filters = self.tr("Source Files ({0});;" + ).format(" ".join(patterns["SOURCES"])) + self.filters += self.tr("Forms Files ({0});;" + ).format(" ".join(patterns["FORMS"])) self.filters += self.tr("All Files (*)") def initDialog(self):
--- a/eric6/Project/UicLoadUi.py Tue Sep 24 19:08:10 2019 +0200 +++ b/eric6/Project/UicLoadUi.py Tue Sep 24 19:44:17 2019 +0200 @@ -79,8 +79,11 @@ mapped = mapped.replace("const ", "") # 2. replace QString and QStringList - mapped = mapped.replace("QStringList", "list")\ - .replace("QString", "str") + mapped = ( + mapped + .replace("QStringList", "list")\ + .replace("QString", "str") + ) # 3. replace double by float mapped = mapped.replace("double", "float") @@ -157,21 +160,20 @@ if parameterNames: for index in range(len(parameterNames)): if not parameterNames[index]: - parameterNames[index] = \ - QByteArray("p{0:d}".format(index) - .encode("utf-8")) + parameterNames[index] = QByteArray( + "p{0:d}".format(index).encode("utf-8") + ) parameterNamesList = [bytes(n).decode() for n in parameterNames] signatureDict["parameter_names"] = parameterNamesList methNamesSig = ", ".join(parameterNamesList) if methNamesSig: - pythonSignature = \ - "on_{0}_{1}(self, {2})".format( - name, - bytes(metaMethod.methodSignature()) - .decode().split("(")[0], - methNamesSig) + pythonSignature = "on_{0}_{1}(self, {2})".format( + name, + bytes(metaMethod.methodSignature()) + .decode().split("(")[0], + methNamesSig) else: pythonSignature = "on_{0}_{1}(self)".format( name,