Wed, 25 Sep 2019 18:52:40 +0200
Continued to resolve code style issue M841.
--- a/eric6/WebBrowser/OpenSearch/OpenSearchDialog.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchDialog.py Wed Sep 25 18:52:40 2019 +0200 @@ -35,8 +35,8 @@ self.__mw = parent - self.__model = \ - OpenSearchEngineModel(self.__mw.openSearchManager(), self) + self.__model = OpenSearchEngineModel( + self.__mw.openSearchManager(), self) self.enginesTable.setModel(self.__model) self.enginesTable.horizontalHeader().resizeSection(0, 200) self.enginesTable.horizontalHeader().setStretchLastSection(True)
--- a/eric6/WebBrowser/OpenSearch/OpenSearchEngine.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchEngine.py Wed Sep 25 18:52:40 2019 +0200 @@ -11,11 +11,14 @@ import re import json -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QLocale, QUrl, QUrlQuery, \ - QByteArray, QBuffer, QIODevice, QObject +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, QLocale, QUrl, QUrlQuery, QByteArray, QBuffer, + QIODevice, QObject +) from PyQt5.QtGui import QImage -from PyQt5.QtNetwork import QNetworkRequest, QNetworkAccessManager, \ - QNetworkReply +from PyQt5.QtNetwork import ( + QNetworkRequest, QNetworkAccessManager, QNetworkReply +) from UI.Info import Program @@ -419,13 +422,15 @@ if not isinstance(other, OpenSearchEngine): return NotImplemented - return self._name == other._name and \ - self._description == other._description and \ - self._imageUrl == other._imageUrl and \ - self._searchUrlTemplate == other._searchUrlTemplate and \ - self._suggestionsUrlTemplate == other._suggestionsUrlTemplate and \ - self._searchParameters == other._searchParameters and \ + return ( + self._name == other._name and + self._description == other._description and + self._imageUrl == other._imageUrl and + self._searchUrlTemplate == other._searchUrlTemplate and + self._suggestionsUrlTemplate == other._suggestionsUrlTemplate and + self._searchParameters == other._searchParameters and self._suggestionsParameters == other._suggestionsParameters + ) def __lt__(self, other): """
--- a/eric6/WebBrowser/OpenSearch/OpenSearchEngineModel.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchEngineModel.py Wed Sep 25 18:52:40 2019 +0200 @@ -134,8 +134,9 @@ return icon elif role == Qt.ToolTipRole: - description = self.tr("<strong>Description:</strong> {0}")\ - .format(engine.description()) + description = self.tr( + "<strong>Description:</strong> {0}" + ).format(engine.description()) if engine.providesSuggestions(): description += "<br/>" description += self.tr(
--- a/eric6/WebBrowser/OpenSearch/OpenSearchManager.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchManager.py Wed Sep 25 18:52:40 2019 +0200 @@ -10,8 +10,9 @@ import os -from PyQt5.QtCore import pyqtSignal, QObject, QUrl, QFile, QDir, QIODevice, \ - QUrlQuery +from PyQt5.QtCore import ( + pyqtSignal, QObject, QUrl, QFile, QDir, QIODevice, QUrlQuery +) from PyQt5.QtWidgets import QLineEdit, QInputDialog from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply @@ -409,8 +410,10 @@ for keyword, engineName in keywords: self.__keywords[keyword] = self.engine(engineName) - if self.__current not in self.__engines and \ - len(self.__engines) > 0: + if ( + self.__current not in self.__engines and + len(self.__engines) > 0 + ): self.__current = list(self.__engines.keys())[0] self.__loading = False @@ -424,13 +427,30 @@ from .DefaultSearchEngines import DefaultSearchEngines_rc # __IGNORE_WARNING__ - defaultEngineFiles = ["Amazoncom.xml", "Bing.xml", - "DeEn_Beolingus.xml", "DuckDuckGo.xml", - "Facebook.xml", "Google.xml", - "Google_Im_Feeling_Lucky.xml", "LEO_DeuEng.xml", - "LinuxMagazin.xml", "Reddit.xml", "Wikia.xml", - "Wikia_en.xml", "Wikipedia.xml", - "Wiktionary.xml", "Yahoo.xml", "YouTube.xml", ] + defaultEngineFiles = [ + "Amazoncom.xml", + "Bing.xml", + "DeEn_Beolingus.xml", + "DuckDuckGo.xml", + "Facebook.xml", + "Google.xml", + "Google_Im_Feeling_Lucky.xml", + "LEO_DeuEng.xml", + "LinuxMagazin.xml", + "MetaGer_MetaGer2.xml", + "PyPI.xml", + "Qwant.xml", + "Reddit.xml", + "StartPage.xml", + "StartPage_en.xml", + "Wikia.xml", + "Wikia_en.xml", + "Wikipedia.xml", + "Wiktionary.xml", + "Yahoo.xml", + "YouTube.xml", + "searxme.xml", + ] # Keep this list in sync with the contents of the resource file. reader = OpenSearchReader()
--- a/eric6/WebBrowser/OpenSearch/OpenSearchReader.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/OpenSearch/OpenSearchReader.py Wed Sep 25 18:52:40 2019 +0200 @@ -42,8 +42,10 @@ while not self.isStartElement() and not self.atEnd(): self.readNext() - if self.name() != "OpenSearchDescription" or \ - self.namespaceUri() != "http://a9.com/-/spec/opensearch/1.1/": + if ( + self.name() != "OpenSearchDescription" or + self.namespaceUri() != "http://a9.com/-/spec/opensearch/1.1/" + ): self.raiseError(QCoreApplication.translate( "OpenSearchReader", "The file is not an OpenSearch 1.1 file.")) @@ -66,14 +68,18 @@ url = self.attributes().value("template") method = self.attributes().value("method") - if type_ == "application/x-suggestions+json" and \ - engine.suggestionsUrlTemplate(): + if ( + type_ == "application/x-suggestions+json" and + engine.suggestionsUrlTemplate() + ): continue - if (not type_ or - type_ == "text/html" or - type_ == "application/xhtml+xml") and \ - engine.searchUrlTemplate(): + if ( + (not type_ or + type_ == "text/html" or + type_ == "application/xhtml+xml") and + engine.searchUrlTemplate() + ): continue if not url: @@ -84,8 +90,11 @@ self.readNext() while not (self.isEndElement() and self.name() == "Url"): - if not self.isStartElement() or \ - (self.name() != "Param" and self.name() != "Parameter"): + if ( + not self.isStartElement() or + (self.name() != "Param" and + self.name() != "Parameter") + ): self.readNext() continue @@ -102,9 +111,11 @@ engine.setSuggestionsUrlTemplate(url) engine.setSuggestionsParameters(parameters) engine.setSuggestionsMethod(method) - elif not type_ or \ - type_ == "text/html" or \ - type_ == "application/xhtml+xml": + elif ( + not type_ or + type_ == "text/html" or + type_ == "application/xhtml+xml" + ): engine.setSearchUrlTemplate(url) engine.setSearchParameters(parameters) engine.setSearchMethod(method) @@ -112,11 +123,13 @@ elif self.name() == "Image": engine.setImageUrl(self.readElementText()) - if engine.name() and \ - engine.description() and \ - engine.suggestionsUrlTemplate() and \ - engine.searchUrlTemplate() and \ - engine.imageUrl(): + if ( + engine.name() and + engine.description() and + engine.suggestionsUrlTemplate() and + engine.searchUrlTemplate() and + engine.imageUrl() + ): break return engine
--- a/eric6/WebBrowser/Passwords/LoginForm.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Passwords/LoginForm.py Wed Sep 25 18:52:40 2019 +0200 @@ -29,5 +29,7 @@ @return flag indicating a valid form (boolean) """ - return not self.url.isEmpty() and \ + return ( + not self.url.isEmpty() and bool(self.postData) + )
--- a/eric6/WebBrowser/Passwords/PasswordManager.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Passwords/PasswordManager.py Wed Sep 25 18:52:40 2019 +0200 @@ -10,8 +10,9 @@ import os -from PyQt5.QtCore import pyqtSignal, QObject, QByteArray, QUrl, \ - QCoreApplication, QXmlStreamReader +from PyQt5.QtCore import ( + pyqtSignal, QObject, QByteArray, QUrl, QCoreApplication, QXmlStreamReader +) from PyQt5.QtWidgets import QApplication from PyQt5.QtWebEngineWidgets import QWebEngineScript @@ -178,8 +179,8 @@ if os.path.exists(loginFile): from .PasswordReader import PasswordReader reader = PasswordReader() - self.__logins, self.__loginForms, self.__never = \ - reader.read(loginFile) + self.__logins, self.__loginForms, self.__never = reader.read( + loginFile) if reader.error() != QXmlStreamReader.NoError: E5MessageBox.warning( None, @@ -359,8 +360,10 @@ url = page.url() url = self.__stripUrl(url) key = self.__createKey(url, "") - if key not in self.__loginForms or \ - key not in self.__logins: + if ( + key not in self.__loginForms or + key not in self.__logins + ): return form = self.__loginForms[key]
--- a/eric6/WebBrowser/Passwords/PasswordReader.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Passwords/PasswordReader.py Wed Sep 25 18:52:40 2019 +0200 @@ -8,8 +8,9 @@ """ -from PyQt5.QtCore import QXmlStreamReader, QIODevice, QFile, \ - QCoreApplication, QUrl +from PyQt5.QtCore import ( + QXmlStreamReader, QIODevice, QFile, QCoreApplication, QUrl +) class PasswordReader(QXmlStreamReader): @@ -47,8 +48,10 @@ self.readNext() if self.isStartElement(): version = self.attributes().value("version") - if self.name() == "Password" and \ - (not version or version == "2.0"): + if ( + self.name() == "Password" and + (not version or version == "2.0") + ): self.__readPasswords() else: self.raiseError(QCoreApplication.translate(
--- a/eric6/WebBrowser/Passwords/PasswordsDialog.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Passwords/PasswordsDialog.py Wed Sep 25 18:52:40 2019 +0200 @@ -64,8 +64,8 @@ """ fm = QFontMetrics(QFont()) for section in range(self.__passwordModel.columnCount()): - header = self.passwordsTable.horizontalHeader()\ - .sectionSizeHint(section) + header = self.passwordsTable.horizontalHeader().sectionSizeHint( + section) if section == 0: header = fm.width("averagebiglongsitename") elif section == 1: @@ -74,8 +74,8 @@ header = fm.width("averagelongpassword") buffer = fm.width("mm") header += buffer - self.passwordsTable.horizontalHeader()\ - .resizeSection(section, header) + self.passwordsTable.horizontalHeader().resizeSection( + section, header) self.passwordsTable.horizontalHeader().setStretchLastSection(True) @pyqtSlot()
--- a/eric6/WebBrowser/PersonalInformationManager/PersonalInformationManager.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/PersonalInformationManager/PersonalInformationManager.py Wed Sep 25 18:52:40 2019 +0200 @@ -62,12 +62,12 @@ """ Private method to load the settings. """ - self.__allInfo[self.FullName] = \ - Preferences.getWebBrowser("PimFullName") - self.__allInfo[self.LastName] = \ - Preferences.getWebBrowser("PimLastName") - self.__allInfo[self.FirstName] = \ - Preferences.getWebBrowser("PimFirstName") + self.__allInfo[self.FullName] = Preferences.getWebBrowser( + "PimFullName") + self.__allInfo[self.LastName] = Preferences.getWebBrowser( + "PimLastName") + self.__allInfo[self.FirstName] = Preferences.getWebBrowser( + "PimFirstName") self.__allInfo[self.Email] = Preferences.getWebBrowser("PimEmail") self.__allInfo[self.Mobile] = Preferences.getWebBrowser("PimMobile") self.__allInfo[self.Phone] = Preferences.getWebBrowser("PimPhone") @@ -76,16 +76,16 @@ self.__allInfo[self.Zip] = Preferences.getWebBrowser("PimZip") self.__allInfo[self.State] = Preferences.getWebBrowser("PimState") self.__allInfo[self.Country] = Preferences.getWebBrowser("PimCountry") - self.__allInfo[self.HomePage] = \ - Preferences.getWebBrowser("PimHomePage") - self.__allInfo[self.Special1] = \ - Preferences.getWebBrowser("PimSpecial1") - self.__allInfo[self.Special2] = \ - Preferences.getWebBrowser("PimSpecial2") - self.__allInfo[self.Special3] = \ - Preferences.getWebBrowser("PimSpecial3") - self.__allInfo[self.Special4] = \ - Preferences.getWebBrowser("PimSpecial4") + self.__allInfo[self.HomePage] = Preferences.getWebBrowser( + "PimHomePage") + self.__allInfo[self.Special1] = Preferences.getWebBrowser( + "PimSpecial1") + self.__allInfo[self.Special2] = Preferences.getWebBrowser( + "PimSpecial2") + self.__allInfo[self.Special3] = Preferences.getWebBrowser( + "PimSpecial3") + self.__allInfo[self.Special4] = Preferences.getWebBrowser( + "PimSpecial4") self.__translations[self.FullName] = self.tr("Full Name") self.__translations[self.LastName] = self.tr("Last Name")
--- a/eric6/WebBrowser/QtHelp/HelpDocsInstaller.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/QtHelp/HelpDocsInstaller.py Wed Sep 25 18:52:40 2019 +0200 @@ -11,8 +11,9 @@ import os -from PyQt5.QtCore import pyqtSignal, QThread, Qt, QMutex, QDateTime, QDir, \ - QLibraryInfo, QFileInfo +from PyQt5.QtCore import ( + pyqtSignal, QThread, Qt, QMutex, QDateTime, QDir, QLibraryInfo, QFileInfo +) from PyQt5.QtHelp import QHelpEngineCore from eric6config import getConfig @@ -132,8 +133,10 @@ QDir.separator() + "qch") elif version == 5: docsPath = QLibraryInfo.location(QLibraryInfo.DocumentationPath) - if not os.path.isdir(docsPath) or \ - len(QDir(docsPath).entryList(["*.qch"])) == 0: + if ( + not os.path.isdir(docsPath) or + len(QDir(docsPath).entryList(["*.qch"])) == 0 + ): # Qt installer is a bit buggy; it's missing a symbolic link docsPathList = QDir.fromNativeSeparators(docsPath).split("/") docsPath = os.sep.join( @@ -159,11 +162,13 @@ if not namespace: continue - if dt.isValid() and \ - namespace in engine.registeredDocumentations() and \ - fi.lastModified().toString(Qt.ISODate) == \ - dt.toString(Qt.ISODate) and \ - qchFile == fi.absoluteFilePath(): + if ( + dt.isValid() and + namespace in engine.registeredDocumentations() and + (fi.lastModified().toString(Qt.ISODate) == + dt.toString(Qt.ISODate)) and + qchFile == fi.absoluteFilePath() + ): return False if namespace in engine.registeredDocumentations(): @@ -221,11 +226,13 @@ if not namespace: continue - if dt.isValid() and \ - namespace in engine.registeredDocumentations() and \ - fi.lastModified().toString(Qt.ISODate) == \ - dt.toString(Qt.ISODate) and \ - qchFile == fi.absoluteFilePath(): + if ( + dt.isValid() and + namespace in engine.registeredDocumentations() and + (fi.lastModified().toString(Qt.ISODate) == + dt.toString(Qt.ISODate)) and + qchFile == fi.absoluteFilePath() + ): return False if namespace in engine.registeredDocumentations():
--- a/eric6/WebBrowser/QtHelp/HelpIndexWidget.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/QtHelp/HelpIndexWidget.py Wed Sep 25 18:52:40 2019 +0200 @@ -9,8 +9,9 @@ from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl, QEvent -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QLineEdit, QMenu, \ - QDialog, QApplication +from PyQt5.QtWidgets import ( + QWidget, QVBoxLayout, QLabel, QLineEdit, QMenu, QDialog, QApplication +) class HelpIndexWidget(QWidget): @@ -84,8 +85,10 @@ if modifiers is None: modifiers = QApplication.keyboardModifiers() if not url.isEmpty() and url.isValid(): - if modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == \ - (Qt.ControlModifier | Qt.ShiftModifier): + if ( + modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == + (Qt.ControlModifier | Qt.ShiftModifier) + ): self.newBackgroundTab.emit(url) elif modifiers & Qt.ControlModifier: self.newTab.emit(url) @@ -171,8 +174,10 @@ @param event the event that occurred (QEvent) @return flag indicating whether the event was handled (boolean) """ - if self.__searchEdit and watched == self.__searchEdit and \ - event.type() == QEvent.KeyPress: + if ( + self.__searchEdit and watched == self.__searchEdit and + event.type() == QEvent.KeyPress + ): idx = self.__index.currentIndex() if event.key() == Qt.Key_Up: idx = self.__index.model().index(
--- a/eric6/WebBrowser/QtHelp/HelpSearchWidget.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/QtHelp/HelpSearchWidget.py Wed Sep 25 18:52:40 2019 +0200 @@ -9,8 +9,9 @@ from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QTextBrowser, QApplication, \ - QMenu +from PyQt5.QtWidgets import ( + QWidget, QVBoxLayout, QTextBrowser, QApplication, QMenu +) class HelpSearchWidget(QWidget): @@ -98,8 +99,10 @@ if buttons & Qt.MidButton: self.newTab.emit(url) else: - if modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == \ - (Qt.ControlModifier | Qt.ShiftModifier): + if ( + modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == + (Qt.ControlModifier | Qt.ShiftModifier) + ): self.newBackgroundTab.emit(url) elif modifiers & Qt.ControlModifier: self.newTab.emit(url)
--- a/eric6/WebBrowser/QtHelp/HelpTocWidget.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/QtHelp/HelpTocWidget.py Wed Sep 25 18:52:40 2019 +0200 @@ -70,8 +70,10 @@ if buttons & Qt.MidButton: self.newTab.emit(url) else: - if modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == \ - (Qt.ControlModifier | Qt.ShiftModifier): + if ( + modifiers & (Qt.ControlModifier | Qt.ShiftModifier) == + (Qt.ControlModifier | Qt.ShiftModifier) + ): self.newBackgroundTab.emit(url) elif modifiers & Qt.ControlModifier: self.newTab.emit(url)
--- a/eric6/WebBrowser/QtHelp/QtHelpDocumentationDialog.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/QtHelp/QtHelpDocumentationDialog.py Wed Sep 25 18:52:40 2019 +0200 @@ -10,8 +10,9 @@ import sqlite3 from PyQt5.QtCore import pyqtSlot, Qt, QItemSelectionModel -from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QListWidgetItem, \ - QInputDialog, QLineEdit +from PyQt5.QtWidgets import ( + QDialog, QTreeWidgetItem, QListWidgetItem, QInputDialog, QLineEdit +) from PyQt5.QtHelp import QHelpEngineCore from E5Gui import E5MessageBox, E5FileDialog @@ -50,8 +51,10 @@ @param index index of the current tab @type int """ - if index != 1 and \ - (self.__hasChangedFilters() or self.__removedAttributes): + if ( + index != 1 and + (self.__hasChangedFilters() or self.__removedAttributes) + ): yes = E5MessageBox.yesNo( self, self.tr("Unsaved Filter Changes"), @@ -80,8 +83,9 @@ self.__tabsToClose = [] try: - self.__pluginHelpDocuments = \ + self.__pluginHelpDocuments = ( e5App().getObject("PluginManager").getPluginQtHelpFiles() + ) except KeyError: from PluginManager.PluginManager import PluginManager pluginManager = PluginManager(self, doLoadPlugins=False) @@ -119,8 +123,9 @@ Private slot to add QtHelp documents provided by plug-ins to the help database. """ - from .QtHelpDocumentationSelectionDialog import \ + from .QtHelpDocumentationSelectionDialog import ( QtHelpDocumentationSelectionDialog + ) dlg = QtHelpDocumentationSelectionDialog( self.__pluginHelpDocuments, QtHelpDocumentationSelectionDialog.AddMode, @@ -137,8 +142,9 @@ """ Private slot to manage the QtHelp documents provided by plug-ins. """ - from .QtHelpDocumentationSelectionDialog import \ + from .QtHelpDocumentationSelectionDialog import ( QtHelpDocumentationSelectionDialog + ) dlg = QtHelpDocumentationSelectionDialog( self.__pluginHelpDocuments, QtHelpDocumentationSelectionDialog.ManageMode, @@ -234,8 +240,10 @@ @return flag indicating presence of changes @rtype bool """ - return len(self.__registeredDocs) > 0 or \ + return ( + len(self.__registeredDocs) > 0 or len(self.__unregisteredDocs) > 0 + ) def getTabsToClose(self): """
--- a/eric6/WebBrowser/QtHelp/QtHelpDocumentationSelectionDialog.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/QtHelp/QtHelpDocumentationSelectionDialog.py Wed Sep 25 18:52:40 2019 +0200 @@ -17,8 +17,9 @@ from E5Gui import E5MessageBox -from .Ui_QtHelpDocumentationSelectionDialog import \ +from .Ui_QtHelpDocumentationSelectionDialog import ( Ui_QtHelpDocumentationSelectionDialog +) class QtHelpDocumentationSelectionDialog(
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingAPIClient.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingAPIClient.py Wed Sep 25 18:52:40 2019 +0200 @@ -11,8 +11,10 @@ import json import base64 -from PyQt5.QtCore import pyqtSignal, QObject, QDateTime, QUrl, QByteArray, \ - QCoreApplication, QEventLoop +from PyQt5.QtCore import ( + pyqtSignal, QObject, QDateTime, QUrl, QByteArray, QCoreApplication, + QEventLoop +) from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply from WebBrowser.WebBrowserWindow import WebBrowserWindow @@ -119,8 +121,9 @@ "listUpdateRequests": [], } - for (threatType, platformType, threatEntryType), currentState in \ - clientStates.items(): + for (threatType, platformType, threatEntryType), currentState in ( + clientStates.items() + ): requestBody["listUpdateRequests"].append( { "threatType": threatType, @@ -187,17 +190,22 @@ requestBody["threatInfo"]["threatEntries"].append( {"hash": base64.b64encode(prefix).decode("ascii")}) - for (threatType, platformType, threatEntryType), currentState in \ - clientState.items(): + for (threatType, platformType, threatEntryType), currentState in ( + clientState.items() + ): requestBody["clientStates"].append(currentState) if threatType not in requestBody["threatInfo"]["threatTypes"]: requestBody["threatInfo"]["threatTypes"].append(threatType) - if platformType not in \ - requestBody["threatInfo"]["platformTypes"]: + if ( + platformType not in + requestBody["threatInfo"]["platformTypes"] + ): requestBody["threatInfo"]["platformTypes"].append( platformType) - if threatEntryType not in \ - requestBody["threatInfo"]["threatEntryTypes"]: + if ( + threatEntryType not in + requestBody["threatInfo"]["threatEntryTypes"] + ): requestBody["threatInfo"]["threatEntryTypes"].append( threatEntryType) @@ -245,8 +253,9 @@ self.__nextRequestNoSoonerThan = QDateTime() else: waitDuration = int(float(minimumWaitDuration.rstrip("s"))) - self.__nextRequestNoSoonerThan = \ + self.__nextRequestNoSoonerThan = ( QDateTime.currentDateTime().addSecs(waitDuration) + ) def fairUseDelayExpired(self): """ @@ -295,8 +304,10 @@ # check the local cache first if urlStr in self.__lookupApiCache: - if self.__lookupApiCache[urlStr]["validUntil"] > \ - QDateTime.currentDateTime(): + if ( + self.__lookupApiCache[urlStr]["validUntil"] > + QDateTime.currentDateTime() + ): # cached entry is still valid return self.__lookupApiCache[urlStr]["threatInfo"], error else:
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingCache.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingCache.py Wed Sep 25 18:52:40 2019 +0200 @@ -16,8 +16,9 @@ import os -from PyQt5.QtCore import QObject, QByteArray, QCryptographicHash, \ - QCoreApplication, QEventLoop +from PyQt5.QtCore import ( + QObject, QByteArray, QCryptographicHash, QCoreApplication, QEventLoop +) from PyQt5.QtSql import QSql, QSqlDatabase, QSqlQuery from .SafeBrowsingThreatList import ThreatList @@ -671,8 +672,9 @@ db.transaction() try: for index in range(0, len(prefixesToRemove), batchSize): - removeBatch = \ - prefixesToRemove[index:(index + batchSize)] + removeBatch = prefixesToRemove[ + index:(index + batchSize) + ] query = QSqlQuery(db) query.prepare(
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py Wed Sep 25 18:52:40 2019 +0200 @@ -9,8 +9,9 @@ from PyQt5.QtCore import pyqtSlot, Qt, QUrl, QDateTime -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton, \ - QApplication +from PyQt5.QtWidgets import ( + QDialog, QDialogButtonBox, QAbstractButton, QApplication +) from E5Gui import E5MessageBox @@ -334,8 +335,10 @@ """ nextUpdateDateTime = Preferences.getWebBrowser( "SafeBrowsingUpdateDateTime") - if not nextUpdateDateTime.isValid() or \ - nextUpdateDateTime <= QDateTime.currentDateTime(): + if ( + not nextUpdateDateTime.isValid() or + nextUpdateDateTime <= QDateTime.currentDateTime() + ): message = self.tr("The next automatic threat list update will be" " done now.") else:
--- a/eric6/WebBrowser/SafeBrowsing/SafeBrowsingManager.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingManager.py Wed Sep 25 18:52:40 2019 +0200 @@ -18,8 +18,9 @@ import os import base64 -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QCoreApplication, \ - QUrl, QDateTime, QTimer +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, QObject, QCoreApplication, QUrl, QDateTime, QTimer +) import Preferences import Utilities @@ -177,16 +178,18 @@ """ Private method to set auto update for the threat lists. """ - autoUpdateEnabled = \ - Preferences.getWebBrowser("SafeBrowsingAutoUpdate") and \ + autoUpdateEnabled = ( + Preferences.getWebBrowser("SafeBrowsingAutoUpdate") and not Preferences.getWebBrowser("SafeBrowsingUseLookupApi") + ) if autoUpdateEnabled and self.isEnabled(): nextUpdateDateTime = Preferences.getWebBrowser( "SafeBrowsingUpdateDateTime") if nextUpdateDateTime.isValid(): - interval = \ + interval = ( QDateTime.currentDateTime().secsTo(nextUpdateDateTime) + 2 - # 2 seconds extra wait time; interval in milliseconds + # 2 seconds extra wait time; interval in milliseconds + ) if interval < 5: interval = 5 @@ -217,8 +220,9 @@ self.tr("Updating threat lists failed")) if ok: - nextUpdateDateTime = \ + nextUpdateDateTime = ( self.__apiClient.getFairUseDelayExpirationDateTime() + ) Preferences.setWebBrowser("SafeBrowsingUpdateDateTime", nextUpdateDateTime) self.__threatListsUpdateTimer.start( @@ -240,11 +244,13 @@ return False, self.tr("Safe Browsing is disabled.") if not self.__apiClient.fairUseDelayExpired(): - return False, \ + return ( + False, self.tr("The fair use wait period has not expired yet." "Expiration will be at {0}.").format( self.__apiClient.getFairUseDelayExpirationDateTime() .toString("yyyy-MM-dd, HH:mm:ss")) + ) self.__updatingThreatLists = True ok = True @@ -270,8 +276,10 @@ self.progress.emit(current) QCoreApplication.processEvents() threatList = ThreatList.fromApiEntry(entry) - if self.__platforms is None or \ - threatList.platformType in self.__platforms: + if ( + self.__platforms is None or + threatList.platformType in self.__platforms + ): self.__cache.addThreatList(threatList) key = repr(threatList) if key in threatListsForRemove: @@ -293,8 +301,8 @@ clientStates = {} for threatList, clientState in threatLists: clientStates[threatList.asTuple()] = clientState - threatsUpdateResponses, error = \ - self.__apiClient.getThreatsUpdate(clientStates) + threatsUpdateResponses, error = self.__apiClient.getThreatsUpdate( + clientStates) if error: return False, error @@ -396,8 +404,8 @@ if url.isEmpty(): raise ValueError("Empty URL given.") - listNames, error = \ - self.__apiClient.lookupUrl(url, self.__platforms) + listNames, error = self.__apiClient.lookupUrl( + url, self.__platforms) return listNames, error else: if isinstance(url, QUrl): @@ -432,8 +440,9 @@ matchingFullHashes = set() isPotentialThreat = False # Lookup hash prefixes which match full URL hash - for _threatList, hashPrefix, negativeCacheExpired in \ - self.__cache.lookupHashPrefix(cues): + for _threatList, hashPrefix, negativeCacheExpired in ( + self.__cache.lookupHashPrefix(cues) + ): for fullHash in fullHashes: if fullHash.startswith(hashPrefix): isPotentialThreat = True @@ -460,8 +469,10 @@ # If there are no matching expired full hash entries and negative # cache is still current for all prefixes, consider it safe. - if len(matchingExpiredThreatLists) == 0 and \ - sum(map(int, matchingPrefixes.values())) == 0: + if ( + len(matchingExpiredThreatLists) == 0 and + sum(map(int, matchingPrefixes.values())) == 0 + ): return [] # Now it can be assumed that there are expired matching full hash
--- a/eric6/WebBrowser/Session/SessionManager.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Session/SessionManager.py Wed Sep 25 18:52:40 2019 +0200 @@ -11,11 +11,14 @@ import os import json -from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QObject, QTimer, QDir, \ - QFile, QFileInfo, QFileSystemWatcher, QByteArray, QDateTime -from PyQt5.QtWidgets import QActionGroup, QApplication, \ - QInputDialog, QLineEdit, QDialog, QDialogButtonBox, QLabel, QComboBox, \ - QVBoxLayout +from PyQt5.QtCore import ( + pyqtSlot, pyqtSignal, Qt, QObject, QTimer, QDir, QFile, QFileInfo, + QFileSystemWatcher, QByteArray, QDateTime +) +from PyQt5.QtWidgets import ( + QActionGroup, QApplication, QInputDialog, QLineEdit, QDialog, + QDialogButtonBox, QLabel, QComboBox, QVBoxLayout +) from E5Gui import E5MessageBox @@ -80,8 +83,8 @@ if not QFile.exists(self.__lastActiveSession): self.__lastActiveSession = self.__sessionDefault - self.__sessionsDirectoryWatcher = \ - QFileSystemWatcher([self.getSessionsDirectory()], self) + self.__sessionsDirectoryWatcher = QFileSystemWatcher( + [self.getSessionsDirectory()], self) self.__sessionsDirectoryWatcher.directoryChanged.connect( self.__sessionDirectoryChanged) @@ -202,8 +205,9 @@ sessionData["Windows"].append(data) if window is activeWindow: - sessionData["CurrentWindowIndex"] = \ + sessionData["CurrentWindowIndex"] = ( len(sessionData["Windows"]) - 1 + ) if sessionData["Windows"]: sessionFile = open(sessionFileName, "w") @@ -415,8 +419,9 @@ if not ((flags & SessionManager.ReplaceSession) == SessionManager.ReplaceSession): - self.__lastActiveSession = \ + self.__lastActiveSession = ( QFileInfo(sessionFilePath).canonicalFilePath() + ) self.__sessionMetaData = [] self.restoreSessionFromData(window, sessionData) @@ -446,8 +451,9 @@ # restore additional windows for data in sessionData["Windows"]: - window = WebBrowserWindow.mainWindow()\ - .newWindow(restoreSession=True) + window = ( + WebBrowserWindow.mainWindow().newWindow(restoreSession=True) + ) window.tabWidget().loadFromSessionData(data) if "WindowGeometry" in data: geometry = QByteArray.fromBase64( @@ -459,8 +465,9 @@ if "CurrentWindowIndex" in sessionData: currentWindowIndex = sessionData["CurrentWindowIndex"] try: - currentWindow = \ + currentWindow = ( WebBrowserWindow.mainWindows()[currentWindowIndex] + ) QTimer.singleShot(0, lambda: currentWindow.raise_()) except IndexError: # ignore it
--- a/eric6/WebBrowser/Session/SessionManagerDialog.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Session/SessionManagerDialog.py Wed Sep 25 18:52:40 2019 +0200 @@ -216,11 +216,13 @@ filePath = itm.data(0, SessionManagerDialog.SessionFileRole) if filePath: if itm.data(0, SessionManagerDialog.BackupSessionRole): - res = WebBrowserWindow.sessionManager()\ - .replaceSession(filePath) + res = ( + WebBrowserWindow.sessionManager().replaceSession(filePath) + ) else: - res = WebBrowserWindow.sessionManager()\ - .switchToSession(filePath) + res = ( + WebBrowserWindow.sessionManager().switchToSession(filePath) + ) if res: self.close()
--- a/eric6/WebBrowser/SiteInfo/SiteInfoDialog.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SiteInfo/SiteInfoDialog.py Wed Sep 25 18:52:40 2019 +0200 @@ -11,8 +11,10 @@ from PyQt5.QtCore import pyqtSlot, QUrl, Qt from PyQt5.QtGui import QPixmap, QImage, QPainter, QColor, QBrush from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply -from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QGraphicsScene, QMenu, \ - QApplication, QGraphicsPixmapItem +from PyQt5.QtWidgets import ( + QDialog, QTreeWidgetItem, QGraphicsScene, QMenu, QApplication, + QGraphicsPixmapItem +) from E5Gui import E5MessageBox, E5FileDialog @@ -54,8 +56,9 @@ title = browser.title() #prepare background of image preview - self.__imagePreviewStandardBackground = \ + self.__imagePreviewStandardBackground = ( self.imagePreview.backgroundBrush() + ) color1 = QColor(220, 220, 220) color2 = QColor(160, 160, 160) self.__tilePixmap = QPixmap(8, 8) @@ -270,8 +273,10 @@ if itm is None: return - if not self.imagePreview.scene() or \ - len(self.imagePreview.scene().items()) == 0: + if ( + not self.imagePreview.scene() or + len(self.imagePreview.scene().items()) == 0 + ): return pixmapItem = self.imagePreview.scene().items()[0]
--- a/eric6/WebBrowser/SiteInfo/SiteInfoWidget.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SiteInfo/SiteInfoWidget.py Wed Sep 25 18:52:40 2019 +0200 @@ -9,8 +9,10 @@ from PyQt5.QtCore import pyqtSlot, Qt, QPoint -from PyQt5.QtWidgets import QMenu, QGridLayout, QHBoxLayout, QLabel, QFrame, \ - QSizePolicy, QPushButton, QSpacerItem +from PyQt5.QtWidgets import ( + QMenu, QGridLayout, QHBoxLayout, QLabel, QFrame, QSizePolicy, QPushButton, + QSpacerItem +) import UI.PixmapCache @@ -110,10 +112,13 @@ page = self.__browser.page() scheme = page.registerProtocolHandlerRequestScheme() - registeredUrl = WebBrowserWindow.protocolHandlerManager()\ - .protocolHandler(scheme) - if bool(scheme) and \ - registeredUrl != page.registerProtocolHandlerRequestUrl(): + registeredUrl = ( + WebBrowserWindow.protocolHandlerManager().protocolHandler(scheme) + ) + if ( + bool(scheme) and + registeredUrl != page.registerProtocolHandlerRequestUrl() + ): horizontalLayout = QHBoxLayout() protocolHandlerLabel = QLabel( self.tr("Register as <b>{0}</b> links handler.")
--- a/eric6/WebBrowser/SpeedDial/Page.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SpeedDial/Page.py Wed Sep 25 18:52:40 2019 +0200 @@ -31,8 +31,10 @@ @param other reference to the other page object (Page) @return flag indicating equality (boolean) """ - return self.title == other.title and \ + return ( + self.title == other.title and self.url == other.url + ) def isValid(self): """
--- a/eric6/WebBrowser/SpeedDial/SpeedDial.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SpeedDial/SpeedDial.py Wed Sep 25 18:52:40 2019 +0200 @@ -10,8 +10,10 @@ import os -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QCryptographicHash, \ - QByteArray, QUrl, qWarning +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, QObject, QCryptographicHash, QByteArray, QUrl, + qWarning +) from PyQt5.QtGui import QPixmap from E5Gui import E5MessageBox @@ -127,11 +129,11 @@ if not page.url: imgSource = "" else: - imgSource = \ - pixmapToDataUrl(QPixmap(imgSource)).toString() + imgSource = pixmapToDataUrl( + QPixmap(imgSource)).toString() - self.__initialScript += \ - "addBox('{0}', '{1}', '{2}');\n".format( + self.__initialScript += ( + "addBox('{0}', '{1}', '{2}');\n").format( page.url, Utilities.html_uencode(page.title), imgSource) @@ -183,16 +185,17 @@ self.__webPages = allPages self.pagesChanged.emit() else: - allPages = \ - 'url:"https://eric-ide.python-projects.org/"|'\ - 'title:"Eric Web Site";'\ - 'url:"https://www.riverbankcomputing.com/"|'\ - 'title:"PyQt Web Site";'\ - 'url:"http://www.qt.io/"|title:"Qt Web Site";'\ - 'url:"http://blog.qt.io/"|title:"Qt Blog";'\ - 'url:"https://www.python.org"|'\ - 'title:"Python Language Website";'\ + allPages = ( + 'url:"https://eric-ide.python-projects.org/"|' + 'title:"Eric Web Site";' + 'url:"https://www.riverbankcomputing.com/"|' + 'title:"PyQt Web Site";' + 'url:"http://www.qt.io/"|title:"Qt Web Site";' + 'url:"http://blog.qt.io/"|title:"Qt Blog";' + 'url:"https://www.python.org"|' + 'title:"Python Language Website";' 'url:"http://www.google.com"|title:"Google";' + ) self.changed(allPages) def save(self):
--- a/eric6/WebBrowser/SpeedDial/SpeedDialReader.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SpeedDial/SpeedDialReader.py Wed Sep 25 18:52:40 2019 +0200 @@ -54,8 +54,10 @@ self.readNext() if self.isStartElement(): version = self.attributes().value("version") - if self.name() == "SpeedDial" and \ - (not version or version == "1.0"): + if ( + self.name() == "SpeedDial" and + (not version or version == "1.0") + ): self.__readSpeedDial() else: self.raiseError(QCoreApplication.translate(
--- a/eric6/WebBrowser/SpellCheck/ManageDictionariesDialog.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/SpellCheck/ManageDictionariesDialog.py Wed Sep 25 18:52:40 2019 +0200 @@ -15,10 +15,12 @@ import shutil from PyQt5.QtCore import pyqtSlot, Qt, QUrl -from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton, \ - QListWidgetItem -from PyQt5.QtNetwork import QNetworkConfigurationManager, QNetworkRequest, \ - QNetworkReply +from PyQt5.QtWidgets import ( + QDialog, QDialogButtonBox, QAbstractButton, QListWidgetItem +) +from PyQt5.QtNetwork import ( + QNetworkConfigurationManager, QNetworkRequest, QNetworkReply +) from E5Gui import E5MessageBox @@ -68,8 +70,8 @@ Preferences.getWebBrowser("SpellCheckDictionariesUrl")) if Preferences.getUI("DynamicOnlineCheck"): - self.__networkConfigurationManager = \ - QNetworkConfigurationManager(self) + self.__networkConfigurationManager = QNetworkConfigurationManager( + self) self.__onlineStateChanged( self.__networkConfigurationManager.isOnline()) self.__networkConfigurationManager.onlineStateChanged.connect( @@ -241,8 +243,9 @@ listFileData = reply.readAll() # extract the dictionaries - from E5XML.SpellCheckDictionariesReader import \ + from E5XML.SpellCheckDictionariesReader import ( SpellCheckDictionariesReader + ) reader = SpellCheckDictionariesReader(listFileData, self.addEntry) reader.readXML() url = Preferences.getWebBrowser("SpellCheckDictionariesUrl")
--- a/eric6/WebBrowser/StatusBar/JavaScriptIcon.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/StatusBar/JavaScriptIcon.py Wed Sep 25 18:52:40 2019 +0200 @@ -75,8 +75,10 @@ else: act = menu.addAction(self.tr("Enable JavaScript (temporarily)"), self.__toggleJavaScript) - if self._currentPage() is not None and \ - self._currentPage().url().scheme() == "eric": + if ( + self._currentPage() is not None and + self._currentPage().url().scheme() == "eric" + ): # JavaScript is needed for eric: scheme act.setEnabled(False)
--- a/eric6/WebBrowser/Sync/DirectorySyncHandler.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Sync/DirectorySyncHandler.py Wed Sep 25 18:52:40 2019 +0200 @@ -150,14 +150,15 @@ "speeddial") @param fileName name of the file to be synchronized (string) """ - if not self.__forceUpload and \ - os.path.exists(os.path.join( - Preferences.getWebBrowser("SyncDirectoryPath"), - self._remoteFiles[type_])) and \ - QFileInfo(fileName).lastModified() <= QFileInfo( - os.path.join( - Preferences.getWebBrowser("SyncDirectoryPath"), - self._remoteFiles[type_])).lastModified(): + if ( + not self.__forceUpload and + os.path.exists(os.path.join( + Preferences.getWebBrowser("SyncDirectoryPath"), + self._remoteFiles[type_])) and + QFileInfo(fileName).lastModified() <= QFileInfo( + os.path.join(Preferences.getWebBrowser("SyncDirectoryPath"), + self._remoteFiles[type_])).lastModified() + ): self.__downloadFile( type_, fileName, QFileInfo(os.path.join(
--- a/eric6/WebBrowser/Sync/FtpSyncHandler.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Sync/FtpSyncHandler.py Wed Sep 25 18:52:40 2019 +0200 @@ -11,8 +11,9 @@ import ftplib import io -from PyQt5.QtCore import pyqtSignal, QTimer, QFileInfo, QCoreApplication, \ - QByteArray +from PyQt5.QtCore import ( + pyqtSignal, QTimer, QFileInfo, QCoreApplication, QByteArray +) from E5Network.E5Ftp import E5Ftp, E5FtpProxyType, E5FtpProxyError @@ -139,9 +140,8 @@ does not exist. Upon return, the current directory of the server is the sync directory. """ - storePathList = \ - Preferences.getWebBrowser("SyncFtpPath")\ - .replace("\\", "/").split("/") + storePathList = Preferences.getWebBrowser("SyncFtpPath").replace( + "\\", "/").split("/") if storePathList[0] == "": storePathList.pop(0) while storePathList: @@ -172,8 +172,9 @@ if urlInfo and urlInfo.isValid() and urlInfo.isFile(): if urlInfo.name() in self._remoteFiles.values(): - self.__remoteFilesFound[urlInfo.name()] = \ + self.__remoteFilesFound[urlInfo.name()] = ( urlInfo.lastModified() + ) QCoreApplication.processEvents() @@ -253,10 +254,14 @@ "speeddial") @param fileName name of the file to be synchronized (string) """ - if not self.__forceUpload and \ - self._remoteFiles[type_] in self.__remoteFilesFound: - if QFileInfo(fileName).lastModified() < \ - self.__remoteFilesFound[self._remoteFiles[type_]]: + if ( + not self.__forceUpload and + self._remoteFiles[type_] in self.__remoteFilesFound + ): + if ( + QFileInfo(fileName).lastModified() < + self.__remoteFilesFound[self._remoteFiles[type_]] + ): self.__downloadFile( type_, fileName, self.__remoteFilesFound[self._remoteFiles[type_]]
--- a/eric6/WebBrowser/Sync/SyncCheckPage.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Sync/SyncCheckPage.py Wed Sep 25 18:52:40 2019 +0200 @@ -56,8 +56,10 @@ self.infoLabel.setText(self.tr("Host:")) self.infoDataLabel.setText( Preferences.getWebBrowser("SyncFtpServer")) - elif Preferences.getWebBrowser("SyncType") == \ - SyncGlobals.SyncTypeDirectory: + elif ( + Preferences.getWebBrowser("SyncType") == + SyncGlobals.SyncTypeDirectory + ): self.handlerLabel.setText(self.tr("Shared Directory")) self.infoLabel.setText(self.tr("Directory:")) self.infoDataLabel.setText(
--- a/eric6/WebBrowser/Sync/SyncEncryptionPage.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Sync/SyncEncryptionPage.py Wed Sep 25 18:52:40 2019 +0200 @@ -98,10 +98,12 @@ error = error or self.tr( "Encryption key must not be empty.") - if self.encryptionKeyEdit.text() != "" and \ - self.reencryptCheckBox.isChecked() and \ - (self.encryptionKeyEdit.text() != - self.encryptionKeyAgainEdit.text()): + if ( + self.encryptionKeyEdit.text() != "" and + self.reencryptCheckBox.isChecked() and + (self.encryptionKeyEdit.text() != + self.encryptionKeyAgainEdit.text()) + ): error = error or self.tr( "Repeated encryption key is wrong.")
--- a/eric6/WebBrowser/Sync/SyncFtpSettingsPage.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Sync/SyncFtpSettingsPage.py Wed Sep 25 18:52:40 2019 +0200 @@ -65,7 +65,9 @@ @return flag indicating completeness (boolean) """ - return self.serverEdit.text() != "" and \ - self.userNameEdit.text() != "" and \ - self.passwordEdit.text() != "" and \ + return ( + self.serverEdit.text() != "" and + self.userNameEdit.text() != "" and + self.passwordEdit.text() != "" and self.pathEdit.text() != "" + )
--- a/eric6/WebBrowser/Sync/SyncHandler.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Sync/SyncHandler.py Wed Sep 25 18:52:40 2019 +0200 @@ -215,10 +215,12 @@ except IOError: return QByteArray() - if Preferences.getWebBrowser("SyncEncryptData") and \ - (not Preferences.getWebBrowser("SyncEncryptPasswordsOnly") or - (Preferences.getWebBrowser("SyncEncryptPasswordsOnly") and - type_ == "passwords")): + if ( + Preferences.getWebBrowser("SyncEncryptData") and + (not Preferences.getWebBrowser("SyncEncryptPasswordsOnly") or + (Preferences.getWebBrowser("SyncEncryptPasswordsOnly") and + type_ == "passwords")) + ): key = Preferences.getWebBrowser("SyncEncryptionKey") if not key: return QByteArray() @@ -253,10 +255,12 @@ """ data = bytes(data) - if Preferences.getWebBrowser("SyncEncryptData") and \ - (not Preferences.getWebBrowser("SyncEncryptPasswordsOnly") or - (Preferences.getWebBrowser("SyncEncryptPasswordsOnly") and - type_ == "passwords")): + if ( + Preferences.getWebBrowser("SyncEncryptData") and + (not Preferences.getWebBrowser("SyncEncryptPasswordsOnly") or + (Preferences.getWebBrowser("SyncEncryptPasswordsOnly") and + type_ == "passwords")) + ): key = Preferences.getWebBrowser("SyncEncryptionKey") if not key: return False, self.tr("Invalid encryption key given.")
--- a/eric6/WebBrowser/Sync/SyncHostTypePage.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Sync/SyncHostTypePage.py Wed Sep 25 18:52:40 2019 +0200 @@ -32,8 +32,10 @@ if Preferences.getWebBrowser("SyncType") == SyncGlobals.SyncTypeFtp: self.ftpRadioButton.setChecked(True) - elif Preferences.getWebBrowser("SyncType") == \ - SyncGlobals.SyncTypeDirectory: + elif ( + Preferences.getWebBrowser("SyncType") == + SyncGlobals.SyncTypeDirectory + ): self.directoryRadioButton.setChecked(True) else: self.noneRadioButton.setChecked(True)
--- a/eric6/WebBrowser/Sync/SyncManager.py Wed Sep 25 18:48:22 2019 +0200 +++ b/eric6/WebBrowser/Sync/SyncManager.py Wed Sep 25 18:52:40 2019 +0200 @@ -77,12 +77,16 @@ if self.syncEnabled(): from . import SyncGlobals - if Preferences.getWebBrowser("SyncType") == \ - SyncGlobals.SyncTypeFtp: + if ( + Preferences.getWebBrowser("SyncType") == + SyncGlobals.SyncTypeFtp + ): from .FtpSyncHandler import FtpSyncHandler self.__handler = FtpSyncHandler(self) - elif Preferences.getWebBrowser("SyncType") == \ - SyncGlobals.SyncTypeDirectory: + elif ( + Preferences.getWebBrowser("SyncType") == + SyncGlobals.SyncTypeDirectory + ): from .DirectorySyncHandler import DirectorySyncHandler self.__handler = DirectorySyncHandler(self) self.__handler.syncError.connect(self.__syncError) @@ -94,85 +98,113 @@ # connect sync manager to bookmarks manager if Preferences.getWebBrowser("SyncBookmarks"): - WebBrowserWindow.bookmarksManager()\ + ( + WebBrowserWindow.bookmarksManager() .bookmarksSaved.connect(self.__syncBookmarks) + ) else: try: - WebBrowserWindow.bookmarksManager()\ + ( + WebBrowserWindow.bookmarksManager() .bookmarksSaved.disconnect(self.__syncBookmarks) + ) except TypeError: pass # connect sync manager to history manager if Preferences.getWebBrowser("SyncHistory"): - WebBrowserWindow.historyManager().historySaved\ + ( + WebBrowserWindow.historyManager().historySaved .connect(self.__syncHistory) + ) else: try: - WebBrowserWindow.historyManager()\ + ( + WebBrowserWindow.historyManager() .historySaved.disconnect(self.__syncHistory) + ) except TypeError: pass # connect sync manager to passwords manager if Preferences.getWebBrowser("SyncPasswords"): - WebBrowserWindow.passwordManager()\ + ( + WebBrowserWindow.passwordManager() .passwordsSaved.connect(self.__syncPasswords) + ) else: try: - WebBrowserWindow.passwordManager()\ + ( + WebBrowserWindow.passwordManager() .passwordsSaved.disconnect(self.__syncPasswords) + ) except TypeError: pass # connect sync manager to user agent manager if Preferences.getWebBrowser("SyncUserAgents"): - WebBrowserWindow.userAgentsManager()\ + ( + WebBrowserWindow.userAgentsManager() .userAgentSettingsSaved.connect(self.__syncUserAgents) + ) else: try: - WebBrowserWindow.userAgentsManager()\ + ( + WebBrowserWindow.userAgentsManager() .userAgentSettingsSaved.disconnect( self.__syncUserAgents) + ) except TypeError: pass # connect sync manager to speed dial if Preferences.getWebBrowser("SyncSpeedDial"): - WebBrowserWindow.speedDial()\ + ( + WebBrowserWindow.speedDial() .speedDialSaved.connect(self.__syncSpeedDial) + ) else: try: - WebBrowserWindow.speedDial()\ + ( + WebBrowserWindow.speedDial() .speedDialSaved.disconnect(self.__syncSpeedDial) + ) except TypeError: pass else: self.__handler = None try: - WebBrowserWindow.bookmarksManager()\ + ( + WebBrowserWindow.bookmarksManager() .bookmarksSaved.disconnect(self.__syncBookmarks) + ) except TypeError: pass try: - WebBrowserWindow.historyManager().historySaved\ + ( + WebBrowserWindow.historyManager().historySaved .disconnect(self.__syncHistory) + ) except TypeError: pass try: - WebBrowserWindow.passwordManager()\ + ( + WebBrowserWindow.passwordManager() .passwordsSaved.disconnect(self.__syncPasswords) + ) except TypeError: pass try: - WebBrowserWindow.userAgentsManager()\ + ( + WebBrowserWindow.userAgentsManager() .userAgentSettingsSaved.disconnect(self.__syncUserAgents) + ) except TypeError: pass try: - WebBrowserWindow.speedDial()\ - .speedDialSaved.disconnect(self.__syncSpeedDial) + WebBrowserWindow.speedDial().speedDialSaved.disconnect( + self.__syncSpeedDial) except TypeError: pass @@ -183,8 +215,10 @@ @return flag indicating enabled synchronization """ from . import SyncGlobals - return Preferences.getWebBrowser("SyncEnabled") and \ + return ( + Preferences.getWebBrowser("SyncEnabled") and Preferences.getWebBrowser("SyncType") != SyncGlobals.SyncTypeNone + ) def __syncBookmarks(self): """