Mon, 23 Sep 2019 19:22:12 +0200
Continued to resolve code style issue M841.
--- a/eric6/PyUnit/UnittestDialog.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/PyUnit/UnittestDialog.py Mon Sep 23 19:22:12 2019 +0200 @@ -16,8 +16,10 @@ from PyQt5.QtCore import pyqtSignal, QEvent, Qt, pyqtSlot from PyQt5.QtGui import QColor -from PyQt5.QtWidgets import QWidget, QDialog, QApplication, QDialogButtonBox, \ - QListWidgetItem, QComboBox, QTreeWidgetItem +from PyQt5.QtWidgets import ( + QWidget, QDialog, QApplication, QDialogButtonBox, QListWidgetItem, + QComboBox, QTreeWidgetItem +) from E5Gui.E5Application import e5App from E5Gui import E5MessageBox @@ -286,15 +288,17 @@ Private slot called before the test suite selection dialog is shown. """ if self.__dbs: - py2Extensions = \ - ' '.join(["*{0}".format(ext) - for ext in self.__dbs.getExtensions('Python2')]) - py3Extensions = \ - ' '.join(["*{0}".format(ext) - for ext in self.__dbs.getExtensions('Python3')]) + py2Extensions = ' '.join( + ["*{0}".format(ext) + for ext in self.__dbs.getExtensions('Python2')] + ) + py3Extensions = ' '.join( + ["*{0}".format(ext) + for ext in self.__dbs.getExtensions('Python3')] + ) fileFilter = self.tr( - "Python3 Files ({1});;Python2 Files ({0});;All Files (*)")\ - .format(py2Extensions, py3Extensions) + "Python3 Files ({1});;Python2 Files ({0});;All Files (*)" + ).format(py2Extensions, py3Extensions) else: fileFilter = self.tr("Python Files (*.py);;All Files (*)") self.testsuitePicker.setFilters(fileFilter) @@ -403,8 +407,7 @@ return workdir = "" - clientType = \ - self.__venvManager.getVirtualenvVariant(venvName) + clientType = self.__venvManager.getVirtualenvVariant(venvName) if not clientType: # assume Python 3 clientType = "Python3" @@ -423,8 +426,10 @@ return if discoveryStart: - sys.path = [os.path.abspath(discoveryStart)] + \ + sys.path = ( + [os.path.abspath(discoveryStart)] + self.savedSysPath + ) # clean up list of imported modules to force a reimport upon # running the test @@ -440,8 +445,7 @@ try: testLoader = unittest.TestLoader() test = testLoader.discover(discoveryStart) - if hasattr(testLoader, "errors") and \ - bool(testLoader.errors): + if hasattr(testLoader, "errors") and bool(testLoader.errors): E5MessageBox.critical( self, self.tr("Unittest"), @@ -494,9 +498,11 @@ 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") @@ -548,8 +554,10 @@ itm.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) itm.setCheckState(0, Qt.Unchecked) itm.setData(0, UnittestDialog.TestCaseNameRole, modulePath) - if os.path.splitext(os.path.basename(filename))[0] == \ - itm.text(0): + if ( + os.path.splitext(os.path.basename(filename))[0] == + itm.text(0) + ): itm.setData(0, UnittestDialog.TestCaseFileRole, filename) elif pitm: @@ -748,8 +756,8 @@ coverageFile = os.path.join(discoveryStart, "unittest") workdir = "" - clientType = \ - self.__venvManager.getVirtualenvVariant(venvName) + clientType = self.__venvManager.getVirtualenvVariant( + venvName) if not clientType: # assume Python 3 clientType = "Python3" @@ -757,10 +765,12 @@ mainScript = os.path.abspath(testFileName) flags = Utilities.extractFlagsFromFile(mainScript) workdir = os.path.dirname(mainScript) - if mainScript.endswith( - tuple(Preferences.getPython("PythonExtensions"))) or \ - ("FileType" in flags and - flags["FileType"] in ["Python", "Python2"]): + if ( + mainScript.endswith(tuple( + Preferences.getPython("PythonExtensions"))) or + ("FileType" in flags and + flags["FileType"] in ["Python", "Python2"]) + ): clientType = "Python2" else: # if it is not Python2 it must be Python3! @@ -769,8 +779,8 @@ else: coverageFile = os.path.abspath("unittest") workdir = "" - clientType = \ - self.__venvManager.getVirtualenvVariant(venvName) + clientType = self.__venvManager.getVirtualenvVariant( + venvName) if not clientType: # assume Python 3 clientType = "Python3" @@ -802,11 +812,15 @@ return if testFileName: - sys.path = [os.path.dirname(os.path.abspath(testFileName))] + \ + sys.path = ( + [os.path.dirname(os.path.abspath(testFileName))] + self.savedSysPath + ) elif discoveryStart: - sys.path = [os.path.abspath(discoveryStart)] + \ + sys.path = ( + [os.path.abspath(discoveryStart)] + self.savedSysPath + ) # clean up list of imported modules to force a reimport upon # running the test @@ -868,8 +882,8 @@ if discover: covname = os.path.join(discoveryStart, "unittest") elif testFileName: - covname = \ - os.path.splitext(os.path.abspath(testFileName))[0] + covname = os.path.splitext( + os.path.abspath(testFileName))[0] else: covname = "unittest"
--- a/eric6/Snapshot/SnapWidget.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Snapshot/SnapWidget.py Mon Sep 23 19:22:12 2019 +0200 @@ -14,8 +14,10 @@ import os -from PyQt5.QtCore import pyqtSlot, QFile, QFileInfo, QTimer, QPoint, \ - QMimeData, Qt, QRegExp, QLocale, QStandardPaths +from PyQt5.QtCore import ( + pyqtSlot, QFile, QFileInfo, QTimer, QPoint, QMimeData, Qt, QRegExp, + QLocale, QStandardPaths +) from PyQt5.QtGui import QImageWriter, QPixmap, QDrag, QKeySequence from PyQt5.QtWidgets import QWidget, QApplication, QShortcut
--- a/eric6/Snapshot/SnapshotDefaultGrabber.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Snapshot/SnapshotDefaultGrabber.py Mon Sep 23 19:22:12 2019 +0200 @@ -191,8 +191,10 @@ @param evt reference to the event (QEvent) @return flag indicating that the event should be filtered out (boolean) """ - if obj == self.__grabberWidget and \ - evt.type() == QEvent.MouseButtonPress: + if ( + obj == self.__grabberWidget and + evt.type() == QEvent.MouseButtonPress + ): if QWidget.mouseGrabber() != self.__grabberWidget: return False if evt.button() == Qt.LeftButton:
--- a/eric6/Snapshot/SnapshotFreehandGrabber.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Snapshot/SnapshotFreehandGrabber.py Mon Sep 23 19:22:12 2019 +0200 @@ -9,8 +9,10 @@ from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, QLocale -from PyQt5.QtGui import QPixmap, QColor, QRegion, QPainter, QPalette, \ - QPolygon, QPen, QBrush, QPaintEngine +from PyQt5.QtGui import ( + QPixmap, QColor, QRegion, QPainter, QPalette, QPolygon, QPen, QBrush, + QPaintEngine +) from PyQt5.QtWidgets import QWidget, QApplication, QToolTip @@ -168,17 +170,21 @@ boundingRect = textRect.adjusted(-4, 0, 0, 0) polBoundingRect = pol.boundingRect() - if (textRect.width() < - polBoundingRect.width() - 2 * self.__handleSize) and \ - (textRect.height() < - polBoundingRect.height() - 2 * self.__handleSize) and \ - polBoundingRect.width() > 100 and \ - polBoundingRect.height() > 100: + if ( + (textRect.width() < + polBoundingRect.width() - 2 * self.__handleSize) and + (textRect.height() < + polBoundingRect.height() - 2 * self.__handleSize) and + polBoundingRect.width() > 100 and + polBoundingRect.height() > 100 + ): # center, unsuitable for small selections boundingRect.moveCenter(polBoundingRect.center()) textRect.moveCenter(polBoundingRect.center()) - elif polBoundingRect.y() - 3 > textRect.height() and \ - polBoundingRect.x() + textRect.width() < self.rect().width(): + elif ( + polBoundingRect.y() - 3 > textRect.height() and + polBoundingRect.x() + textRect.width() < self.rect().width() + ): # on top, left aligned boundingRect.moveBottomLeft( QPoint(polBoundingRect.x(), polBoundingRect.y() - 3)) @@ -190,17 +196,21 @@ QPoint(polBoundingRect.x() - 3, polBoundingRect.y())) textRect.moveTopRight( QPoint(polBoundingRect.x() - 5, polBoundingRect.y())) - elif (polBoundingRect.bottom() + 3 + textRect.height() < - self.rect().bottom()) and \ - polBoundingRect.right() > textRect.width(): + elif ( + (polBoundingRect.bottom() + 3 + textRect.height() < + self.rect().bottom()) and + polBoundingRect.right() > textRect.width() + ): # at bottom, right aligned boundingRect.moveTopRight( QPoint(polBoundingRect.right(), polBoundingRect.bottom() + 3)) textRect.moveTopRight( QPoint(polBoundingRect.right() - 2, polBoundingRect.bottom() + 3)) - elif polBoundingRect.right() + textRect.width() + 3 < \ - self.rect().width(): + elif ( + polBoundingRect.right() + textRect.width() + 3 < + self.rect().width() + ): # right, bottom aligned boundingRect.moveBottomLeft( QPoint(polBoundingRect.right() + 3, polBoundingRect.bottom())) @@ -212,9 +222,11 @@ drawPolygon(painter, boundingRect, textColor, textBackgroundColor) painter.drawText(textRect, Qt.AlignHCenter, txt) - if (polBoundingRect.height() > self.__handleSize * 2 and - polBoundingRect.width() > self.__handleSize * 2) or \ - not self.__mouseDown: + if ( + (polBoundingRect.height() > self.__handleSize * 2 and + polBoundingRect.width() > self.__handleSize * 2) or + not self.__mouseDown + ): painter.setBrush(Qt.transparent) painter.setClipRegion(QRegion(pol)) painter.drawPolygon(QPolygon(self.rect()))
--- a/eric6/Snapshot/SnapshotPreview.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Snapshot/SnapshotPreview.py Mon Sep 23 19:22:12 2019 +0200 @@ -70,8 +70,10 @@ @param evt mouse move event (QMouseEvent) """ - if self.__mouseClickPoint != QPoint(0, 0) and \ - (evt.pos() - self.__mouseClickPoint).manhattanLength() > \ - QApplication.startDragDistance(): + if ( + self.__mouseClickPoint != QPoint(0, 0) and + (evt.pos() - self.__mouseClickPoint).manhattanLength() > + QApplication.startDragDistance() + ): self.__mouseClickPoint = QPoint(0, 0) self.startDrag.emit()
--- a/eric6/Snapshot/SnapshotRegionGrabber.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Snapshot/SnapshotRegionGrabber.py Mon Sep 23 19:22:12 2019 +0200 @@ -9,8 +9,9 @@ from PyQt5.QtCore import pyqtSignal, Qt, QRect, QPoint, QTimer, QLocale -from PyQt5.QtGui import QPixmap, QColor, QRegion, QPainter, QPalette, \ - QPaintEngine, QPen, QBrush +from PyQt5.QtGui import ( + QPixmap, QColor, QRegion, QPainter, QPalette, QPaintEngine, QPen, QBrush +) from PyQt5.QtWidgets import QWidget, QApplication, QToolTip @@ -189,15 +190,19 @@ textRect = painter.boundingRect(self.rect(), Qt.AlignLeft, txt) boundingRect = textRect.adjusted(-4, 0, 0, 0) - if textRect.width() < r.width() - 2 * self.__handleSize and \ - textRect.height() < r.height() - 2 * self.__handleSize and \ - r.width() > 100 and \ - r.height() > 100: + if ( + textRect.width() < r.width() - 2 * self.__handleSize and + textRect.height() < r.height() - 2 * self.__handleSize and + r.width() > 100 and + r.height() > 100 + ): # center, unsuitable for small selections boundingRect.moveCenter(r.center()) textRect.moveCenter(r.center()) - elif r.y() - 3 > textRect.height() and \ - r.x() + textRect.width() < self.rect().width(): + elif ( + r.y() - 3 > textRect.height() and + r.x() + textRect.width() < self.rect().width() + ): # on top, left aligned boundingRect.moveBottomLeft(QPoint(r.x(), r.y() - 3)) textRect.moveBottomLeft(QPoint(r.x() + 2, r.y() - 3)) @@ -205,8 +210,10 @@ # left, top aligned boundingRect.moveTopRight(QPoint(r.x() - 3, r.y())) textRect.moveTopRight(QPoint(r.x() - 5, r.y())) - elif r.bottom() + 3 + textRect.height() < self.rect().bottom() and \ - r.right() > textRect.width(): + elif ( + r.bottom() + 3 + textRect.height() < self.rect().bottom() and + r.right() > textRect.width() + ): # at bottom, right aligned boundingRect.moveTopRight(QPoint(r.right(), r.bottom() + 3)) textRect.moveTopRight(QPoint(r.right() - 2, r.bottom() + 3)) @@ -220,9 +227,11 @@ drawRect(painter, boundingRect, textColor, textBackgroundColor) painter.drawText(textRect, Qt.AlignHCenter, txt) - if (r.height() > self.__handleSize * 2 and - r.width() > self.__handleSize * 2) or \ - not self.__mouseDown: + if ( + (r.height() > self.__handleSize * 2 and + r.width() > self.__handleSize * 2) or + not self.__mouseDown + ): self.__updateHandles() painter.setPen(Qt.NoPen) painter.setBrush(handleColor) @@ -308,20 +317,20 @@ r = QRect(self.__selectionBeforeDrag) offset = evt.pos() - self.__dragStartPoint - if self.__mouseOverHandle in \ - [self.__TLHandle, self.__THandle, self.__TRHandle]: + if self.__mouseOverHandle in [ + self.__TLHandle, self.__THandle, self.__TRHandle]: r.setTop(r.top() + offset.y()) - if self.__mouseOverHandle in \ - [self.__TLHandle, self.__LHandle, self.__BLHandle]: + if self.__mouseOverHandle in [ + self.__TLHandle, self.__LHandle, self.__BLHandle]: r.setLeft(r.left() + offset.x()) - if self.__mouseOverHandle in \ - [self.__BLHandle, self.__BHandle, self.__BRHandle]: + if self.__mouseOverHandle in [ + self.__BLHandle, self.__BHandle, self.__BRHandle]: r.setBottom(r.bottom() + offset.y()) - if self.__mouseOverHandle in \ - [self.__TRHandle, self.__RHandle, self.__BRHandle]: + if self.__mouseOverHandle in [ + self.__TRHandle, self.__RHandle, self.__BRHandle]: r.setRight(r.right() + offset.x()) r.setTopLeft(self.__limitPointToRect(r.topLeft(), self.rect())) @@ -369,8 +378,10 @@ """ self.__mouseDown = False self.__newSelection = False - if self.__mouseOverHandle is None and \ - self.__selection.contains(evt.pos()): + if ( + self.__mouseOverHandle is None and + self.__selection.contains(evt.pos()) + ): self.setCursor(Qt.OpenHandCursor) self.update()
--- a/eric6/SqlBrowser/SqlBrowserWidget.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/SqlBrowser/SqlBrowserWidget.py Mon Sep 23 19:22:12 2019 +0200 @@ -11,8 +11,9 @@ from PyQt5.QtCore import pyqtSignal, QVariant, Qt, pyqtSlot from PyQt5.QtGui import QStandardItemModel from PyQt5.QtWidgets import QWidget, QDialog, QAbstractItemView -from PyQt5.QtSql import QSqlDatabase, QSqlError, QSqlTableModel, \ - QSqlQueryModel, QSqlQuery +from PyQt5.QtSql import ( + QSqlDatabase, QSqlError, QSqlTableModel, QSqlQueryModel, QSqlQuery +) from E5Gui import E5MessageBox
--- a/eric6/SqlBrowser/SqlConnectionWidget.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/SqlBrowser/SqlConnectionWidget.py Mon Sep 23 19:22:12 2019 +0200 @@ -9,8 +9,9 @@ from PyQt5.QtCore import pyqtSignal, Qt -from PyQt5.QtWidgets import QWidget, QHeaderView, QTreeWidget, QVBoxLayout, \ - QTreeWidgetItem, QAction +from PyQt5.QtWidgets import ( + QWidget, QHeaderView, QTreeWidget, QVBoxLayout, QTreeWidgetItem, QAction +) from PyQt5.QtSql import QSqlDatabase
--- a/eric6/Tasks/TaskFilter.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Tasks/TaskFilter.py Mon Sep 23 19:22:12 2019 +0200 @@ -109,12 +109,14 @@ @return flag indicating an active filter was found (boolean) """ - return self.summaryFilter is not None or \ - self.filenameFilter is not None or \ - self.typeFilter != Task.TypeNone or \ - self.scopeFilter is not None or \ - self.statusFilter is not None or \ + return ( + self.summaryFilter is not None or + self.filenameFilter is not None or + self.typeFilter != Task.TypeNone or + self.scopeFilter is not None or + self.statusFilter is not None or self.prioritiesFilter is not None + ) def showTask(self, task): """ @@ -126,28 +128,40 @@ if not self.active: return True - if self.summaryFilter and \ - self.summaryFilter.indexIn(task.summary) == -1: + if ( + self.summaryFilter and + self.summaryFilter.indexIn(task.summary) == -1 + ): return False - if self.filenameFilter and \ - not self.filenameFilter.exactMatch(task.filename): + if ( + self.filenameFilter and + not self.filenameFilter.exactMatch(task.filename) + ): return False - if self.typeFilter != Task.TypeNone and \ - self.typeFilter != task.taskType: + if ( + self.typeFilter != Task.TypeNone and + self.typeFilter != task.taskType + ): return False - if self.scopeFilter is not None and \ - self.scopeFilter != task._isProjectTask: + if ( + self.scopeFilter is not None and + self.scopeFilter != task._isProjectTask + ): return False - if self.statusFilter is not None and \ - self.statusFilter != task.completed: + if ( + self.statusFilter is not None and + self.statusFilter != task.completed + ): return False - if self.prioritiesFilter is not None and \ - task.priority not in self.prioritiesFilter: + if ( + self.prioritiesFilter is not None and + task.priority not in self.prioritiesFilter + ): return False return True
--- a/eric6/Tasks/TaskFilterConfigDialog.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Tasks/TaskFilterConfigDialog.py Mon Sep 23 19:22:12 2019 +0200 @@ -35,16 +35,20 @@ self.typeCombo.addItem(self.tr("ToDo"), Task.TypeTodo) self.typeCombo.addItem(self.tr("Note"), Task.TypeNote) - if taskFilter.summaryFilter is None or \ - not taskFilter.summaryFilter.pattern(): + if ( + taskFilter.summaryFilter is None or + not taskFilter.summaryFilter.pattern() + ): self.summaryGroup.setChecked(False) self.summaryEdit.clear() else: self.summaryGroup.setChecked(True) self.summaryEdit.setText(taskFilter.summaryFilter.pattern()) - if taskFilter.filenameFilter is None or \ - not taskFilter.filenameFilter.pattern(): + if ( + taskFilter.filenameFilter is None or + not taskFilter.filenameFilter.pattern() + ): self.filenameGroup.setChecked(False) self.filenameEdit.clear() else:
--- a/eric6/Tasks/TaskViewer.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Tasks/TaskViewer.py Mon Sep 23 19:22:12 2019 +0200 @@ -17,8 +17,10 @@ import threading from PyQt5.QtCore import pyqtSignal, Qt, QThread -from PyQt5.QtWidgets import QHeaderView, QLineEdit, QTreeWidget, QDialog, \ - QInputDialog, QApplication, QMenu, QAbstractItemView, QTreeWidgetItem +from PyQt5.QtWidgets import ( + QHeaderView, QLineEdit, QTreeWidget, QDialog, QInputDialog, QApplication, + QMenu, QAbstractItemView, QTreeWidgetItem +) from E5Gui.E5Application import e5App from E5Gui import E5MessageBox @@ -246,9 +248,11 @@ @param itm reference to the activated item (QTreeWidgetItem) @param col column the item was activated in (integer) """ - if not self.__activating and \ - itm is not self.__extractedItem and \ - itm is not self.__manualItem: + if ( + not self.__activating and + itm is not self.__extractedItem and + itm is not self.__manualItem + ): self.__activating = True fn = itm.getFilename() if fn: @@ -269,9 +273,11 @@ """ itm = self.itemAt(coord) coord = self.mapToGlobal(coord) - if itm is None or \ - itm is self.__extractedItem or \ - itm is self.__manualItem: + if ( + itm is None or + itm is self.__extractedItem or + itm is self.__manualItem + ): self.backProjectTasksMenuItem.setEnabled(self.projectOpen) if self.copyTask: self.backPasteItem.setEnabled(True) @@ -413,8 +419,10 @@ project tasks (boolean) """ for task in reversed(self.tasks[:]): - if (fileOnly and task.isProjectFileTask()) or \ - (not fileOnly and task.isProjectTask()): + if ( + (fileOnly and task.isProjectFileTask()) or + (not fileOnly and task.isProjectTask()) + ): if self.copyTask == task: self.copyTask = None parent = task.parent() @@ -465,8 +473,9 @@ if ro: dlg.setReadOnly() if dlg.exec_() == QDialog.Accepted and not ro: - summary, priority, completed, isProjectTask, description = \ + summary, priority, completed, isProjectTask, description = ( dlg.getData() + ) task.setSummary(summary) task.setPriority(priority) task.setCompleted(completed) @@ -481,8 +490,9 @@ from .TaskPropertiesDialog import TaskPropertiesDialog dlg = TaskPropertiesDialog(None, self, self.projectOpen) if dlg.exec_() == QDialog.Accepted: - summary, priority, completed, isProjectTask, description = \ + summary, priority, completed, isProjectTask, description = ( dlg.getData() + ) self.addTask(summary, priority, completed=completed, isProjectTask=isProjectTask, description=description) @@ -497,8 +507,9 @@ dlg = TaskPropertiesDialog(None, self, self.projectOpen) dlg.setSubTaskMode(projectTask) if dlg.exec_() == QDialog.Accepted: - summary, priority, completed, isProjectTask, description = \ + summary, priority, completed, isProjectTask, description = ( dlg.getData() + ) self.addTask(summary, priority, completed=completed, isProjectTask=isProjectTask, description=description, parentTask=parentTask)
--- a/eric6/Templates/TemplateMultipleVariablesDialog.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Templates/TemplateMultipleVariablesDialog.py Mon Sep 23 19:22:12 2019 +0200 @@ -9,9 +9,10 @@ from PyQt5.QtCore import QSize, Qt -from PyQt5.QtWidgets import QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, \ - QLineEdit, QPushButton, QTextEdit, QDialog, QScrollArea, QFrame, \ - QGridLayout, QVBoxLayout, QLabel +from PyQt5.QtWidgets import ( + QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QLineEdit, QPushButton, + QTextEdit, QDialog, QScrollArea, QFrame, QGridLayout, QVBoxLayout, QLabel +) class TemplateMultipleVariablesDialog(QDialog):
--- a/eric6/Templates/TemplateViewer.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Templates/TemplateViewer.py Mon Sep 23 19:22:12 2019 +0200 @@ -13,8 +13,9 @@ import re from PyQt5.QtCore import QFile, QFileInfo, QIODevice, Qt, QCoreApplication -from PyQt5.QtWidgets import QTreeWidget, QDialog, QApplication, QMenu, \ - QTreeWidgetItem +from PyQt5.QtWidgets import ( + QTreeWidget, QDialog, QApplication, QMenu, QTreeWidgetItem +) from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog @@ -105,8 +106,10 @@ self.entries[name] = TemplateEntry(self, name, description, template) - if Preferences.getTemplates("AutoOpenGroups") and \ - not self.isExpanded(): + if ( + Preferences.getTemplates("AutoOpenGroups") and + not self.isExpanded() + ): self.setExpanded(True) def removeEntry(self, name): @@ -121,8 +124,10 @@ del self.entries[name] if len(self.entries) == 0: - if Preferences.getTemplates("AutoOpenGroups") and \ - self.isExpanded(): + if ( + Preferences.getTemplates("AutoOpenGroups") and + self.isExpanded() + ): self.setExpanded(False) def removeAllEntries(self): @@ -355,10 +360,10 @@ Private method to retrieve the list of variables. """ sepchar = Preferences.getTemplates("SeparatorChar") - variablesPattern = \ - re.compile( - r"""\{0}[a-zA-Z][a-zA-Z0-9_]*(?::(?:ml|rl))?\{1}""".format( - sepchar, sepchar)) + variablesPattern = re.compile( + r"""\{0}[a-zA-Z][a-zA-Z0-9_]*(?::(?:ml|rl))?\{1}""".format( + sepchar, sepchar) + ) variables = variablesPattern.findall(self.template) self.variables = [] self.formatedVariables = [] @@ -664,10 +669,10 @@ keyfmt.format('ext'): ext }) - varValues[keyfmt.format('clipboard:ml')] = \ + varValues[keyfmt.format('clipboard:ml')] = ( QApplication.clipboard().text() - varValues[keyfmt.format('clipboard')] = \ - QApplication.clipboard().text() + ) + varValues[keyfmt.format('clipboard')] = QApplication.clipboard().text() if editor.hasSelectedText(): varValues[keyfmt.format('cur_select:ml')] = editor.selectedText() @@ -705,15 +710,17 @@ if variables: if Preferences.getTemplates("SingleDialog"): - from .TemplateMultipleVariablesDialog import \ + from .TemplateMultipleVariablesDialog import ( TemplateMultipleVariablesDialog + ) dlg = TemplateMultipleVariablesDialog(variables, self) if dlg.exec_() == QDialog.Accepted: varValues.update(dlg.getVariables()) ok = True else: - from .TemplateSingleVariableDialog import \ + from .TemplateSingleVariableDialog import ( TemplateSingleVariableDialog + ) for var in variables: dlg = TemplateSingleVariableDialog(var, self) if dlg.exec_() == QDialog.Accepted: @@ -726,8 +733,8 @@ ok = True if ok: - line = editor.text(editor.getCursorPosition()[0])\ - .replace(os.linesep, "") + line = editor.text( + editor.getCursorPosition()[0]).replace(os.linesep, "") indent = line.replace(line.lstrip(), "") txt, lines, count = itm.getExpandedText(varValues, indent) # It should be done in this way to allow undo @@ -745,8 +752,10 @@ count += len(indent) if "i_n_s_e_r_t_i_o_n" in txt and "s_e_l_e_c_t" in txt: - txt = "'Insertion and selection can not be in" \ + txt = ( + "'Insertion and selection can not be in" " template together'" + ) if "i_n_s_e_r_t_i_o_n" in txt: lines = 1
--- a/eric6/Tools/TRPreviewer.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Tools/TRPreviewer.py Mon Sep 23 19:22:12 2019 +0200 @@ -10,12 +10,15 @@ import os -from PyQt5.QtCore import QDir, QTimer, QFileInfo, pyqtSignal, QEvent, QSize, \ - QTranslator, QObject, Qt, QCoreApplication +from PyQt5.QtCore import ( + QDir, QTimer, QFileInfo, pyqtSignal, QEvent, QSize, QTranslator, QObject, + Qt, QCoreApplication +) from PyQt5.QtGui import QKeySequence -from PyQt5.QtWidgets import QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, \ - QWhatsThis, QMdiArea, qApp, QApplication, QComboBox, QVBoxLayout, \ - QAction, QLabel +from PyQt5.QtWidgets import ( + QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QMdiArea, + qApp, QApplication, QComboBox, QVBoxLayout, QAction, QLabel +) from PyQt5 import uic
--- a/eric6/Tools/TRSingleApplication.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Tools/TRSingleApplication.py Mon Sep 23 19:22:12 2019 +0200 @@ -12,8 +12,9 @@ from PyQt5.QtCore import pyqtSignal -from Toolbox.SingleApplication import SingleApplicationClient, \ - SingleApplicationServer +from Toolbox.SingleApplication import ( + SingleApplicationClient, SingleApplicationServer +) ########################################################################### ## define some module global stuff
--- a/eric6/Tools/TrayStarter.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Tools/TrayStarter.py Mon Sep 23 19:22:12 2019 +0200 @@ -69,8 +69,8 @@ self.__showRecentProjectsMenu) self.recentProjectsMenu.triggered.connect(self.__openRecent) - self.recentMultiProjectsMenu = \ - QMenu(self.tr('Recent Multiprojects'), self.__menu) + self.recentMultiProjectsMenu = QMenu( + self.tr('Recent Multiprojects'), self.__menu) self.recentMultiProjectsMenu.aboutToShow.connect( self.__showRecentMultiProjectsMenu) self.recentMultiProjectsMenu.triggered.connect(self.__openRecent) @@ -217,8 +217,10 @@ @param reason reason code of the signal (QSystemTrayIcon.ActivationReason) """ - if reason == QSystemTrayIcon.Context or \ - reason == QSystemTrayIcon.MiddleClick: + if ( + reason == QSystemTrayIcon.Context or + reason == QSystemTrayIcon.MiddleClick + ): self.__showContextMenu() elif reason == QSystemTrayIcon.DoubleClick: self.__startEric() @@ -257,8 +259,10 @@ for arg in applArgs: args.append(arg) - if not os.path.isfile(applPath) or \ - not proc.startDetached(sys.executable, args): + if ( + not os.path.isfile(applPath) or + not proc.startDetached(sys.executable, args) + ): E5MessageBox.critical( self, self.tr('Process Generation Error'), @@ -516,26 +520,39 @@ versionText = self.tr( """<h3>Version Numbers</h3>""" """<table>""") - versionText += """<tr><td><b>Python</b></td><td>{0}</td></tr>"""\ + versionText += ( + """<tr><td><b>Python</b></td><td>{0}</td></tr>""" .format(sys.version.split()[0]) - versionText += """<tr><td><b>Qt</b></td><td>{0}</td></tr>"""\ + ) + versionText += ( + """<tr><td><b>Qt</b></td><td>{0}</td></tr>""" .format(qVersion()) - versionText += """<tr><td><b>PyQt</b></td><td>{0}</td></tr>"""\ + ) + versionText += ( + """<tr><td><b>PyQt</b></td><td>{0}</td></tr>""" .format(PYQT_VERSION_STR) - versionText += """<tr><td><b>sip</b></td><td>{0}</td></tr>"""\ + ) + versionText += ( + """<tr><td><b>sip</b></td><td>{0}</td></tr>""" .format(sip_version_str) - versionText += """<tr><td><b>QScintilla</b></td><td>{0}</td></tr>"""\ + ) + versionText += ( + """<tr><td><b>QScintilla</b></td><td>{0}</td></tr>""" .format(QSCINTILLA_VERSION_STR) + ) try: from WebBrowser.Tools import WebBrowserTools chromeVersion = WebBrowserTools.getWebEngineVersions()[0] - versionText += \ - """<tr><td><b>WebEngine</b></td><td>{0}</td></tr>"""\ + versionText += ( + """<tr><td><b>WebEngine</b></td><td>{0}</td></tr>""" .format(chromeVersion) + ) except ImportError: pass - versionText += """<tr><td><b>{0}</b></td><td>{1}</td></tr>"""\ + versionText += ( + """<tr><td><b>{0}</b></td><td>{1}</td></tr>""" .format(Program, Version) + ) versionText += self.tr("""</table>""") E5MessageBox.about(None, Program, versionText)
--- a/eric6/Tools/UIPreviewer.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Tools/UIPreviewer.py Mon Sep 23 19:22:12 2019 +0200 @@ -10,9 +10,11 @@ from PyQt5.QtCore import QDir, QFileInfo, QEvent, QSize, Qt from PyQt5.QtGui import QCursor, QKeySequence, QImageWriter, QPainter -from PyQt5.QtWidgets import QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, \ - QWhatsThis, QDialog, QScrollArea, qApp, QApplication, QStyleFactory, \ - QFrame, QMainWindow, QComboBox, QVBoxLayout, QAction, QLabel +from PyQt5.QtWidgets import ( + QSizePolicy, QSpacerItem, QWidget, QHBoxLayout, QWhatsThis, QDialog, + QScrollArea, qApp, QApplication, QStyleFactory, QFrame, QMainWindow, + QComboBox, QVBoxLayout, QAction, QLabel +) from PyQt5.QtPrintSupport import QPrinter, QPrintDialog from PyQt5 import uic @@ -349,8 +351,10 @@ if self.mainWidget: self.currentFile = fn self.__updateChildren(self.styleCombo.currentText()) - if isinstance(self.mainWidget, QDialog) or \ - isinstance(self.mainWidget, QMainWindow): + if ( + isinstance(self.mainWidget, QDialog) or + isinstance(self.mainWidget, QMainWindow) + ): self.mainWidget.show() self.mainWidget.installEventFilter(self) else:
--- a/eric6/Utilities/BackgroundClient.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/BackgroundClient.py Mon Sep 23 19:22:12 2019 +0200 @@ -63,8 +63,9 @@ importedModule = __import__(module, globals(), locals(), [], 0) self.services[fn] = importedModule.initService() try: - self.batchServices["batch_" + fn] = \ + self.batchServices["batch_" + fn] = ( importedModule.initBatchService() + ) except AttributeError: pass return 'ok'
--- a/eric6/Utilities/BackgroundService.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/BackgroundService.py Mon Sep 23 19:22:12 2019 +0200 @@ -70,8 +70,8 @@ for pyName in ['Python2', 'Python3']: venvName = Preferences.getDebugger( pyName + "VirtualEnv") - interpreter = e5App().getObject("VirtualEnvManager")\ - .getVirtualenvInterpreter(venvName) + interpreter = e5App().getObject( + "VirtualEnvManager").getVirtualenvInterpreter(venvName) if not interpreter and int(pyName[-1]) == sys.version_info[0]: interpreter = sys.executable.replace("w.exe", ".exe") if interpreter: @@ -249,8 +249,8 @@ for pyName in ['Python2', 'Python3']: venvName = Preferences.getDebugger( pyName + "VirtualEnv") - interpreter = e5App().getObject("VirtualEnvManager")\ - .getVirtualenvInterpreter(venvName) + interpreter = e5App().getObject( + "VirtualEnvManager").getVirtualenvInterpreter(venvName) if not interpreter and int(pyName[-1]) == sys.version_info[0]: interpreter = sys.executable.replace("w.exe", ".exe") @@ -355,8 +355,9 @@ (function) @param onBatchDone function called when a batch job is done (function) """ - self.services[(fx, lang)] = \ + self.services[(fx, lang)] = ( modulepath, module, callback, onErrorCallback + ) self.enqueueRequest('INIT', lang, fx, [modulepath, module]) if onErrorCallback: self.serviceNotAvailable.connect(onErrorCallback)
--- a/eric6/Utilities/ClassBrowsers/__init__.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/ClassBrowsers/__init__.py Mon Sep 23 19:22:12 2019 +0200 @@ -80,9 +80,11 @@ from . import jsclbr dictionary = jsclbr.readmodule_ex(module, path) jsclbr._modules.clear() - elif ext in Preferences.getPython("PythonExtensions") or \ - ext in Preferences.getPython("Python3Extensions") or \ - isPyFile: + elif ( + ext in Preferences.getPython("PythonExtensions") or + ext in Preferences.getPython("Python3Extensions") or + isPyFile + ): from . import pyclbr dictionary = pyclbr.readmodule_ex(module, path, isPyFile=isPyFile) pyclbr._modules.clear() @@ -158,10 +160,12 @@ try: return imp.find_module(name, path) except ImportError: - if name.lower().endswith( + if ( + name.lower().endswith( tuple(Preferences.getPython("PythonExtensions") + - Preferences.getPython("Python3Extensions"))) or \ - isPyFile: + Preferences.getPython("Python3Extensions"))) or + isPyFile + ): for p in path: # search in path pathname = os.path.join(p, name) if os.path.exists(pathname):
--- a/eric6/Utilities/ClassBrowsers/idlclbr.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/ClassBrowsers/idlclbr.py Mon Sep 23 19:22:12 2019 +0200 @@ -262,8 +262,7 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start # close all interfaces/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -271,8 +270,10 @@ if classstack: # it's an interface/module method cur_class = classstack[-1][0] - if isinstance(cur_class, Interface) or \ - isinstance(cur_class, Module): + if ( + isinstance(cur_class, Interface) or + isinstance(cur_class, Module) + ): # it's a method f = Function(None, meth_name, file, lineno, meth_sig) @@ -311,8 +312,7 @@ thisindent = indent indent += 1 # close all interfaces/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -347,8 +347,7 @@ thisindent = indent indent += 1 # close all interfaces/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -373,9 +372,11 @@ last_lineno_pos = start index = -1 while index >= -len(classstack): - if classstack[index][0] is not None and \ - not isinstance(classstack[index][0], Function) and \ - not classstack[index][1] >= indent: + if ( + classstack[index][0] is not None and + not isinstance(classstack[index][0], Function) and + not classstack[index][1] >= indent + ): attributes = m.group("AttributeNames").split(',') ro = m.group("AttributeReadonly") for attribute in attributes:
--- a/eric6/Utilities/ClassBrowsers/jsclbr.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/ClassBrowsers/jsclbr.py Mon Sep 23 19:22:12 2019 +0200 @@ -151,9 +151,11 @@ @param node reference to the node (jasy.script.parse.Node.Node) """ - if node.type == "function" and \ - getattr(node, "name", None) and \ - node.functionForm == "declared_form": + if ( + node.type == "function" and + getattr(node, "name", None) and + node.functionForm == "declared_form" + ): if self.__stack and self.__stack[-1].endlineno < node.line: del self.__stack[-1] endline = node.line + self.__source.count( @@ -225,9 +227,11 @@ @param node reference to the node (jasy.script.parse.Node.Node) """ - if node.type == "var" and \ - node.parent.type == "script" and \ - node.getChildrenLength(): + if ( + node.type == "var" and + node.parent.type == "script" and + node.getChildrenLength() + ): if self.__stack and self.__stack[-1].endlineno < node[0].line: del self.__stack[-1] if self.__stack: @@ -251,9 +255,11 @@ @param node reference to the node (jasy.script.parse.Node.Node) """ - if node.type == "const" and \ - node.parent.type == "script" and \ - node.getChildrenLength(): + if ( + node.type == "const" and + node.parent.type == "script" and + node.getChildrenLength() + ): if self.__stack and self.__stack[-1].endlineno < node[0].line: del self.__stack[-1] if self.__stack:
--- a/eric6/Utilities/ClassBrowsers/protoclbr.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/ClassBrowsers/protoclbr.py Mon Sep 23 19:22:12 2019 +0200 @@ -256,8 +256,7 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start # close all interfaces/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -296,8 +295,7 @@ thisindent = indent indent += 1 # close all messages/services indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -324,8 +322,7 @@ thisindent = indent indent += 1 # close all messages/services indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -352,8 +349,7 @@ thisindent = indent indent += 1 # close all messages/services indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1)
--- a/eric6/Utilities/ClassBrowsers/pyclbr.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/ClassBrowsers/pyclbr.py Mon Sep 23 19:22:12 2019 +0200 @@ -362,22 +362,22 @@ f = None if inpackage: try: - f, file, (suff, mode, type) = \ - ClassBrowsers.find_module(module, path) + f, file, (suff, mode, type) = ClassBrowsers.find_module( + module, path) except ImportError: f = None if f is None: fullpath = path[:] + sys.path[:] - f, file, (suff, mode, type) = \ - ClassBrowsers.find_module(module, fullpath, isPyFile) + f, file, (suff, mode, type) = ClassBrowsers.find_module( + module, fullpath, isPyFile) if module.endswith(".py") and type == imp.PKG_DIRECTORY: return dictionary if type == imp.PKG_DIRECTORY: dictionary['__path__'] = [file] _modules[module] = dictionary path = [file] + path - f, file, (suff, mode, type) = \ - ClassBrowsers.find_module('__init__', [file]) + f, file, (suff, mode, type) = ClassBrowsers.find_module( + '__init__', [file]) if f: f.close() if type not in SUPPORTED_TYPES: @@ -444,15 +444,16 @@ deltaindentcalculated = 1 thisindent -= deltaindent else: - while conditionalsstack and \ - conditionalsstack[-1] >= thisindent: + while ( + conditionalsstack and + conditionalsstack[-1] >= thisindent + ): del conditionalsstack[-1] if deltastack: del deltastack[-1] deltaindentcalculated = 0 # close all classes indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -498,8 +499,7 @@ # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -558,8 +558,10 @@ last_lineno_pos = start index = -1 while index >= -len(classstack): - if classstack[index][0] is not None and \ - not isinstance(classstack[index][0], Function): + if ( + classstack[index][0] is not None and + not isinstance(classstack[index][0], Function) + ): attr = Attribute( module, m.group("AttributeName"), file, lineno) classstack[index][0]._addattribute(attr) @@ -641,8 +643,7 @@ elif m.start("ConditionalDefine") >= 0: # a conditional function/method definition thisindent = _indent(m.group("ConditionalDefineIndent")) - while conditionalsstack and \ - conditionalsstack[-1] >= thisindent: + while conditionalsstack and conditionalsstack[-1] >= thisindent: del conditionalsstack[-1] if deltastack: del deltastack[-1]
--- a/eric6/Utilities/ClassBrowsers/rbclbr.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/ClassBrowsers/rbclbr.py Mon Sep 23 19:22:12 2019 +0200 @@ -303,9 +303,11 @@ # found a method definition or function thisindent = indent indent += 1 - meth_name = m.group("MethodName") or \ - m.group("MethodName2") or \ + meth_name = ( + m.group("MethodName") or + m.group("MethodName2") or m.group("MethodName3") + ) meth_sig = m.group("MethodSignature") meth_sig = meth_sig and meth_sig.replace('\\\n', '') or '' meth_sig = _commentsub('', meth_sig) @@ -316,20 +318,20 @@ elif meth_name.startswith('self::'): meth_name = meth_name[6:] # close all classes/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] - while acstack and \ - acstack[-1][1] >= thisindent: + while acstack and acstack[-1][1] >= thisindent: del acstack[-1] if classstack: # it's a class/module method cur_class = classstack[-1][0] - if isinstance(cur_class, Class) or \ - isinstance(cur_class, Module): + if ( + isinstance(cur_class, Class) or + isinstance(cur_class, Module) + ): # it's a method f = Function(None, meth_name, file, lineno, meth_sig) @@ -382,8 +384,7 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start # close all classes/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -416,8 +417,7 @@ lastGlobalEntry = cur_class cur_obj = cur_class classstack.append((cur_class, thisindent)) - while acstack and \ - acstack[-1][1] >= thisindent: + while acstack and acstack[-1][1] >= thisindent: del acstack[-1] acstack.append(["public", thisindent]) # default access control is 'public' @@ -429,8 +429,7 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start # close all classes/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: + while classstack and classstack[-1][1] >= thisindent: if classstack[-1][0] is not None: # record the end line classstack[-1][0].setEndLine(lineno - 1) @@ -457,8 +456,7 @@ lastGlobalEntry = cur_class cur_obj = cur_class classstack.append((cur_class, thisindent)) - while acstack and \ - acstack[-1][1] >= thisindent: + while acstack and acstack[-1][1] >= thisindent: del acstack[-1] acstack.append(["public", thisindent]) # default access control is 'public' @@ -469,8 +467,10 @@ index = -1 while index >= -len(acstack): if acstack[index][1] < indent: - actype = m.group("AccessControlType") or \ + actype = ( + m.group("AccessControlType") or m.group("AccessControlType2").split('_')[0] + ) acstack[index][0] = actype.lower() break else: @@ -478,12 +478,16 @@ else: index = -1 while index >= -len(classstack): - if classstack[index][0] is not None and \ - not isinstance(classstack[index][0], Function) and \ - not classstack[index][1] >= indent: + if ( + classstack[index][0] is not None and + not isinstance(classstack[index][0], Function) and + not classstack[index][1] >= indent + ): parent = classstack[index][0] - actype = m.group("AccessControlType") or \ + actype = ( + m.group("AccessControlType") or m.group("AccessControlType2").split('_')[0] + ) actype = actype.lower() for name in aclist.split(","): name = name.strip()[1:] # get rid of leading ':' @@ -505,9 +509,11 @@ last_lineno_pos = start index = -1 while index >= -len(classstack): - if classstack[index][0] is not None and \ - not isinstance(classstack[index][0], Function) and \ - not classstack[index][1] >= indent: + if ( + classstack[index][0] is not None and + not isinstance(classstack[index][0], Function) and + not classstack[index][1] >= indent + ): attr = Attribute( module, m.group("AttributeName"), file, lineno) classstack[index][0]._addattribute(attr) @@ -523,18 +529,22 @@ last_lineno_pos = start index = -1 while index >= -len(classstack): - if classstack[index][0] is not None and \ - not isinstance(classstack[index][0], Function) and \ - not classstack[index][1] >= indent: + if ( + classstack[index][0] is not None and + not isinstance(classstack[index][0], Function) and + not classstack[index][1] >= indent + ): parent = classstack[index][0] if m.group("AttrType") is None: nv = m.group("AttrList").split(",") if not nv: break name = nv[0].strip()[1:] # get rid of leading ':' - attr = parent._getattribute("@" + name) or \ - parent._getattribute("@@" + name) or \ + attr = ( + parent._getattribute("@" + name) or + parent._getattribute("@@" + name) or Attribute(module, "@" + name, file, lineno) + ) if len(nv) == 1 or nv[1].strip() == "false": attr.setProtected() elif nv[1].strip() == "true": @@ -544,9 +554,11 @@ access = m.group("AttrType") for name in m.group("AttrList").split(","): name = name.strip()[1:] # get rid of leading ':' - attr = parent._getattribute("@" + name) or \ - parent._getattribute("@@" + name) or \ + attr = ( + parent._getattribute("@" + name) or + parent._getattribute("@@" + name) or Attribute(module, "@" + name, file, lineno) + ) if access == "_accessor": attr.setPublic() elif access == "_reader" or access == "_writer":
--- a/eric6/Utilities/FtpUtilities.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/FtpUtilities.py Mon Sep 23 19:22:12 2019 +0200 @@ -59,8 +59,10 @@ @param line to check (string) @return flag indicating to ignore the line (boolean) """ - return line.strip() == "" or \ + return ( + line.strip() == "" or line.strip().lower().startswith("total ") + ) def __parseUnixMode(self, modeString, urlInfo): """ @@ -197,8 +199,9 @@ @param line directory line to be parsed (string) @return URL info object containing the valid data (E5UrlInfo) """ - modeString, nlink, user, group, size, month, day, \ - yearOrTime, name = self.__splitUnixLine(line) + modeString, nlink, user, group, size, month, day, yearOrTime, name = ( + self.__splitUnixLine(line) + ) if name in [".", ".."]: return None @@ -297,8 +300,9 @@ E5UrlInfo.ReadGroup | E5UrlInfo.WriteGroup | E5UrlInfo.ReadOther | E5UrlInfo.WriteOther) if ext in [".exe", ".com", ".bat", ".cmd"]: - permissions |= E5UrlInfo.ExeOwner | E5UrlInfo.ExeGroup | \ - E5UrlInfo.ExeOther + permissions |= ( + E5UrlInfo.ExeOwner | E5UrlInfo.ExeGroup | E5UrlInfo.ExeOther + ) urlInfo.setPermissions(permissions) return urlInfo
--- a/eric6/Utilities/ModuleParser.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/ModuleParser.py Mon Sep 23 19:22:12 2019 +0200 @@ -555,11 +555,13 @@ meth_ret = m.group("MethodReturnAnnotation") meth_ret = meth_ret.replace('\\\n', '') if m.group("MethodPyQtSignature") is not None: - meth_pyqtSig = m.group("MethodPyQtSignature")\ - .replace('\\\n', '')\ - .split('result')[0]\ - .split('name')[0]\ - .strip("\"', \t") + meth_pyqtSig = ( + m.group("MethodPyQtSignature") + .replace('\\\n', '') + .split('result')[0] + .split('name')[0] + .strip("\"', \t") + ) else: meth_pyqtSig = None lineno = lineno + src.count('\n', last_lineno_pos, start) @@ -584,17 +586,20 @@ deltaindentcalculated = 1 thisindent -= deltaindent else: - while conditionalsstack and \ - conditionalsstack[-1] >= thisindent: + while ( + conditionalsstack and + conditionalsstack[-1] >= thisindent + ): del conditionalsstack[-1] if deltastack: del deltastack[-1] deltaindentcalculated = 0 # close all classes indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: - if classstack[-1][0] is not None and \ - isinstance(classstack[-1][0], (Class, Function)): + while classstack and classstack[-1][1] >= thisindent: + if ( + classstack[-1][0] is not None and + isinstance(classstack[-1][0], (Class, Function)) + ): # record the end line of this class or function classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] @@ -652,16 +657,21 @@ if self.file.lower().endswith('.ptl'): contents = "" else: - contents = m.group("DocstringContents1") \ - or m.group("DocstringContents2") + contents = ( + m.group("DocstringContents1") or + m.group("DocstringContents2") + ) if cur_obj: cur_obj.addDescription(contents) elif m.start("String") >= 0: - if modulelevel and \ - (src[start - len('\r\n'):start] == '\r\n' or - src[start - len('\n'):start] == '\n' or - src[start - len('\r'):start] == '\r'): + if ( + modulelevel and ( + src[start - len('\r\n'):start] == '\r\n' or + src[start - len('\n'):start] == '\n' or + src[start - len('\r'):start] == '\r' + ) + ): contents = m.group("StringContents3") if contents is not None: contents = _hashsub(r"\1", contents) @@ -669,8 +679,10 @@ if self.file.lower().endswith('.ptl'): contents = "" else: - contents = m.group("StringContents1") \ - or m.group("StringContents2") + contents = ( + m.group("StringContents1") or + m.group("StringContents2") + ) if cur_obj: cur_obj.addDescription(contents) @@ -680,10 +692,11 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start # close all classes indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: - if classstack[-1][0] is not None and \ - isinstance(classstack[-1][0], (Class, Function)): + while classstack and classstack[-1][1] >= thisindent: + if ( + classstack[-1][0] is not None and + isinstance(classstack[-1][0], (Class, Function)) + ): # record the end line of this class or function classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] @@ -769,8 +782,10 @@ if classstack[index][1] >= thisindent: index -= 1 else: - if classstack[index][0] is not None and \ - isinstance(classstack[index][0], Class): + if ( + classstack[index][0] is not None and + isinstance(classstack[index][0], Class) + ): attr = Attribute( self.name, variable_name, self.file, lineno, isSignal=isSignal) @@ -809,8 +824,10 @@ elif m.start("ConditionalDefine") >= 0: # a conditional function/method definition thisindent = _indent(m.group("ConditionalDefineIndent")) - while conditionalsstack and \ - conditionalsstack[-1] >= thisindent: + while ( + conditionalsstack and + conditionalsstack[-1] >= thisindent + ): del conditionalsstack[-1] if deltastack: del deltastack[-1] @@ -850,9 +867,11 @@ # found a method definition or function thisindent = indent indent += 1 - meth_name = m.group("MethodName") or \ - m.group("MethodName2") or \ + meth_name = ( + m.group("MethodName") or + m.group("MethodName2") or m.group("MethodName3") + ) meth_sig = m.group("MethodSignature") meth_sig = meth_sig and meth_sig.replace('\\\n', '') or '' lineno = lineno + src.count('\n', last_lineno_pos, start) @@ -862,16 +881,16 @@ elif meth_name.startswith('self::'): meth_name = meth_name[6:] # close all classes/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: - if classstack[-1][0] is not None and \ - isinstance(classstack[-1][0], - (Class, Function, RbModule)): + while classstack and classstack[-1][1] >= thisindent: + if ( + classstack[-1][0] is not None and + isinstance(classstack[-1][0], + (Class, Function, RbModule)) + ): # record the end line of this class, function or module classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] - while acstack and \ - acstack[-1][1] >= thisindent: + while acstack and acstack[-1][1] >= thisindent: del acstack[-1] if classstack: csi = -1 @@ -882,8 +901,10 @@ if cur_class is None: continue - if isinstance(cur_class, Class) or \ - isinstance(cur_class, RbModule): + if ( + isinstance(cur_class, Class) or + isinstance(cur_class, RbModule) + ): # it's a class/module method f = Function(None, meth_name, None, lineno, meth_sig) @@ -940,11 +961,12 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start # close all classes/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: - if classstack[-1][0] is not None and \ - isinstance(classstack[-1][0], - (Class, Function, RbModule)): + while classstack and classstack[-1][1] >= thisindent: + if ( + classstack[-1][0] is not None and + isinstance(classstack[-1][0], + (Class, Function, RbModule)) + ): # record the end line of this class, function or module classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] @@ -964,9 +986,11 @@ parent_obj = self if class_name in parent_obj.classes: cur_class = parent_obj.classes[class_name] - elif classstack and \ - isinstance(classstack[-1][0], Class) and \ - class_name == "self": + elif ( + classstack and + isinstance(classstack[-1][0], Class) and + class_name == "self" + ): cur_class = classstack[-1][0] else: parent_obj.addClass(class_name, cur_class) @@ -976,8 +1000,7 @@ lastGlobalEntry = cur_class cur_obj = cur_class classstack.append((cur_class, thisindent)) - while acstack and \ - acstack[-1][1] >= thisindent: + while acstack and acstack[-1][1] >= thisindent: del acstack[-1] acstack.append(["public", thisindent]) # default access control is 'public' @@ -989,11 +1012,12 @@ lineno = lineno + src.count('\n', last_lineno_pos, start) last_lineno_pos = start # close all classes/modules indented at least as much - while classstack and \ - classstack[-1][1] >= thisindent: - if classstack[-1][0] is not None and \ - isinstance(classstack[-1][0], - (Class, Function, RbModule)): + while classstack and classstack[-1][1] >= thisindent: + if ( + classstack[-1][0] is not None and + isinstance(classstack[-1][0], + (Class, Function, RbModule)) + ): # record the end line of this class, function or module classstack[-1][0].setEndLine(lineno - 1) del classstack[-1] @@ -1012,8 +1036,7 @@ lastGlobalEntry = cur_class cur_obj = cur_class classstack.append((cur_class, thisindent)) - while acstack and \ - acstack[-1][1] >= thisindent: + while acstack and acstack[-1][1] >= thisindent: del acstack[-1] acstack.append(["public", thisindent]) # default access control is 'public' @@ -1024,9 +1047,10 @@ index = -1 while index >= -len(acstack): if acstack[index][1] < indent: - actype = \ - m.group("AccessControlType") or \ + actype = ( + m.group("AccessControlType") or m.group("AccessControlType2").split('_')[0] + ) acstack[index][0] = actype.lower() break else: @@ -1034,13 +1058,16 @@ else: index = -1 while index >= -len(classstack): - if classstack[index][0] is not None and \ - not isinstance(classstack[index][0], Function) and \ - not classstack[index][1] >= indent: + if ( + classstack[index][0] is not None and + not isinstance(classstack[index][0], Function) and + not classstack[index][1] >= indent + ): parent = classstack[index][0] - actype = \ - m.group("AccessControlType") or \ + actype = ( + m.group("AccessControlType") or m.group("AccessControlType2").split('_')[0] + ) actype = actype.lower() for name in aclist.split(","): # get rid of leading ':' @@ -1063,9 +1090,11 @@ last_lineno_pos = start index = -1 while index >= -len(classstack): - if classstack[index][0] is not None and \ - not isinstance(classstack[index][0], Function) and \ - not classstack[index][1] >= indent: + if ( + classstack[index][0] is not None and + not isinstance(classstack[index][0], Function) and + not classstack[index][1] >= indent + ): attrName = m.group("AttributeName") attr = Attribute( self.name, attrName, self.file, lineno) @@ -1091,9 +1120,11 @@ last_lineno_pos = start index = -1 while index >= -len(classstack): - if classstack[index][0] is not None and \ - not isinstance(classstack[index][0], Function) and \ - not classstack[index][1] >= indent: + if ( + classstack[index][0] is not None and + not isinstance(classstack[index][0], Function) and + not classstack[index][1] >= indent + ): parent = classstack[index][0] if m.group("AttrType") is None: nv = m.group("AttrList").split(",") @@ -1101,10 +1132,12 @@ break # get rid of leading ':' name = nv[0].strip()[1:] - attr = parent.getAttribute("@" + name) or \ - parent.getAttribute("@@" + name) or \ + attr = ( + parent.getAttribute("@" + name) or + parent.getAttribute("@@" + name) or Attribute( self.name, "@" + name, self.file, lineno) + ) if len(nv) == 1 or nv[1].strip() == "false": attr.setProtected() elif nv[1].strip() == "true": @@ -1115,15 +1148,19 @@ for name in m.group("AttrList").split(","): # get rid of leading ':' name = name.strip()[1:] - attr = parent.getAttribute("@" + name) or \ - parent.getAttribute("@@" + name) or \ + attr = ( + parent.getAttribute("@" + name) or + parent.getAttribute("@@" + name) or Attribute( self.name, "@" + name, self.file, lineno) + ) if access == "_accessor": attr.setPublic() - elif access == "_reader" or \ - access == "_writer": + elif ( + access == "_reader" or + access == "_writer" + ): if attr.isPrivate(): attr.setProtected() elif attr.isProtected(): @@ -1508,9 +1545,11 @@ path = [os.path.dirname(module)] if module.lower().endswith(".py"): module = module[:-3] - if os.path.exists(os.path.join(path[0], "__init__.py")) or \ - os.path.exists(os.path.join(path[0], "__init__.rb")) or \ - inpackage: + if ( + os.path.exists(os.path.join(path[0], "__init__.py")) or + os.path.exists(os.path.join(path[0], "__init__.rb")) or + inpackage + ): if basename: module = module.replace(basename, "") if os.path.isabs(module): @@ -1648,8 +1687,10 @@ modname = module.replace(os.sep, '.') else: modname = os.path.basename(module) - if modname.lower().endswith(".ptl") or \ - modname.lower().endswith(".pyw"): + if ( + modname.lower().endswith(".ptl") or + modname.lower().endswith(".pyw") + ): modname = modname[:-4] elif modname.lower().endswith(".rb"): modname = modname[:-3]
--- a/eric6/Utilities/PasswordChecker.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/PasswordChecker.py Mon Sep 23 19:22:12 2019 +0200 @@ -388,17 +388,20 @@ self.mirroredSequences["count"] += 1 # Initial score based on length - self.score["count"] = self.passwordLength["count"] * \ - self.passwordLength["factor"] + self.score["count"] = ( + self.passwordLength["count"] * self.passwordLength["factor"] + ) # passwordLength # credit additional length or punish "under" length if self.passwordLength["count"] >= self.passwordLength["minimum"]: # credit additional characters over minimum - self.passwordLength["rating"] = self.passwordLength["bonus"] + \ + self.passwordLength["rating"] = ( + self.passwordLength["bonus"] + (self.passwordLength["count"] - - self.passwordLength["minimum"]) * \ + self.passwordLength["minimum"]) * self.passwordLength["factor"] + ) else: self.passwordLength["rating"] = self.passwordLength["penalty"] self.score["count"] += self.passwordLength["rating"] @@ -406,25 +409,30 @@ # recommendedPasswordLength # Credit reaching the recommended password length or put a # penalty on it - if self.passwordLength["count"] >= \ - self.recommendedPasswordLength["minimum"]: - self.recommendedPasswordLength["rating"] = \ - self.recommendedPasswordLength["bonus"] + \ + if ( + self.passwordLength["count"] >= + self.recommendedPasswordLength["minimum"] + ): + self.recommendedPasswordLength["rating"] = ( + self.recommendedPasswordLength["bonus"] + (self.passwordLength["count"] - - self.recommendedPasswordLength["minimum"]) * \ + self.recommendedPasswordLength["minimum"]) * self.recommendedPasswordLength["factor"] + ) else: - self.recommendedPasswordLength["rating"] = \ + self.recommendedPasswordLength["rating"] = ( self.recommendedPasswordLength["penalty"] + ) self.score["count"] += self.recommendedPasswordLength["rating"] # lowercaseLetters # Honor or punish the lowercase letter use if self.lowercaseLetters["count"] > 0: - self.lowercaseLetters["rating"] = \ - self.lowercaseLetters["bonus"] + \ - self.lowercaseLetters["count"] * \ + self.lowercaseLetters["rating"] = ( + self.lowercaseLetters["bonus"] + + self.lowercaseLetters["count"] * self.lowercaseLetters["factor"] + ) else: self.lowercaseLetters["rating"] = self.lowercaseLetters["penalty"] self.score["count"] += self.lowercaseLetters["rating"] @@ -432,10 +440,11 @@ # uppercaseLetters # Honor or punish the lowercase letter use if self.uppercaseLetters["count"] > 0: - self.uppercaseLetters["rating"] = \ - self.uppercaseLetters["bonus"] + \ - self.uppercaseLetters["count"] * \ + self.uppercaseLetters["rating"] = ( + self.uppercaseLetters["bonus"] + + self.uppercaseLetters["count"] * self.uppercaseLetters["factor"] + ) else: self.uppercaseLetters["rating"] = self.uppercaseLetters["penalty"] self.score["count"] += self.uppercaseLetters["rating"] @@ -443,8 +452,10 @@ # numerics # Honor or punish the numerics use if self.numerics["count"] > 0: - self.numerics["rating"] = self.numerics["bonus"] + \ + self.numerics["rating"] = ( + self.numerics["bonus"] + self.numerics["count"] * self.numerics["factor"] + ) else: self.numerics["rating"] = self.numerics["penalty"] self.score["count"] += self.numerics["rating"] @@ -452,8 +463,10 @@ # symbols # Honor or punish the symbols use if self.symbols["count"] > 0: - self.symbols["rating"] = self.symbols["bonus"] + \ + self.symbols["rating"] = ( + self.symbols["bonus"] + self.symbols["count"] * self.symbols["factor"] + ) else: self.symbols["rating"] = self.symbols["penalty"] self.score["count"] += self.symbols["rating"] @@ -461,8 +474,10 @@ # middleSymbols # Honor or punish the middle symbols use if self.middleSymbols["count"] > 0: - self.middleSymbols["rating"] = self.middleSymbols["bonus"] + \ + self.middleSymbols["rating"] = ( + self.middleSymbols["bonus"] + self.middleSymbols["count"] * self.middleSymbols["factor"] + ) else: self.middleSymbols["rating"] = self.middleSymbols["penalty"] self.score["count"] += self.middleSymbols["rating"] @@ -470,8 +485,10 @@ # middleNumerics # Honor or punish the middle numerics use if self.middleNumerics["count"] > 0: - self.middleNumerics["rating"] = self.middleNumerics["bonus"] + \ + self.middleNumerics["rating"] = ( + self.middleNumerics["bonus"] + self.middleNumerics["count"] * self.middleNumerics["factor"] + ) else: self.middleNumerics["rating"] = self.middleNumerics["penalty"] self.score["count"] += self.middleNumerics["rating"] @@ -479,34 +496,39 @@ # sequentialLetters # Honor or punish the sequential letter use if self.sequentialLetters["count"] == 0: - self.sequentialLetters["rating"] = \ - self.sequentialLetters["bonus"] + \ - self.sequentialLetters["count"] * \ + self.sequentialLetters["rating"] = ( + self.sequentialLetters["bonus"] + + self.sequentialLetters["count"] * self.sequentialLetters["factor"] + ) else: - self.sequentialLetters["rating"] = \ + self.sequentialLetters["rating"] = ( self.sequentialLetters["penalty"] + ) self.score["count"] += self.sequentialLetters["rating"] # sequentialNumerics # Honor or punish the sequential numerics use if self.sequentialNumerics["count"] == 0: - self.sequentialNumerics["rating"] = \ - self.sequentialNumerics["bonus"] + \ - self.sequentialNumerics["count"] * \ + self.sequentialNumerics["rating"] = ( + self.sequentialNumerics["bonus"] + + self.sequentialNumerics["count"] * self.sequentialNumerics["factor"] + ) else: - self.sequentialNumerics["rating"] = \ + self.sequentialNumerics["rating"] = ( self.sequentialNumerics["penalty"] + ) self.score["count"] += self.sequentialNumerics["rating"] # keyboardPatterns # Honor or punish the keyboard patterns use if self.keyboardPatterns["count"] == 0: - self.keyboardPatterns["rating"] = \ - self.keyboardPatterns["bonus"] + \ - self.keyboardPatterns["count"] * \ + self.keyboardPatterns["rating"] = ( + self.keyboardPatterns["bonus"] + + self.keyboardPatterns["count"] * self.keyboardPatterns["factor"] + ) else: self.keyboardPatterns["rating"] = self.keyboardPatterns["penalty"] self.score["count"] += self.keyboardPatterns["rating"] @@ -554,13 +576,15 @@ self.basicRequirements["count"] - self.basicRequirements["minimum"]) if self.basicRequirements["status"] != self.Status_Failed: - self.basicRequirements["rating"] = \ - self.basicRequirements["bonus"] + \ - self.basicRequirements["factor"] * \ + self.basicRequirements["rating"] = ( + self.basicRequirements["bonus"] + + self.basicRequirements["factor"] * self.basicRequirements["count"] + ) else: - self.basicRequirements["rating"] = \ + self.basicRequirements["rating"] = ( self.basicRequirements["penalty"] + ) self.score["count"] += self.basicRequirements["rating"] # beyond basic requirements @@ -589,24 +613,28 @@ # repeatedSequences # Honor or punish the use of repeated sequences if self.repeatedSequences["count"] == 0: - self.repeatedSequences["rating"] = \ + self.repeatedSequences["rating"] = ( self.repeatedSequences["bonus"] + ) else: - self.repeatedSequences["rating"] = \ - self.repeatedSequences["penalty"] + \ - self.repeatedSequences["count"] * \ + self.repeatedSequences["rating"] = ( + self.repeatedSequences["penalty"] + + self.repeatedSequences["count"] * self.repeatedSequences["factor"] + ) # mirroredSequences # Honor or punish the use of mirrored sequences if self.mirroredSequences["count"] == 0: - self.mirroredSequences["rating"] = \ + self.mirroredSequences["rating"] = ( self.mirroredSequences["bonus"] + ) else: - self.mirroredSequences["rating"] = \ - self.mirroredSequences["penalty"] + \ - self.mirroredSequences["count"] * \ + self.mirroredSequences["rating"] = ( + self.mirroredSequences["penalty"] + + self.mirroredSequences["count"] * self.mirroredSequences["factor"] + ) # save value before redundancy self.score["beforeRedundancy"] = self.score["count"]
--- a/eric6/Utilities/__init__.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/__init__.py Mon Sep 23 19:22:12 2019 +0200 @@ -42,8 +42,10 @@ from codecs import BOM_UTF8, BOM_UTF16, BOM_UTF32 -from PyQt5.QtCore import QRegExp, QDir, QProcess, Qt, QByteArray, \ - qVersion, PYQT_VERSION_STR, QCoreApplication, QCryptographicHash +from PyQt5.QtCore import ( + QRegExp, QDir, QProcess, Qt, QByteArray, qVersion, PYQT_VERSION_STR, + QCoreApplication, QCryptographicHash +) from PyQt5.Qsci import QSCINTILLA_VERSION_STR, QsciScintilla # import these methods into the Utilities namespace @@ -228,8 +230,11 @@ try: import ThirdParty.CharDet.chardet guess = ThirdParty.CharDet.chardet.detect(text) - if guess and guess['confidence'] > 0.95 and \ - guess['encoding'] is not None: + if ( + guess and + guess['confidence'] > 0.95 and + guess['encoding'] is not None + ): codec = guess['encoding'].lower() return str(text, codec), '{0}-guessed'.format(codec) except (UnicodeError, LookupError): @@ -350,11 +355,13 @@ # Try the original encoding if origEncoding and origEncoding.endswith( ('-selected', '-default', '-guessed', '-ignore')): - coding = origEncoding\ - .replace("-selected", "")\ - .replace("-default", "")\ - .replace("-guessed", "")\ + coding = ( + origEncoding + .replace("-selected", "") + .replace("-default", "") + .replace("-guessed", "") .replace("-ignore", "") + ) try: etext, encoding = text.encode(coding), coding except (UnicodeError, LookupError): @@ -1059,8 +1066,12 @@ """ isDrive = False drive, directory = os.path.splitdrive(path) - if drive and len(drive) == 2 and drive.endswith(":") and \ - directory in ["", "\\", "/"]: + if ( + drive and + len(drive) == 2 and + drive.endswith(":") and + directory in ["", "\\", "/"] + ): isDrive = True return isDrive @@ -1078,8 +1089,10 @@ if f1 is None or f2 is None: return False - if normcaseabspath(os.path.realpath(f1)) == \ - normcaseabspath(os.path.realpath(f2)): + if ( + normcaseabspath(os.path.realpath(f1)) == + normcaseabspath(os.path.realpath(f2)) + ): return True return False @@ -1210,9 +1223,11 @@ continue fentry = os.path.join(path, entry) - if pattern and \ - not os.path.isdir(fentry) and \ - not fnmatch.fnmatch(entry, pattern): + if ( + pattern and + not os.path.isdir(fentry) and + not fnmatch.fnmatch(entry, pattern) + ): # entry doesn't fit the given pattern continue @@ -1245,8 +1260,10 @@ dirs = [] for name in names: - if os.path.isdir(os.path.join(path, name)) and \ - not os.path.islink(os.path.join(path, name)): + if ( + os.path.isdir(os.path.join(path, name)) and + not os.path.islink(os.path.join(path, name)) + ): exclude = 0 for e in excludeDirs: if name.split(os.sep, 1)[0] == e: @@ -1823,8 +1840,8 @@ venvName = Preferences.getDebugger("Python3VirtualEnv") else: venvName = Preferences.getDebugger("Python2VirtualEnv") - interpreter = e5App().getObject("VirtualEnvManager")\ - .getVirtualenvInterpreter(venvName) + interpreter = e5App().getObject( + "VirtualEnvManager").getVirtualenvInterpreter(venvName) prefix = os.path.dirname(interpreter) if toolname in ["pyside-uic", "pyside2-uic"]: return os.path.join(prefix, "Scripts", toolname + '.exe') @@ -1860,8 +1877,8 @@ pysideInformation = [] for venvNameKey in ["Python2VirtualEnv", "Python3VirtualEnv"]: venvName = Preferences.getDebugger(venvNameKey) - interpreter = e5App().getObject("VirtualEnvManager")\ - .getVirtualenvInterpreter(venvName) + interpreter = e5App().getObject( + "VirtualEnvManager").getVirtualenvInterpreter(venvName) if interpreter == "" or not isinpath(interpreter): hasPyside = False else:
--- a/eric6/Utilities/crypto/__init__.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/crypto/__init__.py Mon Sep 23 19:22:12 2019 +0200 @@ -38,10 +38,15 @@ @param pw password to encode (string) @return encoded password (string) """ - pop = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" \ - ".,;:-_!$?*+#" - rpw = "".join(random.sample(pop, 32)) + pw + \ + pop = ( + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + ".,;:-_!$?*+#" + ) + rpw = ( + "".join(random.sample(pop, 32)) + + pw + "".join(random.sample(pop, 32)) + ) return EncodeMarker + base64.b64encode(rpw.encode("utf-8")).decode("ascii") @@ -272,8 +277,8 @@ from .py3AES import encryptData from .py3PBKDF2 import hashPasswordTuple - digestname, iterations, salt, pwHash = \ - hashPasswordTuple(password, iterations=hashIterations) + digestname, iterations, salt, pwHash = hashPasswordTuple( + password, iterations=hashIterations) key = pwHash[:keyLength] try: cipher = encryptData(key, data)
--- a/eric6/Utilities/crypto/py3AES.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/crypto/py3AES.py Mon Sep 23 19:22:12 2019 +0200 @@ -236,8 +236,10 @@ t = self.__core(t, rconIteration) rconIteration += 1 # For 256-bit keys, we add an extra sbox to the calculation - if size == self.KeySize["SIZE_256"] and \ - ((currentSize % size) == 16): + if ( + size == self.KeySize["SIZE_256"] and + ((currentSize % size) == 16) + ): for l in range(4): t[l] = self.__getSBoxValue(t[l]) @@ -245,8 +247,9 @@ # expanded key. This becomes the next four bytes in the expanded # key. for m in range(4): - expandedKey[currentSize] = \ + expandedKey[currentSize] = ( expandedKey[currentSize - size] ^ t[m] + ) currentSize += 1 return expandedKey @@ -345,13 +348,15 @@ state = state[:] for _ in range(nbr): if isInv: - state[statePointer:statePointer + 4] = \ - state[statePointer + 3:statePointer + 4] + \ + state[statePointer:statePointer + 4] = ( + state[statePointer + 3:statePointer + 4] + state[statePointer:statePointer + 3] + ) else: - state[statePointer:statePointer + 4] = \ - state[statePointer + 1:statePointer + 4] + \ + state[statePointer:statePointer + 4] = ( + state[statePointer + 1:statePointer + 4] + state[statePointer:statePointer + 1] + ) return state def __mixColumns(self, state, isInv):
--- a/eric6/Utilities/crypto/py3PBKDF2.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/Utilities/crypto/py3PBKDF2.py Mon Sep 23 19:22:12 2019 +0200 @@ -71,8 +71,8 @@ @param saltSize size of the salt (integer) @return hashed password entry according to PBKDF2 specification (string) """ - digestname, iterations, salt, pwHash = \ - hashPasswordTuple(password, digestMod, iterations, saltSize) + digestname, iterations, salt, pwHash = hashPasswordTuple( + password, digestMod, iterations, saltSize) return Delimiter.join([ digestname, str(iterations),
--- a/eric6/VCS/ProjectBrowserHelper.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VCS/ProjectBrowserHelper.py Mon Sep 23 19:22:12 2019 +0200 @@ -17,8 +17,10 @@ from UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog -from Project.ProjectBrowserModel import ProjectBrowserSimpleDirectoryItem, \ - ProjectBrowserFileItem, ProjectBrowserDirectoryItem +from Project.ProjectBrowserModel import ( + ProjectBrowserSimpleDirectoryItem, ProjectBrowserFileItem, + ProjectBrowserDirectoryItem +) import Preferences @@ -280,10 +282,11 @@ names) else: items = self.browser.getSelectedItems() - isRemoveDirs = len(items) == \ - self.browser.getSelectedItemsCount( + isRemoveDirs = ( + len(items) == self.browser.getSelectedItemsCount( [ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem]) + ) if isRemoveDirs: names = [itm.dirName() for itm in items] else:
--- a/eric6/VCS/ProjectHelper.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VCS/ProjectHelper.py Mon Sep 23 19:22:12 2019 +0200 @@ -190,8 +190,8 @@ if not self.project or not self.project.checkDirty(): return - vcsSystemsDict = e5App().getObject("PluginManager")\ - .getPluginDisplayStrings("version_control") + vcsSystemsDict = e5App().getObject( + "PluginManager").getPluginDisplayStrings("version_control") if not vcsSystemsDict: # no version control system found return @@ -310,8 +310,9 @@ self.project.ppath = projectdir self.project.opened = True - from Project.PropertiesDialog import \ + from Project.PropertiesDialog import ( PropertiesDialog + ) dlg = PropertiesDialog(self.project, False) if dlg.exec_() == QDialog.Accepted: dlg.storeData() @@ -389,8 +390,8 @@ pdata_vcsother = copy.deepcopy(self.project.pdata["VCSOTHERDATA"]) vcs = self.project.vcs vcsHelper = self.project.vcsProjectHelper - vcsSystemsDict = e5App().getObject("PluginManager")\ - .getPluginDisplayStrings("version_control") + vcsSystemsDict = e5App().getObject( + "PluginManager").getPluginDisplayStrings("version_control") if not vcsSystemsDict: # no version control system found return @@ -437,8 +438,9 @@ else: vcores = False if vcores: - from .CommandOptionsDialog import \ + from .CommandOptionsDialog import ( VcsCommandOptionsDialog + ) codlg = VcsCommandOptionsDialog(self.project.vcs) if codlg.exec_() == QDialog.Accepted: self.project.vcs.vcsSetOptions(codlg.getOptions())
--- a/eric6/VCS/StatusMonitorLed.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VCS/StatusMonitorLed.py Mon Sep 23 19:22:12 2019 +0200 @@ -85,11 +85,11 @@ Private method to set the enabled status of the context menu actions. """ if self.project.pudata["VCSSTATUSMONITORINTERVAL"]: - vcsStatusMonitorInterval = \ - self.project.pudata["VCSSTATUSMONITORINTERVAL"] + vcsStatusMonitorInterval = self.project.pudata[ + "VCSSTATUSMONITORINTERVAL"] else: - vcsStatusMonitorInterval = \ - Preferences.getVCS("StatusMonitorInterval") + vcsStatusMonitorInterval = Preferences.getVCS( + "StatusMonitorInterval") self.__checkAct.setEnabled(self.__on) self.__intervalAct.setEnabled(self.__on) self.__onAct.setEnabled(
--- a/eric6/VCS/StatusMonitorThread.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VCS/StatusMonitorThread.py Mon Sep 23 19:22:12 2019 +0200 @@ -8,8 +8,9 @@ """ -from PyQt5.QtCore import QThread, QMutex, QWaitCondition, pyqtSignal, \ - QCoreApplication +from PyQt5.QtCore import ( + QThread, QMutex, QWaitCondition, pyqtSignal, QCoreApplication +) class VcsStatusMonitorThread(QThread):
--- a/eric6/VCS/VersionControl.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VCS/VersionControl.py Mon Sep 23 19:22:12 2019 +0200 @@ -11,8 +11,9 @@ import os -from PyQt5.QtCore import QObject, QThread, QMutex, QProcess, \ - Qt, pyqtSignal, QCoreApplication +from PyQt5.QtCore import ( + QObject, QThread, QMutex, QProcess, Qt, pyqtSignal, QCoreApplication +) from PyQt5.QtWidgets import QApplication from E5Gui import E5MessageBox @@ -619,8 +620,10 @@ QApplication.processEvents() QThread.msleep(300) QApplication.processEvents() - return (proc.exitStatus() == QProcess.NormalExit) and \ + return ( + (proc.exitStatus() == QProcess.NormalExit) and (proc.exitCode() == 0) + ) def splitPath(self, name): """
--- a/eric6/ViewManager/ViewManager.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/ViewManager/ViewManager.py Mon Sep 23 19:22:12 2019 +0200 @@ -10,11 +10,15 @@ import os -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QSignalMapper, QTimer, \ - QFileInfo, QRegExp, Qt, QCoreApplication, QPoint +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, QSignalMapper, QTimer, QFileInfo, QRegExp, Qt, + QCoreApplication, QPoint +) from PyQt5.QtGui import QColor, QKeySequence, QPalette, QPixmap -from PyQt5.QtWidgets import QLineEdit, QToolBar, QWidgetAction, QDialog, \ - QApplication, QMenu, QComboBox, QWidget +from PyQt5.QtWidgets import ( + QLineEdit, QToolBar, QWidgetAction, QDialog, QApplication, QMenu, + QComboBox, QWidget +) from PyQt5.Qsci import QsciScintilla from E5Gui.E5Application import e5App @@ -5446,8 +5450,10 @@ self.sbZoom.setEnabled(True) self.sbZoom.setValue(now.getZoom()) - if not isinstance(now, (Editor, Shell)) and \ - now is not self.quickFindtextCombo: + if ( + not isinstance(now, (Editor, Shell)) and + now is not self.quickFindtextCombo + ): self.searchActGrp.setEnabled(False) if now is self.quickFindtextCombo: @@ -5686,8 +5692,9 @@ # first we have to check if quick search is active # and try to activate it if not if self.__quickSearchToolbarVisibility is None: - self.__quickSearchToolbarVisibility = \ + self.__quickSearchToolbarVisibility = ( self.__quickSearchToolbar.isVisible() + ) if not self.__quickSearchToolbar.isVisible(): self.__quickSearchToolbar.show() if not self.quickFindtextCombo.lineEdit().hasFocus(): @@ -5757,8 +5764,9 @@ # first we have to check if quick search is active # and try to activate it if not if self.__quickSearchToolbarVisibility is None: - self.__quickSearchToolbarVisibility = \ + self.__quickSearchToolbarVisibility = ( self.__quickSearchToolbar.isVisible() + ) if not self.__quickSearchToolbar.isVisible(): self.__quickSearchToolbar.show() if not self.quickFindtextCombo.lineEdit().hasFocus(): @@ -6554,10 +6562,13 @@ dictionaryFile, str(err))) return - fileInfo = dictionaryFile if len(dictionaryFile) < 40 \ + fileInfo = ( + dictionaryFile if len(dictionaryFile) < 40 else "...{0}".format(dictionaryFile[-40:]) - from QScintilla.SpellingDictionaryEditDialog import \ + ) + from QScintilla.SpellingDictionaryEditDialog import ( SpellingDictionaryEditDialog + ) dlg = SpellingDictionaryEditDialog( data, QCoreApplication.translate('ViewManager', "Editing {0}") @@ -6714,8 +6725,10 @@ self.astViewerAct.setEnabled(True) # activate the autosave timer - if not self.autosaveTimer.isActive() and \ - self.autosaveInterval > 0: + if ( + not self.autosaveTimer.isActive() and + self.autosaveInterval > 0 + ): self.autosaveTimer.start(self.autosaveInterval * 60000) def __autosave(self): @@ -6875,11 +6888,15 @@ # reload the autosave timer setting self.autosaveInterval = Preferences.getEditor("AutosaveInterval") if len(self.editors): - if self.autosaveTimer.isActive() and \ - self.autosaveInterval == 0: + if ( + self.autosaveTimer.isActive() and + self.autosaveInterval == 0 + ): self.autosaveTimer.stop() - elif not self.autosaveTimer.isActive() and \ - self.autosaveInterval > 0: + elif ( + not self.autosaveTimer.isActive() and + self.autosaveInterval > 0 + ): self.autosaveTimer.start(self.autosaveInterval * 60000) self.__enableSpellingActions() @@ -6995,8 +7012,10 @@ cursor is not at the end of the line. """ focusWidget = QApplication.focusWidget() - if focusWidget == e5App().getObject("Shell") or \ - focusWidget == self.quickFindtextCombo: + if ( + focusWidget == e5App().getObject("Shell") or + focusWidget == self.quickFindtextCombo + ): return else: aw = self.activeWindow() @@ -7098,8 +7117,10 @@ @return name of directory to start (string) """ # if we have an active source, return its path - if self.activeWindow() is not None and \ - self.activeWindow().getFileName(): + if ( + self.activeWindow() is not None and + self.activeWindow().getFileName() + ): return os.path.dirname(self.activeWindow().getFileName()) # check, if there is an active project and return its path @@ -7107,8 +7128,10 @@ return e5App().getObject("Project").ppath else: - return Preferences.getMultiProject("Workspace") or \ + return ( + Preferences.getMultiProject("Workspace") or Utilities.getHomeDir() + ) def _getOpenFileFilter(self): """ @@ -7120,8 +7143,10 @@ @return name of the filename filter (string) or None """ - if self.activeWindow() is not None and \ - self.activeWindow().getFileName(): + if ( + self.activeWindow() is not None and + self.activeWindow().getFileName() + ): ext = os.path.splitext(self.activeWindow().getFileName())[1] rx = QRegExp(r".*\*\.{0}[ )].*".format(ext[1:])) import QScintilla.Lexers
--- a/eric6/VirtualEnv/VirtualenvConfigurationDialog.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VirtualEnv/VirtualenvConfigurationDialog.py Mon Sep 23 19:22:12 2019 +0200 @@ -121,12 +121,16 @@ bool(self.nameEdit.text()) ) elif self.condaButton.isChecked(): - enable = bool(self.condaNameEdit.text()) or \ + enable = ( + bool(self.condaNameEdit.text()) or bool(self.condaTargetDirectoryPicker.text()) + ) if self.condaSpecialsGroup.isChecked(): if self.condaCloneButton.isChecked(): - enable &= bool(self.condaCloneNameEdit.text()) or \ + enable &= ( + bool(self.condaCloneNameEdit.text()) or bool(self.condaCloneDirectoryPicker.text()) + ) elif self.condaRequirementsButton.isChecked(): enable &= bool(self.condaRequirementsFilePicker.text()) self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)
--- a/eric6/VirtualEnv/VirtualenvExecDialog.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VirtualEnv/VirtualenvExecDialog.py Mon Sep 23 19:22:12 2019 +0200 @@ -138,8 +138,10 @@ @param exitStatus exit status of the process (QProcess.ExitStatus) @keyparam giveUp flag indicating to not start another attempt (boolean) """ - 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/VirtualEnv/VirtualenvInterpreterSelectionDialog.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VirtualEnv/VirtualenvInterpreterSelectionDialog.py Mon Sep 23 19:22:12 2019 +0200 @@ -16,8 +16,9 @@ from E5Gui.E5PathPicker import E5PathPickerModes -from .Ui_VirtualenvInterpreterSelectionDialog import \ +from .Ui_VirtualenvInterpreterSelectionDialog import ( Ui_VirtualenvInterpreterSelectionDialog +) class VirtualenvInterpreterSelectionDialog(
--- a/eric6/VirtualEnv/VirtualenvManager.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VirtualEnv/VirtualenvManager.py Mon Sep 23 19:22:12 2019 +0200 @@ -77,8 +77,10 @@ # for venvName in environments: environment = environments[venvName] - if ("is_remote" in environment and environment["is_remote"]) or \ - os.access(environment["interpreter"], os.X_OK): + if ( + ("is_remote" in environment and environment["is_remote"]) or + os.access(environment["interpreter"], os.X_OK) + ): if "is_global" not in environment: environment["is_global"] = environment["path"] == "" if "is_conda" not in environment: @@ -157,8 +159,9 @@ """ Public slot to create a new virtual environment. """ - from .VirtualenvConfigurationDialog import \ + from .VirtualenvConfigurationDialog import ( VirtualenvConfigurationDialog + ) dlg = VirtualenvConfigurationDialog() if dlg.exec_() == QDialog.Accepted: @@ -225,8 +228,9 @@ venvName = dlg.getName() if not venvInterpreter: - from .VirtualenvInterpreterSelectionDialog import \ + from .VirtualenvInterpreterSelectionDialog import ( VirtualenvInterpreterSelectionDialog + ) dlg = VirtualenvInterpreterSelectionDialog(venvName, venvDirectory) if dlg.exec_() == QDialog.Accepted: venvInterpreter, venvVariant = dlg.getData() @@ -349,13 +353,16 @@ """ venvMessages = [] for venvName in venvNames: - if venvName in self.__virtualEnvironments and \ - bool(self.__virtualEnvironments[venvName]["path"]): + if ( + venvName in self.__virtualEnvironments and + bool(self.__virtualEnvironments[venvName]["path"]) + ): venvMessages.append(self.tr("{0} - {1}").format( venvName, self.__virtualEnvironments[venvName]["path"])) if venvMessages: - from UI.DeleteFilesConfirmationDialog import \ + from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog + ) dlg = DeleteFilesConfirmationDialog( None, self.tr("Delete Virtual Environments"), @@ -418,8 +425,9 @@ venvMessages.append(self.tr("{0} - {1}").format( venvName, self.__virtualEnvironments[venvName]["path"])) if venvMessages: - from UI.DeleteFilesConfirmationDialog import \ + from UI.DeleteFilesConfirmationDialog import ( DeleteFilesConfirmationDialog + ) dlg = DeleteFilesConfirmationDialog( None, self.tr("Remove Virtual Environments"),
--- a/eric6/VirtualEnv/VirtualenvManagerDialog.py Mon Sep 23 19:10:42 2019 +0200 +++ b/eric6/VirtualEnv/VirtualenvManagerDialog.py Mon Sep 23 19:22:12 2019 +0200 @@ -54,17 +54,22 @@ deletableSelectedItemCount = 0 for itm in self.venvList.selectedItems(): - if itm.text(0) != "<default>" and \ - bool(itm.text(1)) and \ - not itm.data(0, VirtualenvManagerDialog.IsGlobalRole) and \ - not itm.data(0, VirtualenvManagerDialog.IsRemoteRole): + if ( + itm.text(0) != "<default>" and + bool(itm.text(1)) and + not itm.data(0, VirtualenvManagerDialog.IsGlobalRole) and + not itm.data(0, VirtualenvManagerDialog.IsRemoteRole) + ): deletableSelectedItemCount += 1 deletableItemCount = 0 for index in range(topLevelItemCount): itm = self.venvList.topLevelItem(index) - if itm.text(0) != "<default>" and bool(itm.text(1)) and \ - not itm.data(0, VirtualenvManagerDialog.IsRemoteRole): + if ( + itm.text(0) != "<default>" and + bool(itm.text(1)) and + not itm.data(0, VirtualenvManagerDialog.IsRemoteRole) + ): deletableItemCount += 1 canBeRemoved = (