Wed, 25 Sep 2019 18:48:22 +0200
Continued to resolve code style issue M841.
--- a/eric6/WebBrowser/AdBlock/AdBlockDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/AdBlock/AdBlockDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -121,26 +121,34 @@ """ Private slot to show the actions menu. """ - subscriptionEditable = self.__currentSubscription and \ + subscriptionEditable = ( + self.__currentSubscription and self.__currentSubscription.canEditRules() - subscriptionRemovable = self.__currentSubscription and \ + ) + subscriptionRemovable = ( + self.__currentSubscription and self.__currentSubscription.canBeRemoved() - subscriptionEnabled = self.__currentSubscription and \ + ) + subscriptionEnabled = ( + self.__currentSubscription and self.__currentSubscription.isEnabled() + ) menu = self.actionButton.menu() menu.clear() - menu.addAction(self.tr("Add Rule"), self.__addCustomRule)\ - .setEnabled(subscriptionEditable) - menu.addAction(self.tr("Remove Rule"), self.__removeCustomRule)\ - .setEnabled(subscriptionEditable) + menu.addAction( + self.tr("Add Rule"), self.__addCustomRule + ).setEnabled(subscriptionEditable) + menu.addAction( + self.tr("Remove Rule"), self.__removeCustomRule + ).setEnabled(subscriptionEditable) menu.addSeparator() menu.addAction( self.tr("Browse Subscriptions..."), self.__browseSubscriptions) menu.addAction( - self.tr("Remove Subscription"), self.__removeSubscription)\ - .setEnabled(subscriptionRemovable) + self.tr("Remove Subscription"), self.__removeSubscription + ).setEnabled(subscriptionRemovable) if self.__currentSubscription: menu.addSeparator() if subscriptionEnabled: @@ -150,8 +158,8 @@ menu.addAction(txt, self.__switchSubscriptionEnabled) menu.addSeparator() menu.addAction( - self.tr("Update Subscription"), self.__updateSubscription)\ - .setEnabled(not subscriptionEditable) + self.tr("Update Subscription"), self.__updateSubscription + ).setEnabled(not subscriptionEditable) menu.addAction( self.tr("Update All Subscriptions"), self.__updateAllSubscriptions) @@ -217,8 +225,9 @@ Private slot to remove the selected subscription. """ requiresTitles = [] - requiresSubscriptions = \ + requiresSubscriptions = ( self.__manager.getRequiresSubscriptions(self.__currentSubscription) + ) for subscription in requiresSubscriptions: requiresTitles.append(subscription.title()) if requiresTitles: @@ -272,8 +281,9 @@ icon = UI.PixmapCache.getIcon("adBlockPlus.png") else: # disable dependent ones as well - requiresSubscriptions = \ + requiresSubscriptions = ( self.__manager.getRequiresSubscriptions(subscription) + ) icon = UI.PixmapCache.getIcon("adBlockPlusDisabled.png") requiresSubscriptions.append(subscription) for sub in requiresSubscriptions: @@ -310,14 +320,17 @@ @type int """ if index != -1: - self.__currentTreeWidget = \ + self.__currentTreeWidget = ( self.subscriptionsTabWidget.widget(index) - self.__currentSubscription = \ + ) + self.__currentSubscription = ( self.__currentTreeWidget.subscription() + ) - isEasyList = \ + isEasyList = ( self.__currentSubscription.url().toString().startswith( self.__manager.getDefaultSubscriptionUrl()) + ) self.useLimitedEasyListCheckBox.setVisible(isEasyList) @pyqtSlot(str)
--- a/eric6/WebBrowser/AdBlock/AdBlockIcon.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/AdBlock/AdBlockIcon.py Wed Sep 25 18:48:22 2019 +0200 @@ -155,8 +155,10 @@ urlHost = browser.page().url().host() - return urlHost and \ + return ( + urlHost and self.__mw.adBlockManager().isHostExcepted(urlHost) + ) def currentChanged(self): """
--- a/eric6/WebBrowser/AdBlock/AdBlockManager.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/AdBlock/AdBlockManager.py Wed Sep 25 18:48:22 2019 +0200 @@ -10,8 +10,10 @@ import os -from PyQt5.QtCore import pyqtSignal, QObject, QUrl, QUrlQuery, QFile, \ - QByteArray, QMutex, QMutexLocker +from PyQt5.QtCore import ( + pyqtSignal, QObject, QUrl, QUrlQuery, QFile, QByteArray, QMutex, + QMutexLocker +) from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInfo from E5Gui import E5MessageBox @@ -61,17 +63,19 @@ self.__limitedEasyList = Preferences.getWebBrowser( "AdBlockUseLimitedEasyList") - self.__defaultSubscriptionUrlString = \ - "abp:subscribe?location=" \ - "https://easylist-downloads.adblockplus.org/easylist.txt&"\ + self.__defaultSubscriptionUrlString = ( + "abp:subscribe?location=" + "https://easylist-downloads.adblockplus.org/easylist.txt&" "title=EasyList" + ) self.__additionalDefaultSubscriptionUrlStrings = ( "abp:subscribe?location=https://raw.githubusercontent.com/" "hoshsadiq/adblock-nocoin-list/master/nocoin.txt&" "title=NoCoin", ) - self.__customSubscriptionUrlString = \ + self.__customSubscriptionUrlString = ( bytes(self.__customSubscriptionUrl().toEncoded()).decode() + ) self.__mutex = QMutex() self.__matcher = AdBlockMatcher(self) @@ -98,8 +102,8 @@ Public method to close the open search engines manager. """ self.__adBlockDialog and self.__adBlockDialog.close() - self.__adBlockExceptionsDialog and \ - self.__adBlockExceptionsDialog.close() + (self.__adBlockExceptionsDialog and + self.__adBlockExceptionsDialog.close()) self.__saveTimer.saveIfNeccessary() @@ -153,8 +157,10 @@ urlDomain = info.requestUrl().host().lower() urlScheme = info.requestUrl().scheme().lower() - if not self.canRunOnScheme(urlScheme) or \ - not self.__canBeBlocked(info.firstPartyUrl()): + if ( + not self.canRunOnScheme(urlScheme) or + not self.__canBeBlocked(info.firstPartyUrl()) + ): return False res = False @@ -162,8 +168,10 @@ if blockedRule: res = True - if info.resourceType() == \ - QWebEngineUrlRequestInfo.ResourceTypeMainFrame: + if ( + info.resourceType() == + QWebEngineUrlRequestInfo.ResourceTypeMainFrame + ): url = QUrl("eric:adblock") query = QUrlQuery() query.addQueryItem("rule", blockedRule.filter()) @@ -416,9 +424,11 @@ else: subscriptions.append(self.__customSubscriptionUrlString) else: - subscriptions = [self.__defaultSubscriptionUrlString] + \ - self.__additionalDefaultSubscriptionUrlStrings + \ + subscriptions = ( + [self.__defaultSubscriptionUrlString] + + self.__additionalDefaultSubscriptionUrlStrings + [self.__customSubscriptionUrlString] + ) for subscription in subscriptions: url = QUrl.fromEncoded(subscription.encode("utf-8")) adBlockSubscription = AdBlockSubscription( @@ -504,9 +514,11 @@ @return element hiding rules @rtype str """ - if not self.isEnabled() or \ - not self.canRunOnScheme(url.scheme()) or \ - not self.__canBeBlocked(url): + if ( + not self.isEnabled() or + not self.canRunOnScheme(url.scheme()) or + not self.__canBeBlocked(url) + ): return "" return self.__matcher.elementHidingRules() @@ -520,9 +532,11 @@ @return element hiding rules @rtype str """ - if not self.isEnabled() or \ - not self.canRunOnScheme(url.scheme()) or \ - not self.__canBeBlocked(url): + if ( + not self.isEnabled() or + not self.canRunOnScheme(url.scheme()) or + not self.__canBeBlocked(url) + ): return "" return self.__matcher.elementHidingRulesForDomain(url.host())
--- a/eric6/WebBrowser/AdBlock/AdBlockRule.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/AdBlock/AdBlockRule.py Wed Sep 25 18:48:22 2019 +0200 @@ -360,72 +360,98 @@ @return flag indicating a match @rtype bool """ - if self.__type == AdBlockRuleType.CssRule or \ - not self.__isEnabled or \ - self.__isInternalDisabled: + if ( + self.__type == AdBlockRuleType.CssRule or + not self.__isEnabled or + self.__isInternalDisabled + ): return False matched = self.__stringMatch(domain, encodedUrl) if matched: # check domain restrictions - if self.__hasOption(AdBlockRuleOption.DomainRestrictedOption) and \ - not self.matchDomain(request.firstPartyUrl().host()): + if ( + self.__hasOption(AdBlockRuleOption.DomainRestrictedOption) and + not self.matchDomain(request.firstPartyUrl().host()) + ): return False # check third-party restrictions - if self.__hasOption(AdBlockRuleOption.ThirdPartyOption) and \ - not self.matchThirdParty(request): + if ( + self.__hasOption(AdBlockRuleOption.ThirdPartyOption) and + not self.matchThirdParty(request) + ): return False # check object restrictions - if self.__hasOption(AdBlockRuleOption.ObjectOption) and \ - not self.matchObject(request): + if ( + self.__hasOption(AdBlockRuleOption.ObjectOption) and + not self.matchObject(request) + ): return False # check subdocument restrictions - if self.__hasOption(AdBlockRuleOption.SubdocumentOption) and \ - not self.matchSubdocument(request): + if ( + self.__hasOption(AdBlockRuleOption.SubdocumentOption) and + not self.matchSubdocument(request) + ): return False # check xmlhttprequest restriction - if self.__hasOption(AdBlockRuleOption.XMLHttpRequestOption) and \ - not self.matchXmlHttpRequest(request): + if ( + self.__hasOption(AdBlockRuleOption.XMLHttpRequestOption) and + not self.matchXmlHttpRequest(request) + ): return False # check image restriction - if self.__hasOption(AdBlockRuleOption.ImageOption) and \ - not self.matchImage(request): + if ( + self.__hasOption(AdBlockRuleOption.ImageOption) and + not self.matchImage(request) + ): return False # check script restriction - if self.__hasOption(AdBlockRuleOption.ScriptOption) and \ - not self.matchScript(request): + if ( + self.__hasOption(AdBlockRuleOption.ScriptOption) and + not self.matchScript(request) + ): return False # check stylesheet restriction - if self.__hasOption(AdBlockRuleOption.StyleSheetOption) and \ - not self.matchStyleSheet(request): + if ( + self.__hasOption(AdBlockRuleOption.StyleSheetOption) and + not self.matchStyleSheet(request) + ): return False # check object-subrequest restriction - if self.__hasOption(AdBlockRuleOption.ObjectSubrequestOption) and \ - not self.matchObjectSubrequest(request): + if ( + self.__hasOption(AdBlockRuleOption.ObjectSubrequestOption) and + not self.matchObjectSubrequest(request) + ): return False # check ping restriction - if self.__hasOption(AdBlockRuleOption.PingOption) and \ - not self.matchPing(request): + if ( + self.__hasOption(AdBlockRuleOption.PingOption) and + not self.matchPing(request) + ): return False # check media restriction - if self.__hasOption(AdBlockRuleOption.MediaOption) and \ - not self.matchMedia(request): + if ( + self.__hasOption(AdBlockRuleOption.MediaOption) and + not self.matchMedia(request) + ): return False # check font restriction - if self.__hasOption(AdBlockRuleOption.FontOption) and \ - not self.matchFont(request): + if ( + self.__hasOption(AdBlockRuleOption.FontOption) and + not self.matchFont(request) + ): return False return matched @@ -439,8 +465,10 @@ @return flag indicating a match @rtype bool """ - if not self.__hasOption(AdBlockRuleOption.DocumentOption) and \ - not self.__hasOption(AdBlockRuleOption.ElementHideOption): + if ( + not self.__hasOption(AdBlockRuleOption.DocumentOption) and + not self.__hasOption(AdBlockRuleOption.ElementHideOption) + ): return False encodedUrl = bytes(url.toEncoded()).decode()
--- a/eric6/WebBrowser/AdBlock/AdBlockSearchTree.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/AdBlock/AdBlockSearchTree.py Wed Sep 25 18:48:22 2019 +0200 @@ -143,8 +143,10 @@ return None for char in string[1:]: - if node.rule and \ - node.rule.networkMatch(request, domain, urlString): + if ( + node.rule and + node.rule.networkMatch(request, domain, urlString) + ): return node.rule try:
--- a/eric6/WebBrowser/AdBlock/AdBlockSubscription.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/AdBlock/AdBlockSubscription.py Wed Sep 25 18:48:22 2019 +0200 @@ -13,9 +13,10 @@ import hashlib import base64 -from PyQt5.QtCore import pyqtSignal, Qt, QObject, QByteArray, QDateTime, \ - QUrl, QUrlQuery, QCryptographicHash, QFile, QIODevice, QTextStream, \ - QDate, QTime +from PyQt5.QtCore import ( + pyqtSignal, Qt, QObject, QByteArray, QDateTime, QUrl, QUrlQuery, + QCryptographicHash, QFile, QIODevice, QTextStream, QDate, QTime +) from PyQt5.QtNetwork import QNetworkReply, QNetworkRequest from E5Gui import E5MessageBox @@ -318,8 +319,9 @@ self.__updatePeriod = int(period) * 24 remoteModified = self.__remoteModifiedRe.search(line) if remoteModified: - day, month, year, time, hour, minute = \ + day, month, year, time, hour, minute = ( remoteModified.groups() + ) self.__remoteModified.setDate( QDate(int(year), self.__monthNameToNumber[month], @@ -344,14 +346,17 @@ if self.__updatePeriod: updatePeriod = self.__updatePeriod else: - updatePeriod = \ + updatePeriod = ( Preferences.getWebBrowser("AdBlockUpdatePeriod") * 24 - if not self.__lastUpdate.isValid() or \ - (self.__remoteModified.isValid() and - self.__remoteModified.addSecs(updatePeriod * 3600) < - QDateTime.currentDateTime()) or \ - self.__lastUpdate.addSecs(updatePeriod * 3600) < \ - QDateTime.currentDateTime(): + ) + if ( + not self.__lastUpdate.isValid() or + (self.__remoteModified.isValid() and + self.__remoteModified.addSecs(updatePeriod * 3600) < + QDateTime.currentDateTime()) or + self.__lastUpdate.addSecs(updatePeriod * 3600) < + QDateTime.currentDateTime() + ): self.updateNow() def updateNow(self): @@ -422,9 +427,11 @@ return from WebBrowser.WebBrowserWindow import WebBrowserWindow - if WebBrowserWindow.adBlockManager().useLimitedEasyList() and \ + if ( + WebBrowserWindow.adBlockManager().useLimitedEasyList() and self.url().toString().startswith( - WebBrowserWindow.adBlockManager().getDefaultSubscriptionUrl()): + WebBrowserWindow.adBlockManager().getDefaultSubscriptionUrl()) + ): limited = True # ignore Third-party advertisers rules for performance # whitelist rules at the end will be used @@ -486,8 +493,9 @@ # calculate checksum md5 = hashlib.md5() md5.update(data.encode("utf-8")) - calculatedChecksum = base64.b64encode(md5.digest()).decode()\ - .rstrip("=") + calculatedChecksum = ( + base64.b64encode(md5.digest()).decode().rstrip("=") + ) if calculatedChecksum == expectedChecksum: return True else:
--- a/eric6/WebBrowser/AdBlock/AdBlockTreeWidget.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/AdBlock/AdBlockTreeWidget.py Wed Sep 25 18:48:22 2019 +0200 @@ -10,8 +10,10 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont, QColor -from PyQt5.QtWidgets import QAbstractItemView, QTreeWidgetItem, QInputDialog, \ - QLineEdit, QMenu, QApplication +from PyQt5.QtWidgets import ( + QAbstractItemView, QTreeWidgetItem, QInputDialog, QLineEdit, QMenu, + QApplication +) from E5Gui.E5TreeWidget import E5TreeWidget @@ -135,9 +137,11 @@ Public slot to remove the current rule. """ item = self.currentItem() - if item is None or \ - not self.__subscription.canEditRules() or \ - item == self.__topItem: + if ( + item is None or + not self.__subscription.canEditRules() or + item == self.__topItem + ): return offset = item.data(0, Qt.UserRole) @@ -260,8 +264,10 @@ @param evt key press event @type QKeyEvent """ - if evt.key() == Qt.Key_C and \ - evt.modifiers() & Qt.ControlModifier: + if ( + evt.key() == Qt.Key_C and + evt.modifiers() & Qt.ControlModifier + ): self.__copyFilter() elif evt.key() == Qt.Key_Delete: self.removeRule()
--- a/eric6/WebBrowser/Bookmarks/AddBookmarkDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/AddBookmarkDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -90,8 +90,9 @@ if self.__bookmarksManager is None: import WebBrowser.WebBrowserWindow - self.__bookmarksManager = \ + self.__bookmarksManager = ( WebBrowser.WebBrowserWindow.WebBrowserWindow.bookmarksManager() + ) self.__proxyModel = AddBookmarkProxyModel(self) model = self.__bookmarksManager.bookmarksModel() @@ -221,8 +222,10 @@ """ Public slot handling the acceptance of the dialog. """ - if (not self.__addFolder and not self.addressEdit.text()) or \ - not self.nameEdit.text(): + if ( + (not self.__addFolder and not self.addressEdit.text()) or + not self.nameEdit.text() + ): super(AddBookmarkDialog, self).accept() return
--- a/eric6/WebBrowser/Bookmarks/BookmarkPropertiesDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarkPropertiesDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -48,15 +48,18 @@ """ from .BookmarkNode import BookmarkNode - if (self.__node.type() == BookmarkNode.Bookmark and - not self.addressEdit.text()) or \ - not self.nameEdit.text(): + if ( + (self.__node.type() == BookmarkNode.Bookmark and + not self.addressEdit.text()) or + not self.nameEdit.text() + ): super(BookmarkPropertiesDialog, self).accept() return import WebBrowser.WebBrowserWindow - bookmarksManager = WebBrowser.WebBrowserWindow.WebBrowserWindow\ - .bookmarksManager() + bookmarksManager = ( + WebBrowser.WebBrowserWindow.WebBrowserWindow.bookmarksManager() + ) title = self.nameEdit.text() if title != self.__node.title: bookmarksManager.setTitle(self.__node, title)
--- a/eric6/WebBrowser/Bookmarks/BookmarksDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -47,8 +47,9 @@ self.__bookmarksManager = manager if self.__bookmarksManager is None: import WebBrowser.WebBrowserWindow - self.__bookmarksManager = WebBrowser.WebBrowserWindow\ - .WebBrowserWindow.bookmarksManager() + self.__bookmarksManager = ( + WebBrowser.WebBrowserWindow.WebBrowserWindow.bookmarksManager() + ) self.__bookmarksModel = self.__bookmarksManager.bookmarksModel() self.__proxyModel = E5TreeSortFilterProxyModel(self) @@ -238,9 +239,11 @@ idx = self.bookmarksTree.currentIndex() sourceIndex = self.__proxyModel.mapToSource(idx) node = self.__bookmarksModel.node(sourceIndex) - if not idx.parent().isValid() or \ - node is None or \ - node.type() == BookmarkNode.Folder: + if ( + not idx.parent().isValid() or + node is None or + node.type() == BookmarkNode.Folder + ): return if newWindow: @@ -306,8 +309,10 @@ sourceNode = self.__bookmarksModel.node(sourceIndex) row = -1 # append new folder as the last item per default - if sourceNode is not None and \ - sourceNode.type() != BookmarkNode.Folder: + if ( + sourceNode is not None and + sourceNode.type() != BookmarkNode.Folder + ): # If the selected item is not a folder, add a new folder to the # parent folder, but directly below the selected item. idx = idx.parent()
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/ChromeImporter.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/ChromeImporter.py Wed Sep 25 18:48:22 2019 +0200 @@ -128,8 +128,8 @@ except IOError as err: self._error = True self._errorString = self.tr( - "File '{0}' cannot be read.\nReason: {1}")\ - .format(self.__fileName, str(err)) + "File '{0}' cannot be read.\nReason: {1}" + ).format(self.__fileName, str(err)) return None from ..BookmarkNode import BookmarkNode @@ -142,8 +142,9 @@ elif self._id == "chromium": importRootNode.title = self.tr("Chromium Import") else: - importRootNode.title = self.tr("Imported {0}")\ - .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + importRootNode.title = self.tr( + "Imported {0}" + ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) return importRootNode def __processRoots(self, data, rootNode):
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/FirefoxImporter.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/FirefoxImporter.py Wed Sep 25 18:48:22 2019 +0200 @@ -90,8 +90,9 @@ """ if not os.path.exists(self.__fileName): self._error = True - self._errorString = self.tr("File '{0}' does not exist.")\ - .format(self.__fileName) + self._errorString = self.tr( + "File '{0}' does not exist." + ).format(self.__fileName) return False try: @@ -154,8 +155,11 @@ row2 = cursor2.fetchone() if row2: url = QUrl(row2[0]) - if not title or url.isEmpty() or \ - url.scheme() in ["place", "about"]: + if ( + not title or + url.isEmpty() or + url.scheme() in ["place", "about"] + ): continue if parent in folders: @@ -176,6 +180,7 @@ if self._id == "firefox": importRootNode.title = self.tr("Mozilla Firefox Import") else: - importRootNode.title = self.tr("Imported {0}")\ - .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + importRootNode.title = self.tr( + "Imported {0}" + ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/HtmlImporter.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/HtmlImporter.py Wed Sep 25 18:48:22 2019 +0200 @@ -82,8 +82,9 @@ """ if not os.path.exists(self.__fileName): self._error = True - self._errorString = self.tr("File '{0}' does not exist.")\ - .format(self.__fileName) + self._errorString = self.tr( + "File '{0}' does not exist." + ).format(self.__fileName) return False return True @@ -103,6 +104,7 @@ if self._id == "html": importRootNode.title = self.tr("HTML Import") else: - importRootNode.title = self.tr("Imported {0}")\ - .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + importRootNode.title = self.tr( + "Imported {0}" + ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/IExplorerImporter.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/IExplorerImporter.py Wed Sep 25 18:48:22 2019 +0200 @@ -85,13 +85,15 @@ """ if not os.path.exists(self.__fileName): self._error = True - self._errorString = self.tr("Folder '{0}' does not exist.")\ - .format(self.__fileName) + self._errorString = self.tr( + "Folder '{0}' does not exist." + ).format(self.__fileName) return False if not os.path.isdir(self.__fileName): self._error = True - self._errorString = self.tr("'{0}' is not a folder.")\ - .format(self.__fileName) + self._errorString = self.tr( + "'{0}' is not a folder." + ).format(self.__fileName) return True def importedBookmarks(self): @@ -146,6 +148,7 @@ if self._id == "ie": importRootNode.title = self.tr("Internet Explorer Import") else: - importRootNode.title = self.tr("Imported {0}")\ - .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + importRootNode.title = self.tr( + "Imported {0}" + ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/OperaImporter.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/OperaImporter.py Wed Sep 25 18:48:22 2019 +0200 @@ -86,8 +86,9 @@ """ if not os.path.exists(self.__fileName): self._error = True - self._errorString = self.tr("File '{0}' does not exist.")\ - .format(self.__fileName) + self._errorString = self.tr( + "File '{0}' does not exist." + ).format(self.__fileName) return False return True @@ -104,8 +105,8 @@ except IOError as err: self._error = True self._errorString = self.tr( - "File '{0}' cannot be read.\nReason: {1}")\ - .format(self.__fileName, str(err)) + "File '{0}' cannot be read.\nReason: {1}" + ).format(self.__fileName, str(err)) return None folderStack = [] @@ -131,6 +132,7 @@ if self._id == "opera": importRootNode.title = self.tr("Opera Import") else: - importRootNode.title = self.tr("Imported {0}")\ - .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + importRootNode.title = self.tr( + "Imported {0}" + ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/SafariImporter.py Wed Sep 25 18:48:22 2019 +0200 @@ -89,8 +89,9 @@ """ if not os.path.exists(self.__fileName): self._error = True - self._errorString = self.tr("File '{0}' does not exist.")\ - .format(self.__fileName) + self._errorString = self.tr( + "File '{0}' does not exist." + ).format(self.__fileName) return False return True @@ -110,15 +111,18 @@ from ..BookmarkNode import BookmarkNode importRootNode = BookmarkNode(BookmarkNode.Folder) - if bookmarksDict["WebBookmarkFileVersion"] == 1 and \ - bookmarksDict["WebBookmarkType"] == "WebBookmarkTypeList": + if ( + bookmarksDict["WebBookmarkFileVersion"] == 1 and + bookmarksDict["WebBookmarkType"] == "WebBookmarkTypeList" + ): self.__processChildren(bookmarksDict["Children"], importRootNode) if self._id == "safari": importRootNode.title = self.tr("Apple Safari Import") else: - importRootNode.title = self.tr("Imported {0}")\ - .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + importRootNode.title = self.tr( + "Imported {0}" + ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) return importRootNode def __processChildren(self, children, rootNode): @@ -142,5 +146,6 @@ bookmark = BookmarkNode(BookmarkNode.Bookmark, rootNode) bookmark.url = url - bookmark.title = child["URIDictionary"]["title"]\ - .replace("&", "&&") + bookmark.title = ( + child["URIDictionary"]["title"].replace("&", "&&") + )
--- a/eric6/WebBrowser/Bookmarks/BookmarksImporters/XbelImporter.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksImporters/XbelImporter.py Wed Sep 25 18:48:22 2019 +0200 @@ -118,8 +118,9 @@ """ if not os.path.exists(self.__fileName): self._error = True - self._errorString = self.tr("File '{0}' does not exist.")\ - .format(self.__fileName) + self._errorString = self.tr( + "File '{0}' does not exist." + ).format(self.__fileName) return False return True @@ -138,10 +139,10 @@ self._error = True self._errorString = self.tr( """Error when importing bookmarks on line {0},""" - """ column {1}:\n{2}""")\ - .format(reader.lineNumber(), - reader.columnNumber(), - reader.errorString()) + """ column {1}:\n{2}""" + ).format(reader.lineNumber(), + reader.columnNumber(), + reader.errorString()) return None from ..BookmarkNode import BookmarkNode @@ -153,6 +154,7 @@ elif self._id == "xbel": importRootNode.title = self.tr("XBEL Import") else: - importRootNode.title = self.tr("Imported {0}")\ - .format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) + importRootNode.title = self.tr( + "Imported {0}" + ).format(QDate.currentDate().toString(Qt.SystemLocaleShortDate)) return importRootNode
--- a/eric6/WebBrowser/Bookmarks/BookmarksManager.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksManager.py Wed Sep 25 18:48:22 2019 +0200 @@ -10,9 +10,10 @@ import os -from PyQt5.QtCore import pyqtSignal, QT_TRANSLATE_NOOP, QObject, QFile, \ - QIODevice, QXmlStreamReader, QDateTime, QFileInfo, QUrl, \ - QCoreApplication +from PyQt5.QtCore import ( + pyqtSignal, QT_TRANSLATE_NOOP, QObject, QFile, QIODevice, QXmlStreamReader, + QDateTime, QFileInfo, QUrl, QCoreApplication +) from PyQt5.QtWidgets import QUndoStack, QUndoCommand, QDialog from E5Gui import E5MessageBox, E5FileDialog @@ -150,15 +151,19 @@ len(self.__bookmarkRootNode.children()) - 1, -1, -1): node = self.__bookmarkRootNode.children()[index] if node.type() == BookmarkNode.Folder: - if (node.title == self.tr("Toolbar Bookmarks") or - node.title == BOOKMARKBAR) and \ - self.__toolbar is None: + if ( + (node.title == self.tr("Toolbar Bookmarks") or + node.title == BOOKMARKBAR) and + self.__toolbar is None + ): node.title = self.tr(BOOKMARKBAR) self.__toolbar = node - if (node.title == self.tr("Menu") or - node.title == BOOKMARKMENU) and \ - self.__menu is None: + if ( + (node.title == self.tr("Menu") or + node.title == BOOKMARKMENU) and + self.__menu is None + ): node.title = self.tr(BOOKMARKMENU) self.__menu = node else:
--- a/eric6/WebBrowser/Bookmarks/BookmarksMenu.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksMenu.py Wed Sep 25 18:48:22 2019 +0200 @@ -156,9 +156,11 @@ """ act = self.actionAt(pos) - if act is not None and \ - act.menu() is None and \ - self.index(act).isValid(): + if ( + act is not None and + act.menu() is None and + self.index(act).isValid() + ): menu = QMenu() v = act.data()
--- a/eric6/WebBrowser/Bookmarks/BookmarksModel.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksModel.py Wed Sep 25 18:48:22 2019 +0200 @@ -8,8 +8,10 @@ """ -from PyQt5.QtCore import Qt, QAbstractItemModel, QModelIndex, QUrl, \ - QByteArray, QDataStream, QIODevice, QBuffer, QMimeData +from PyQt5.QtCore import ( + Qt, QAbstractItemModel, QModelIndex, QUrl, QByteArray, QDataStream, + QIODevice, QBuffer, QMimeData +) import UI.PixmapCache @@ -126,8 +128,10 @@ bookmarkNode = self.node(parent) children = bookmarkNode.children()[row:(row + count)] for node in children: - if node == self.__bookmarksManager.menu() or \ - node == self.__bookmarksManager.toolbar(): + if ( + node == self.__bookmarksManager.menu() or + node == self.__bookmarksManager.toolbar() + ): continue self.__bookmarksManager.removeBookmark(node) @@ -250,8 +254,12 @@ if parent is None: parent = QModelIndex() - if row < 0 or column < 0 or \ - row >= self.rowCount(parent) or column >= self.columnCount(parent): + if ( + row < 0 or + column < 0 or + row >= self.rowCount(parent) or + column >= self.columnCount(parent) + ): return QModelIndex() parentNode = self.node(parent) @@ -276,8 +284,10 @@ else: parentNode = itemNode.parent() - if parentNode is None or \ - parentNode == self.__bookmarksManager.bookmarks(): + if ( + parentNode is None or + parentNode == self.__bookmarksManager.bookmarks() + ): return QModelIndex() # get the parent's row @@ -319,15 +329,19 @@ if self.hasChildren(index): flags |= Qt.ItemIsDropEnabled - if node == self.__bookmarksManager.menu() or \ - node == self.__bookmarksManager.toolbar(): + if ( + node == self.__bookmarksManager.menu() or + node == self.__bookmarksManager.toolbar() + ): return flags flags |= Qt.ItemIsDragEnabled from .BookmarkNode import BookmarkNode - if (index.column() == 0 and type_ != BookmarkNode.Separator) or \ - (index.column() == 1 and type_ == BookmarkNode.Bookmark): + if ( + (index.column() == 0 and type_ != BookmarkNode.Separator) or + (index.column() == 1 and type_ == BookmarkNode.Bookmark) + ): flags |= Qt.ItemIsEditable return flags
--- a/eric6/WebBrowser/Bookmarks/BookmarksToolBar.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/BookmarksToolBar.py Wed Sep 25 18:48:22 2019 +0200 @@ -63,8 +63,9 @@ """ Private slot to rebuild the toolbar. """ - self.__bookmarksModel = \ + self.__bookmarksModel = ( self.__mw.bookmarksManager().bookmarksModel() + ) self.setModel(self.__bookmarksModel) self.setRootIndex(self.__bookmarksModel.nodeIndex( self.__mw.bookmarksManager().toolbar()))
--- a/eric6/WebBrowser/Bookmarks/XbelReader.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Bookmarks/XbelReader.py Wed Sep 25 18:48:22 2019 +0200 @@ -8,9 +8,10 @@ """ -from PyQt5.QtCore import QXmlStreamReader, QXmlStreamEntityResolver, \ - QIODevice, QFile, QCoreApplication, QXmlStreamNamespaceDeclaration, \ - QDateTime, Qt +from PyQt5.QtCore import ( + QXmlStreamReader, QXmlStreamEntityResolver, QIODevice, QFile, + QCoreApplication, QXmlStreamNamespaceDeclaration, QDateTime, Qt +) from .BookmarkNode import BookmarkNode @@ -66,8 +67,10 @@ self.readNext() if self.isStartElement(): version = self.attributes().value("version") - if self.name() == "xbel" and \ - (not version or version == "1.0"): + if ( + self.name() == "xbel" and + (not version or version == "1.0") + ): self.__readXBEL(root) else: self.raiseError(QCoreApplication.translate(
--- a/eric6/WebBrowser/CookieJar/CookieExceptionsModel.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/CookieJar/CookieExceptionsModel.py Wed Sep 25 18:48:22 2019 +0200 @@ -47,8 +47,8 @@ if role == Qt.SizeHintRole: fm = QFontMetrics(QFont()) height = fm.height() + fm.height() // 3 - width = \ - fm.width(self.headerData(section, orientation, Qt.DisplayRole)) + width = fm.width( + self.headerData(section, orientation, Qt.DisplayRole)) return QSize(width, height) if orientation == Qt.Horizontal and role == Qt.DisplayRole: @@ -130,9 +130,11 @@ if parent.isValid() or self.__cookieJar is None: return 0 else: - return len(self.__allowedCookies) + \ - len(self.__blockedCookies) + \ + return ( + len(self.__allowedCookies) + + len(self.__blockedCookies) + len(self.__sessionCookies) + ) def removeRows(self, row, count, parent=None): """
--- a/eric6/WebBrowser/CookieJar/CookieJar.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/CookieJar/CookieJar.py Wed Sep 25 18:48:22 2019 +0200 @@ -217,8 +217,10 @@ if res: return False - if self.__acceptCookies == self.AcceptOnlyFromSitesNavigatedTo and \ - request.thirdParty: + if ( + self.__acceptCookies == self.AcceptOnlyFromSitesNavigatedTo and + request.thirdParty + ): return False return True @@ -433,9 +435,11 @@ return True else: domainEnding = domain[-(len(rule) + 1):] - if domainEnding and \ - domainEnding[0] == "." and \ - domain.endswith(rule): + if ( + domainEnding and + domainEnding[0] == "." and + domain.endswith(rule) + ): return True if rule == domain:
--- a/eric6/WebBrowser/CookieJar/CookiesExceptionsDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/CookieJar/CookiesExceptionsDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -56,16 +56,16 @@ self.exceptionsTable.verticalHeader().setDefaultSectionSize(height) self.exceptionsTable.verticalHeader().setMinimumSectionSize(-1) for section in range(self.__exceptionsModel.columnCount()): - header = self.exceptionsTable.horizontalHeader()\ - .sectionSizeHint(section) + header = self.exceptionsTable.horizontalHeader().sectionSizeHint( + section) if section == 0: header = fm.width("averagebiglonghost.averagedomain.info") elif section == 1: header = fm.width(self.tr("Allow For Session")) buffer = fm.width("mm") header += buffer - self.exceptionsTable.horizontalHeader()\ - .resizeSection(section, header) + self.exceptionsTable.horizontalHeader().resizeSection( + section, header) def setDomainName(self, domain): """
--- a/eric6/WebBrowser/Download/DownloadAskActionDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Download/DownloadAskActionDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -35,8 +35,10 @@ self.typeLabel.setText(mimeType) self.siteLabel.setText(baseUrl) - if not Preferences.getWebBrowser("VirusTotalEnabled") or \ - Preferences.getWebBrowser("VirusTotalServiceKey") == "": + if ( + not Preferences.getWebBrowser("VirusTotalEnabled") or + Preferences.getWebBrowser("VirusTotalServiceKey") == "" + ): self.scanButton.setHidden(True) msh = self.minimumSizeHint()
--- a/eric6/WebBrowser/Download/DownloadItem.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Download/DownloadItem.py Wed Sep 25 18:48:22 2019 +0200 @@ -10,8 +10,9 @@ import os -from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QTime, QUrl, \ - QStandardPaths, QFileInfo, QDateTime +from PyQt5.QtCore import ( + pyqtSlot, pyqtSignal, Qt, QTime, QUrl, QStandardPaths, QFileInfo, QDateTime +) from PyQt5.QtGui import QPalette, QDesktopServices from PyQt5.QtWidgets import QWidget, QStyle, QDialog from PyQt5.QtWebEngineWidgets import QWebEngineDownloadItem @@ -121,8 +122,10 @@ self.datetimeLabel.hide() self.infoLabel.clear() self.progressBar.setValue(0) - if self.__downloadItem.state() == \ - QWebEngineDownloadItem.DownloadRequested: + if ( + self.__downloadItem.state() == + QWebEngineDownloadItem.DownloadRequested + ): self.__getFileName() if not self.__fileName: self.__downloadItem.cancel() @@ -140,13 +143,15 @@ if self.__gettingFileName: return - savePage = self.__downloadItem.type() == \ + savePage = self.__downloadItem.type() == ( QWebEngineDownloadItem.SavePage + ) documentLocation = QStandardPaths.writableLocation( QStandardPaths.DocumentsLocation) - downloadDirectory = WebBrowserWindow\ - .downloadManager().downloadDirectory() + downloadDirectory = ( + WebBrowserWindow.downloadManager().downloadDirectory() + ) if self.__fileName: fileName = self.__fileName @@ -154,9 +159,8 @@ self.__toDownload = True ask = False else: - defaultFileName, originalFileName = \ - self.__saveFileName( - documentLocation if savePage else downloadDirectory) + defaultFileName, originalFileName = self.__saveFileName( + documentLocation if savePage else downloadDirectory) fileName = defaultFileName self.__originalFileName = originalFileName ask = True @@ -197,8 +201,10 @@ tempLocation = QStandardPaths.writableLocation( QStandardPaths.TempLocation) - fileName = tempLocation + '/' + \ + fileName = ( + tempLocation + '/' + QFileInfo(fileName).completeBaseName() + ) if ask and not self.__autoOpen: self.__gettingFileName = True @@ -229,8 +235,8 @@ @type str """ fileInfo = QFileInfo(fileName) - WebBrowserWindow.downloadManager()\ - .setDownloadDirectory(fileInfo.absoluteDir().absolutePath()) + WebBrowserWindow.downloadManager().setDownloadDirectory( + fileInfo.absoluteDir().absolutePath()) self.filenameLabel.setText(fileInfo.fileName()) self.__fileName = fileName @@ -429,21 +435,25 @@ if bytesTotal > 0: remaining = timeString(timeRemaining) - info = self.tr("{0} of {1} ({2}/sec) {3}")\ - .format( - dataString(self.__bytesReceived), - bytesTotal == -1 and self.tr("?") or - dataString(bytesTotal), - speedString(speed), - remaining) + info = self.tr( + "{0} of {1} ({2}/sec) {3}" + ).format( + dataString(self.__bytesReceived), + bytesTotal == -1 and self.tr("?") or + dataString(bytesTotal), + speedString(speed), + remaining + ) else: if self.__bytesReceived == bytesTotal or bytesTotal == -1: - info = self.tr("{0} downloaded")\ - .format(dataString(self.__bytesReceived)) + info = self.tr( + "{0} downloaded" + ).format(dataString(self.__bytesReceived)) else: - info = self.tr("{0} of {1} - Stopped")\ - .format(dataString(self.__bytesReceived), - dataString(bytesTotal)) + info = self.tr( + "{0} of {1} - Stopped" + ).format(dataString(self.__bytesReceived), + dataString(bytesTotal)) self.infoLabel.setText(info) def downloading(self):
--- a/eric6/WebBrowser/Download/DownloadManager.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Download/DownloadManager.py Wed Sep 25 18:48:22 2019 +0200 @@ -8,11 +8,13 @@ """ -from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QModelIndex, QFileInfo, \ - QUrl, QBasicTimer +from PyQt5.QtCore import ( + pyqtSlot, pyqtSignal, Qt, QModelIndex, QFileInfo, QUrl, QBasicTimer +) from PyQt5.QtGui import QCursor, QKeySequence -from PyQt5.QtWidgets import QDialog, QStyle, QFileIconProvider, QMenu, \ - QApplication, QShortcut +from PyQt5.QtWidgets import ( + QDialog, QStyle, QFileIconProvider, QMenu, QApplication, QShortcut +) from E5Gui import E5MessageBox from E5Gui.E5Application import e5App @@ -123,11 +125,13 @@ self.__contextMenuCopyLink) menu.addSeparator() menu.addAction(self.tr("Select All"), self.__contextMenuSelectAll) - if selectedRowsCount > 1 or \ - (selectedRowsCount == 1 and - not self.__downloads[ + if ( + selectedRowsCount > 1 or + (selectedRowsCount == 1 and + not self.__downloads[ self.downloadsView.selectionModel().selectedRows()[0].row()] - .downloading()): + .downloading()) + ): menu.addSeparator() menu.addAction( self.tr("Remove From List"), @@ -194,8 +198,10 @@ if page.history().count() != 0: return False - if not page.url().isEmpty() and \ - page.url().host() == url.host(): + if ( + not page.url().isEmpty() and + page.url().host() == url.host() + ): return True requestedUrl = page.requestedUrl() @@ -237,14 +243,18 @@ self.__closeDownloadTab(url) # Safe Browsing - from WebBrowser.SafeBrowsing.SafeBrowsingManager import \ + from WebBrowser.SafeBrowsing.SafeBrowsingManager import ( SafeBrowsingManager + ) if SafeBrowsingManager.isEnabled(): - threatLists = \ + threatLists = ( WebBrowserWindow.safeBrowsingManager().lookupUrl(url)[0] + ) if threatLists: - threatMessages = WebBrowserWindow.safeBrowsingManager()\ + threatMessages = ( + WebBrowserWindow.safeBrowsingManager() .getThreatMessages(threatLists) + ) res = E5MessageBox.warning( WebBrowserWindow.getWindow(), self.tr("Suspicuous URL detected"), @@ -345,8 +355,10 @@ remove = False - if itm.downloadedSuccessfully() and \ - self.removePolicy() == DownloadManager.RemoveSuccessFullDownload: + if ( + itm.downloadedSuccessfully() and + self.removePolicy() == DownloadManager.RemoveSuccessFullDownload + ): remove = True if remove: @@ -421,8 +433,10 @@ if not WebBrowserWindow.isPrivate(): downloads = Preferences.getWebBrowser("DownloadManagerDownloads") for download in downloads: - if not download["URL"].isEmpty() and \ - bool(download["Location"]): + if ( + not download["URL"].isEmpty() and + bool(download["Location"]) + ): from .DownloadItem import DownloadItem itm = DownloadItem(parent=self) itm.setData(download) @@ -458,8 +472,10 @@ return self.__model.removeRows(0, self.downloadsCount()) - if self.downloadsCount() == 0 and \ - self.__iconProvider is not None: + if ( + self.downloadsCount() == 0 and + self.__iconProvider is not None + ): self.__iconProvider = None self.changeOccurred() @@ -576,9 +592,11 @@ else: progresses = [] for itm in self.__downloads: - if itm is None or \ - itm.downloadCanceled() or \ - not itm.downloading(): + if ( + itm is None or + itm.downloadCanceled() or + not itm.downloading() + ): continue progresses.append((
--- a/eric6/WebBrowser/Download/DownloadModel.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Download/DownloadModel.py Wed Sep 25 18:48:22 2019 +0200 @@ -43,8 +43,10 @@ return None if role == Qt.ToolTipRole: - if self.__manager.downloads()[index.row()]\ - .downloadedSuccessfully(): + if ( + self.__manager.downloads()[index.row()] + .downloadedSuccessfully() + ): return self.__manager.downloads()[index.row()].getInfoData() return None
--- a/eric6/WebBrowser/FeaturePermissions/FeaturePermissionBar.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/FeaturePermissions/FeaturePermissionBar.py Wed Sep 25 18:48:22 2019 +0200 @@ -68,8 +68,9 @@ pass try: # this was re-added in Qt 5.13.0 - self.__permissionFeatureTexts[QWebEnginePage.Notifications] = \ - self.tr("{0} wants to use desktop notifications.") + self.__permissionFeatureTexts[ + QWebEnginePage.Notifications] = self.tr( + "{0} wants to use desktop notifications.") except AttributeError: pass @@ -91,8 +92,8 @@ pass try: # this was re-added in Qt 5.13.0 - self.__permissionFeatureIconNames[QWebEnginePage.Notifications] = \ - "notification.png" + self.__permissionFeatureIconNames[ + QWebEnginePage.Notifications] = "notification.png" except AttributeError: pass
--- a/eric6/WebBrowser/FeaturePermissions/FeaturePermissionManager.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/FeaturePermissions/FeaturePermissionManager.py Wed Sep 25 18:48:22 2019 +0200 @@ -194,13 +194,15 @@ # no reloading allowed return - for (feature, permission), key in \ - self.__featurePermissionsKeys.items(): - self.__featurePermissions[feature][permission] = \ + for (feature, permission), key in ( + self.__featurePermissionsKeys.items() + ): + self.__featurePermissions[feature][permission] = ( Globals.toList(Preferences.Prefs.settings.value( FeaturePermissionManager.SettingsKeyFormat.format(key), [] )) + ) self.__loaded = True @@ -215,8 +217,9 @@ if WebBrowser.WebBrowserWindow.WebBrowserWindow.isPrivate(): return - for (feature, permission), key in \ - self.__featurePermissionsKeys.items(): + for (feature, permission), key in ( + self.__featurePermissionsKeys.items() + ): Preferences.Prefs.settings.setValue( FeaturePermissionManager.SettingsKeyFormat.format(key), self.__featurePermissions[feature][permission])
--- a/eric6/WebBrowser/FeaturePermissions/FeaturePermissionsDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/FeaturePermissions/FeaturePermissionsDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -9,8 +9,9 @@ from PyQt5.QtCore import pyqtSlot, Qt -from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QTreeWidget, \ - QAbstractItemView +from PyQt5.QtWidgets import ( + QDialog, QTreeWidgetItem, QTreeWidget, QAbstractItemView +) from PyQt5.QtWebEngineWidgets import QWebEnginePage import UI.PixmapCache @@ -200,8 +201,9 @@ QWebEnginePage.DesktopAudioVideoCapture: self.deskAudVidList, }) if hasattr(QWebEnginePage, "Notifications"): - self.__permissionsLists[QWebEnginePage.Notifications] = \ + self.__permissionsLists[QWebEnginePage.Notifications] = ( self.notifList + ) for feature, permissionsList in self.__permissionsLists.items(): for permission in featurePermissions[feature]:
--- a/eric6/WebBrowser/Feeds/FeedsManager.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Feeds/FeedsManager.py Wed Sep 25 18:48:22 2019 +0200 @@ -237,8 +237,10 @@ Private slot to disable/enable various buttons. """ selItems = self.feedsTree.selectedItems() - if len(selItems) == 1 and \ - self.feedsTree.indexOfTopLevelItem(selItems[0]) != -1: + if ( + len(selItems) == 1 and + self.feedsTree.indexOfTopLevelItem(selItems[0]) != -1 + ): enable = True else: enable = False
--- a/eric6/WebBrowser/FlashCookieManager/FlashCookieManager.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/FlashCookieManager/FlashCookieManager.py Wed Sep 25 18:48:22 2019 +0200 @@ -111,8 +111,9 @@ @return flag indicating a blacklisted cookie @rtype bool """ - return cookie.origin in \ - Preferences.getWebBrowser("FlashCookiesBlacklist") + return ( + cookie.origin in Preferences.getWebBrowser("FlashCookiesBlacklist") + ) def __isWhitelisted(self, cookie): """ @@ -123,8 +124,9 @@ @return flag indicating a whitelisted cookie @rtype bool """ - return cookie.origin in \ - Preferences.getWebBrowser("FlashCookiesWhitelist") + return ( + cookie.origin in Preferences.getWebBrowser("FlashCookiesWhitelist") + ) def __removeAllButWhitelisted(self): """ @@ -150,8 +152,10 @@ @return path of the shared data objects @rtype str """ - if "macromedia" in self.flashPlayerDataPath().lower() or \ - "/.gnash" not in self.flashPlayerDataPath().lower(): + if ( + "macromedia" in self.flashPlayerDataPath().lower() or + "/.gnash" not in self.flashPlayerDataPath().lower() + ): return "/#SharedObjects/" else: return "/SharedObjects/" @@ -186,8 +190,10 @@ """ Private slot to refresh the list of cookies. """ - if self.__flashCookieManagerDialog and \ - self.__flashCookieManagerDialog.isVisible(): + if ( + self.__flashCookieManagerDialog and + self.__flashCookieManagerDialog.isVisible() + ): return oldFlashCookies = self.__flashCookies[:]
--- a/eric6/WebBrowser/FlashCookieManager/FlashCookieManagerDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/FlashCookieManager/FlashCookieManagerDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -9,8 +9,9 @@ from PyQt5.QtCore import pyqtSlot, Qt, QPoint, QTimer -from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QApplication, QMenu, \ - QInputDialog, QLineEdit +from PyQt5.QtWidgets import ( + QDialog, QTreeWidgetItem, QApplication, QMenu, QInputDialog, QLineEdit +) from E5Gui import E5MessageBox @@ -164,8 +165,10 @@ # show matching in expanded state filterStr = filterStr.lower() for index in range(self.cookiesList.topLevelItemCount()): - txt = "." + self.cookiesList.topLevelItem(index)\ - .text(0).lower() + txt = ( + "." + + self.cookiesList.topLevelItem(index).text(0).lower() + ) self.cookiesList.topLevelItem(index).setHidden( filterStr not in txt) self.cookiesList.topLevelItem(index).setExpanded(True) @@ -362,8 +365,9 @@ "/macromedia.com/support/flashplayer/sys"): suffix = self.tr(" (settings)") - if cookie.path + "/" + cookie.name in \ - self.__manager.newCookiesList(): + if cookie.path + "/" + cookie.name in ( + self.__manager.newCookiesList() + ): suffix += self.tr(" [new]") font = itm.font(0) font.setBold(True)
--- a/eric6/WebBrowser/FlashCookieManager/FlashCookieNotification.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/FlashCookieManager/FlashCookieNotification.py Wed Sep 25 18:48:22 2019 +0200 @@ -39,8 +39,9 @@ if noCookies == 1: msg = self.tr("A new flash cookie was detected.") else: - msg = self.tr("{0} new flash cookies were detected.")\ - .format(noCookies) + msg = self.tr( + "{0} new flash cookies were detected." + ).format(noCookies) self.setAutoFillBackground(True) self.__layout = QHBoxLayout() self.setLayout(self.__layout)
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -14,8 +14,9 @@ from E5Gui import E5MessageBox -from .Ui_GreaseMonkeyConfigurationDialog import \ +from .Ui_GreaseMonkeyConfigurationDialog import ( Ui_GreaseMonkeyConfigurationDialog +) import UI.PixmapCache @@ -81,8 +82,9 @@ """ script = self.__getScript(item) if script is not None: - from .GreaseMonkeyConfigurationScriptInfoDialog import \ + from .GreaseMonkeyConfigurationScriptInfoDialog import ( GreaseMonkeyConfigurationScriptInfoDialog + ) infoDlg = GreaseMonkeyConfigurationScriptInfoDialog(script, self) infoDlg.exec_() @@ -122,8 +124,10 @@ if topItem is None or bottomItem is None: continue - if topItem.checkState() == Qt.Unchecked and \ - bottomItem.checkState == Qt.Checked: + if ( + topItem.checkState() == Qt.Unchecked and + bottomItem.checkState == Qt.Checked + ): itm = self.scriptsList.takeItem(row + 1) self.scriptsList.insertItem(row, itm) itemMoved = True
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListDelegate.py Wed Sep 25 18:48:22 2019 +0200 @@ -37,8 +37,8 @@ """ super(GreaseMonkeyConfigurationListDelegate, self).__init__(parent) - self.__removePixmap = \ - UI.PixmapCache.getIcon("greaseMonkeyTrash.png").pixmap( + self.__removePixmap = UI.PixmapCache.getIcon( + "greaseMonkeyTrash.png").pixmap( GreaseMonkeyConfigurationListDelegate.RemoveIconSize) self.__rowHeight = 0 self.__padding = 0 @@ -76,19 +76,25 @@ if Globals.isWindowsPlatform(): colorRole = QPalette.Text else: - colorRole = QPalette.HighlightedText \ + colorRole = ( + QPalette.HighlightedText if opt.state & QStyle.State_Selected else QPalette.Text + ) leftPos = self.__padding - rightPos = opt.rect.right() - self.__padding - \ + rightPos = ( + opt.rect.right() - self.__padding - GreaseMonkeyConfigurationListDelegate.RemoveIconSize + ) # Draw background style.drawPrimitive(QStyle.PE_PanelItemViewItem, opt, painter, widget) # Draw checkbox - checkBoxYPos = center - \ + checkBoxYPos = ( + center - GreaseMonkeyConfigurationListDelegate.CheckBoxSize // 2 + ) opt2 = QStyleOptionViewItem(opt) if opt2.checkState == Qt.Checked: opt2.state |= QStyle.State_On @@ -146,8 +152,10 @@ opt.palette, True, info, colorRole) # Draw remove button - removeIconYPos = center - \ + removeIconYPos = ( + center - GreaseMonkeyConfigurationListDelegate.RemoveIconSize // 2 + ) removeIconRect = QRect( rightPos, removeIconYPos, GreaseMonkeyConfigurationListDelegate.RemoveIconSize, @@ -167,24 +175,30 @@ self.initStyleOption(opt, index) widget = opt.widget - style = widget.style() if widget is not None \ + style = ( + widget.style() if widget is not None else QApplication.style() + ) padding = style.pixelMetric(QStyle.PM_FocusFrameHMargin) + 1 titleFont = opt.font titleFont.setBold(True) titleFont.setPointSize(titleFont.pointSize() + 1) - self.__padding = padding \ - if padding > GreaseMonkeyConfigurationListDelegate.MinPadding \ + self.__padding = ( + padding + if padding > GreaseMonkeyConfigurationListDelegate.MinPadding else GreaseMonkeyConfigurationListDelegate.MinPadding + ) titleMetrics = QFontMetrics(titleFont) - self.__rowHeight = 2 * self.__padding + \ - opt.fontMetrics.leading() + \ - opt.fontMetrics.height() + \ + self.__rowHeight = ( + 2 * self.__padding + + opt.fontMetrics.leading() + + opt.fontMetrics.height() + titleMetrics.height() + ) return QSize(GreaseMonkeyConfigurationListDelegate.ItemWidth, self.__rowHeight)
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListWidget.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationListWidget.py Wed Sep 25 18:48:22 2019 +0200 @@ -11,8 +11,9 @@ from PyQt5.QtCore import pyqtSignal, QRect from PyQt5.QtWidgets import QListWidget, QListWidgetItem -from .GreaseMonkeyConfigurationListDelegate import \ +from .GreaseMonkeyConfigurationListDelegate import ( GreaseMonkeyConfigurationListDelegate +) class GreaseMonkeyConfigurationListWidget(QListWidget):
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationScriptInfoDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyConfiguration/GreaseMonkeyConfigurationScriptInfoDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -11,8 +11,9 @@ from PyQt5.QtCore import pyqtSlot from PyQt5.QtWidgets import QDialog -from .Ui_GreaseMonkeyConfigurationScriptInfoDialog import \ +from .Ui_GreaseMonkeyConfigurationScriptInfoDialog import ( Ui_GreaseMonkeyConfigurationScriptInfoDialog +) from ..GreaseMonkeyScript import GreaseMonkeyScript
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyDownloader.py Wed Sep 25 18:48:22 2019 +0200 @@ -126,8 +126,10 @@ self.__fileName = settings.value( self.__reply.request().url().toString()) if not self.__fileName: - name = QFileInfo(self.__reply.request().url().path())\ + name = ( + QFileInfo(self.__reply.request().url().path()) .fileName() + ) if not name: name = "require.js" elif not name.endswith(".js"):
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyManager.py Wed Sep 25 18:48:22 2019 +0200 @@ -10,8 +10,10 @@ import os -from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QObject, QTimer, QFile, \ - QFileInfo, QDir, QSettings, QMetaObject, QUrl, Q_ARG, QCoreApplication +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, Qt, QObject, QTimer, QFile, QFileInfo, QDir, + QSettings, QMetaObject, QUrl, Q_ARG, QCoreApplication +) from PyQt5.QtWidgets import QDialog from E5Gui import E5MessageBox @@ -55,9 +57,11 @@ @param parent reference to the parent widget (QWidget) """ - from .GreaseMonkeyConfiguration.GreaseMonkeyConfigurationDialog \ - import GreaseMonkeyConfigurationDialog - self.__configDiaolg = GreaseMonkeyConfigurationDialog(self, parent) + from .GreaseMonkeyConfiguration import GreaseMonkeyConfigurationDialog + self.__configDiaolg = ( + GreaseMonkeyConfigurationDialog.GreaseMonkeyConfigurationDialog( + self, parent) + ) self.__configDiaolg.show() def downloadScript(self, url): @@ -107,8 +111,9 @@ script = GreaseMonkeyScript(self, fileName) if script.isValid(): if not self.containsScript(script.fullName()): - from .GreaseMonkeyAddScriptDialog import \ + from .GreaseMonkeyAddScriptDialog import ( GreaseMonkeyAddScriptDialog + ) dlg = GreaseMonkeyAddScriptDialog(self, script) deleteScript = dlg.exec_() != QDialog.Accepted else: @@ -307,8 +312,8 @@ if not scriptsDir.exists("requires"): scriptsDir.mkdir("requires") - self.__disabledScripts = \ - Preferences.getWebBrowser("GreaseMonkeyDisabledScripts") + self.__disabledScripts = Preferences.getWebBrowser( + "GreaseMonkeyDisabledScripts") from .GreaseMonkeyScript import GreaseMonkeyScript for fileName in scriptsDir.entryList(["*.js"], QDir.Files):
--- a/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/GreaseMonkey/GreaseMonkeyScript.py Wed Sep 25 18:48:22 2019 +0200 @@ -8,8 +8,10 @@ """ -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QUrl, QRegExp, \ - QByteArray, QCryptographicHash +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, QObject, QUrl, QRegExp, QByteArray, + QCryptographicHash +) from PyQt5.QtGui import QIcon, QPixmap, QImage from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply from PyQt5.QtWebEngineWidgets import QWebEngineScript
--- a/eric6/WebBrowser/History/HistoryCompleter.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/History/HistoryCompleter.py Wed Sep 25 18:48:22 2019 +0200 @@ -192,8 +192,8 @@ @param right index of right item (QModelIndex) @return true, if left is less than right (boolean) """ - frequency_L = \ - self.sourceModel().data(left, HistoryFilterModel.FrequencyRole) + frequency_L = self.sourceModel().data( + left, HistoryFilterModel.FrequencyRole) url_L = self.sourceModel().data(left, HistoryModel.UrlRole).host() title_L = self.sourceModel().data(left, HistoryModel.TitleRole) @@ -201,13 +201,15 @@ self.__wordMatcher.indexIn(title_L) != -1: frequency_L *= 2 - frequency_R = \ - self.sourceModel().data(right, HistoryFilterModel.FrequencyRole) + frequency_R = self.sourceModel().data( + right, HistoryFilterModel.FrequencyRole) url_R = self.sourceModel().data(right, HistoryModel.UrlRole).host() title_R = self.sourceModel().data(right, HistoryModel.TitleRole) - if self.__wordMatcher.indexIn(url_R) != -1 or \ - self.__wordMatcher.indexIn(title_R) != -1: + if ( + self.__wordMatcher.indexIn(url_R) != -1 or + self.__wordMatcher.indexIn(title_R) != -1 + ): frequency_R *= 2 # Sort results in descending frequency-derived score.
--- a/eric6/WebBrowser/History/HistoryDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/History/HistoryDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -51,8 +51,9 @@ self.__historyManager = manager if self.__historyManager is None: import WebBrowser.WebBrowserWindow - self.__historyManager = \ + self.__historyManager = ( WebBrowser.WebBrowserWindow.WebBrowserWindow.historyManager() + ) self.__model = self.__historyManager.historyTreeModel() self.__proxyModel = E5TreeSortFilterProxyModel(self) @@ -94,9 +95,11 @@ menu = QMenu() idx = self.historyTree.indexAt(pos) idx = idx.sibling(idx.row(), 0) - if idx.isValid() and \ - not self.historyTree.model().hasChildren(idx) and \ - len(self.historyTree.selectionModel().selectedRows()) == 1: + if ( + idx.isValid() and + not self.historyTree.model().hasChildren(idx) and + len(self.historyTree.selectionModel().selectedRows()) == 1 + ): menu.addAction( self.tr("&Open"), self.__openHistoryInCurrentTab)
--- a/eric6/WebBrowser/History/HistoryFilterModel.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/History/HistoryFilterModel.py Wed Sep 25 18:48:22 2019 +0200 @@ -34,9 +34,11 @@ @param other reference to the object to check against (HistoryData) @return flag indicating equality (boolean) """ - return self.tailOffset == other.tailOffset and \ + return ( + self.tailOffset == other.tailOffset and (self.frequency == -1 or other.frequency == -1 or self.frequency == other.frequency) + ) def __lt__(self, other): """ @@ -240,8 +242,12 @@ parent = QModelIndex() self.__load() - if row < 0 or row >= self.rowCount(parent) or \ - column < 0 or column >= self.columnCount(parent): + if ( + row < 0 or + row >= self.rowCount(parent) or + column < 0 or + column >= self.columnCount(parent) + ): return QModelIndex() return self.createIndex(row, column, @@ -279,8 +285,8 @@ # the url is known already, so just update the frequency score row = self.__filteredRows.index( HistoryData(self.__historyDict[url], -1)) - self.__filteredRows[row].frequency += \ - self.__frequencyScore(idx) + self.__filteredRows[row].frequency += self.__frequencyScore( + idx) self.__loaded = True @@ -338,20 +344,26 @@ if parent is None: parent = QModelIndex() - if row < 0 or \ - count <= 0 or \ - row + count > self.rowCount(parent) or \ - parent.isValid(): + if ( + row < 0 or + count <= 0 or + row + count > self.rowCount(parent) or + parent.isValid() + ): return False lastRow = row + count - 1 self.sourceModel().rowsRemoved.disconnect(self.__sourceRowsRemoved) self.beginRemoveRows(parent, row, lastRow) oldCount = self.rowCount() - start = self.sourceModel().rowCount() - \ + start = ( + self.sourceModel().rowCount() - self.__filteredRows[row].tailOffset - end = self.sourceModel().rowCount() - \ + ) + end = ( + self.sourceModel().rowCount() - self.__filteredRows[lastRow].tailOffset + ) self.sourceModel().removeRows(start, end - start + 1) self.endRemoveRows() self.sourceModel().rowsRemoved.connect(self.__sourceRowsRemoved) @@ -368,8 +380,8 @@ @param sourceIndex index of the source model (QModelIndex) @return frequency score (integer) """ - loadTime = \ - self.sourceModel().data(sourceIndex, HistoryModel.DateTimeRole) + loadTime = self.sourceModel().data( + sourceIndex, HistoryModel.DateTimeRole) days = loadTime.daysTo(self.__scaleTime) if days <= 1:
--- a/eric6/WebBrowser/History/HistoryManager.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/History/HistoryManager.py Wed Sep 25 18:48:22 2019 +0200 @@ -10,9 +10,10 @@ import os -from PyQt5.QtCore import pyqtSignal, pyqtSlot, QFileInfo, QDateTime, QDate, \ - QTime, QUrl, QTimer, QFile, QIODevice, QByteArray, QDataStream, \ - QTemporaryFile, QObject +from PyQt5.QtCore import ( + pyqtSignal, pyqtSlot, QFileInfo, QDateTime, QDate, QTime, QUrl, QTimer, + QFile, QIODevice, QByteArray, QDataStream, QTemporaryFile, QObject +) from E5Gui import E5MessageBox @@ -51,9 +52,11 @@ (HistoryEntry) @return flag indicating equality (boolean) """ - return other.title == self.title and \ - other.url == self.url and \ + return ( + other.title == self.title and + other.url == self.url and other.dateTime == self.dateTime + ) def __lt__(self, other): """ @@ -141,10 +144,10 @@ from .HistoryTreeModel import HistoryTreeModel self.__historyModel = HistoryModel(self, self) - self.__historyFilterModel = \ - HistoryFilterModel(self.__historyModel, self) - self.__historyTreeModel = \ - HistoryTreeModel(self.__historyFilterModel, self) + self.__historyFilterModel = HistoryFilterModel( + self.__historyModel, self) + self.__historyTreeModel = HistoryTreeModel( + self.__historyFilterModel, self) self.__startFrequencyTimer() @@ -279,8 +282,10 @@ if url.scheme() not in ["eric", "about", "data", "chrome"]: cleanUrlStr = self.__cleanUrlStr(url) for index in range(len(self.__history)): - if cleanUrlStr == self.__history[index].url and \ - (not title or title == self.__history[index].title): + if ( + cleanUrlStr == self.__history[index].url and + (not title or title == self.__history[index].title) + ): itm = self.__history[index] self.__lastSavedUrl = "" self.__history.remove(itm) @@ -410,9 +415,11 @@ self.historyReset.emit() else: breakMS = QDateTime.currentMSecsSinceEpoch() - period - while self.__history and \ + while ( + self.__history and (QDateTime(self.__history[0].dateTime).toMSecsSinceEpoch() > - breakMS): + breakMS) + ): itm = self.__history.pop(0) self.entryRemoved.emit(itm) self.__lastSavedUrl = ""
--- a/eric6/WebBrowser/History/HistoryMenu.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/History/HistoryMenu.py Wed Sep 25 18:48:22 2019 +0200 @@ -10,8 +10,10 @@ import sys -from PyQt5.QtCore import pyqtSignal, Qt, QMimeData, QUrl, QModelIndex, \ - QSortFilterProxyModel, QAbstractProxyModel +from PyQt5.QtCore import ( + pyqtSignal, Qt, QMimeData, QUrl, QModelIndex, QSortFilterProxyModel, + QAbstractProxyModel +) from PyQt5.QtWidgets import QMenu from E5Gui.E5ModelMenu import E5ModelMenu @@ -82,9 +84,11 @@ if not parent.isValid(): folders = self.sourceModel().rowCount() bumpedItems = self.bumpedRows() - if bumpedItems <= self.MOVEDROWS and \ - bumpedItems == self.sourceModel().rowCount( - self.sourceModel().index(0, 0)): + if ( + bumpedItems <= self.MOVEDROWS and + bumpedItems == self.sourceModel().rowCount( + self.sourceModel().index(0, 0)) + ): folders -= 1 return bumpedItems + folders @@ -126,15 +130,17 @@ return self.__treeModel.index( proxyIndex.row(), proxyIndex.column(), self.__treeModel.index(0, 0)) - if bumpedItems <= self.MOVEDROWS and \ - bumpedItems == self.sourceModel().rowCount( - self.__treeModel.index(0, 0)): + if ( + bumpedItems <= self.MOVEDROWS and + bumpedItems == self.sourceModel().rowCount( + self.__treeModel.index(0, 0)) + ): bumpedItems -= 1 return self.__treeModel.index(proxyIndex.row() - bumpedItems, proxyIndex.column()) - historyIndex = self.__treeModel.sourceModel()\ - .index(proxyIndex.internalId(), proxyIndex.column()) + historyIndex = self.__treeModel.sourceModel().index( + proxyIndex.internalId(), proxyIndex.column()) treeIndex = self.__treeModel.mapFromSource(historyIndex) return treeIndex @@ -150,10 +156,12 @@ if parent is None: parent = QModelIndex() - if row < 0 or \ - column < 0 or \ - column >= self.columnCount(parent) or \ - parent.column() > 0: + if ( + row < 0 or + column < 0 or + column >= self.columnCount(parent) or + parent.column() > 0 + ): return QModelIndex() if not parent.isValid(): @@ -190,9 +198,11 @@ sourceRow = self.sourceModel().mapToSource(treeIndexParent).row() bumpedItems = self.bumpedRows() - if bumpedItems <= self.MOVEDROWS and \ - bumpedItems == self.sourceModel().rowCount( - self.sourceModel().index(0, 0)): + if ( + bumpedItems <= self.MOVEDROWS and + bumpedItems == self.sourceModel().rowCount( + self.sourceModel().index(0, 0)) + ): bumpedItems -= 1 return self.createIndex(bumpedItems + treeIndexParent.row(), @@ -241,14 +251,14 @@ @return true, if left is less than right (boolean) """ from .HistoryFilterModel import HistoryFilterModel - frequency_L = \ - self.sourceModel().data(left, HistoryFilterModel.FrequencyRole) - dateTime_L = \ - self.sourceModel().data(left, HistoryModel.DateTimeRole) - frequency_R = \ - self.sourceModel().data(right, HistoryFilterModel.FrequencyRole) - dateTime_R = \ - self.sourceModel().data(right, HistoryModel.DateTimeRole) + frequency_L = self.sourceModel().data( + left, HistoryFilterModel.FrequencyRole) + dateTime_L = self.sourceModel().data( + left, HistoryModel.DateTimeRole) + frequency_R = self.sourceModel().data( + right, HistoryFilterModel.FrequencyRole) + dateTime_R = self.sourceModel().data( + right, HistoryModel.DateTimeRole) # Sort results in descending frequency-derived score. If frequencies # are equal, sort on most recently viewed
--- a/eric6/WebBrowser/History/HistoryTreeModel.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/History/HistoryTreeModel.py Wed Sep 25 18:48:22 2019 +0200 @@ -103,9 +103,11 @@ if parent is None: parent = QModelIndex() - if parent.internalId() != 0 or \ - parent.column() > 0 or \ - self.sourceModel() is None: + if ( + parent.internalId() != 0 or + parent.column() > 0 or + self.sourceModel() is None + ): return 0 # row count OF dates @@ -118,8 +120,8 @@ totalRows = self.sourceModel().rowCount() for row in range(totalRows): - rowDate = self.sourceModel().index(row, 0)\ - .data(HistoryModel.DateRole) + rowDate = self.sourceModel().index(row, 0).data( + HistoryModel.DateRole) if rowDate != currentDate: self.__sourceRowCache.append(row) currentDate = rowDate @@ -178,10 +180,12 @@ if parent is None: parent = QModelIndex() - if row < 0 or \ - column < 0 or \ - column >= self.columnCount(parent) or \ - parent.column() > 0: + if ( + row < 0 or + column < 0 or + column >= self.columnCount(parent) or + parent.column() > 0 + ): return QModelIndex() if not parent.isValid(): @@ -303,8 +307,10 @@ row = self.__sourceRowCache.index(sourceIndex.row()) except ValueError: row = bisect.bisect_left(self.__sourceRowCache, sourceIndex.row()) - if row == len(self.__sourceRowCache) or \ - self.__sourceRowCache[row] != sourceIndex.row(): + if ( + row == len(self.__sourceRowCache) or + self.__sourceRowCache[row] != sourceIndex.row() + ): row -= 1 dateRow = max(0, row) row = sourceIndex.row() - self.__sourceRowCache[dateRow] @@ -322,9 +328,11 @@ if parent is None: parent = QModelIndex() - if row < 0 or \ - count <= 0 or \ - row + count > self.rowCount(parent): + if ( + row < 0 or + count <= 0 or + row + count > self.rowCount(parent) + ): return False self.__removingDown = True @@ -368,8 +376,10 @@ ind = self.__sourceRowCache.index(i) except ValueError: ind = bisect.bisect_left(self.__sourceRowCache, i) - if ind == len(self.__sourceRowCache) or \ - self.__sourceRowCache[ind] != i: + if ( + ind == len(self.__sourceRowCache) or + self.__sourceRowCache[ind] != i + ): ind -= 1 row = max(0, ind) offset = self.__sourceRowCache[row]
--- a/eric6/WebBrowser/Navigation/NavigationBar.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Navigation/NavigationBar.py Wed Sep 25 18:48:22 2019 +0200 @@ -9,8 +9,10 @@ from PyQt5.QtCore import Qt, QUrl -from PyQt5.QtWidgets import QWidget, QHBoxLayout, QStyle, QToolButton, \ - QSplitter, QSizePolicy, QMenu, QAction +from PyQt5.QtWidgets import ( + QWidget, QHBoxLayout, QStyle, QToolButton, QSplitter, QSizePolicy, QMenu, + QAction +) from E5Gui.E5ToolButton import E5ToolButton @@ -115,8 +117,9 @@ urlBar = self.__mw.tabWidget().stackedUrlBar() self.__navigationSplitter.addWidget(urlBar) - from WebBrowser.WebBrowserWebSearchWidget import \ + from WebBrowser.WebBrowserWebSearchWidget import ( WebBrowserWebSearchWidget + ) self.__searchEdit = WebBrowserWebSearchWidget(self.__mw, self) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(2)
--- a/eric6/WebBrowser/Network/EricSchemeHandler.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Network/EricSchemeHandler.py Wed Sep 25 18:48:22 2019 +0200 @@ -8,8 +8,9 @@ """ -from PyQt5.QtCore import pyqtSignal, QByteArray, QBuffer, QIODevice, \ - QUrlQuery, QMutex, QMutexLocker +from PyQt5.QtCore import ( + pyqtSignal, QByteArray, QBuffer, QIODevice, QUrlQuery, QMutex, QMutexLocker +) from PyQt5.QtWidgets import qApp from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler
--- a/eric6/WebBrowser/Network/NetworkManager.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Network/NetworkManager.py Wed Sep 25 18:48:22 2019 +0200 @@ -12,8 +12,9 @@ from PyQt5.QtCore import pyqtSignal, QByteArray from PyQt5.QtWidgets import qApp, QStyle, QDialog -from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkProxy, \ - QNetworkProxyFactory, QNetworkRequest +from PyQt5.QtNetwork import ( + QNetworkAccessManager, QNetworkProxy, QNetworkProxyFactory, QNetworkRequest +) from E5Gui import E5MessageBox @@ -186,12 +187,16 @@ host = error.url().host() - if host in self.__temporarilyIgnoredSslErrors and \ - error.error() in self.__temporarilyIgnoredSslErrors[host]: + if ( + host in self.__temporarilyIgnoredSslErrors and + error.error() in self.__temporarilyIgnoredSslErrors[host] + ): return True - if host in self.__permanentlyIgnoredSslErrors and \ - error.error() in self.__permanentlyIgnoredSslErrors[host]: + if ( + host in self.__permanentlyIgnoredSslErrors and + error.error() in self.__permanentlyIgnoredSslErrors[host] + ): return True title = self.tr("SSL Certificate Error") @@ -236,17 +241,20 @@ @param page reference to the web page @type QWebEnginePage or None """ - urlRoot = "{0}://{1}"\ - .format(url.scheme(), url.authority()) + urlRoot = ( + "{0}://{1}".format(url.scheme(), url.authority()) + ) realm = auth.realm() if not realm and 'realm' in auth.options(): realm = auth.option("realm") if realm: - info = self.tr("<b>Enter username and password for '{0}', " - "realm '{1}'</b>").format(urlRoot, realm) + info = self.tr( + "<b>Enter username and password for '{0}', realm '{1}'</b>" + ).format(urlRoot, realm) else: - info = self.tr("<b>Enter username and password for '{0}'</b>")\ - .format(urlRoot) + info = self.tr( + "<b>Enter username and password for '{0}'</b>" + ).format(urlRoot) from UI.AuthenticationDialog import AuthenticationDialog import WebBrowser.WebBrowserWindow @@ -255,9 +263,10 @@ Preferences.getUser("SavePasswords"), Preferences.getUser("SavePasswords")) if Preferences.getUser("SavePasswords"): - username, password = \ - WebBrowser.WebBrowserWindow.WebBrowserWindow.passwordManager()\ - .getLogin(url, realm) + username, password = ( + WebBrowser.WebBrowserWindow.WebBrowserWindow + .passwordManager().getLogin(url, realm) + ) if username: dlg.setData(username, password) if dlg.exec_() == QDialog.Accepted: @@ -265,8 +274,11 @@ auth.setUser(username) auth.setPassword(password) if Preferences.getUser("SavePasswords") and dlg.shallSave(): - WebBrowser.WebBrowserWindow.WebBrowserWindow.passwordManager()\ - .setLogin(url, realm, username, password) + ( + WebBrowser.WebBrowserWindow.WebBrowserWindow + .passwordManager().setLogin( + url, realm, username, password) + ) else: if page is not None: self.__showAuthenticationErrorPage(page, url) @@ -320,8 +332,9 @@ """ Public slot to (re-)load the list of accepted languages. """ - from WebBrowser.WebBrowserLanguagesDialog import \ + from WebBrowser.WebBrowserLanguagesDialog import ( WebBrowserLanguagesDialog + ) languages = Preferences.toList( Preferences.Prefs.settings.value( "WebBrowser/AcceptLanguages",
--- a/eric6/WebBrowser/Network/NetworkUrlInterceptor.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Network/NetworkUrlInterceptor.py Wed Sep 25 18:48:22 2019 +0200 @@ -10,8 +10,9 @@ from PyQt5.QtCore import QMutex, QMutexLocker, QUrl -from PyQt5.QtWebEngineCore import QWebEngineUrlRequestInterceptor, \ - QWebEngineUrlRequestInfo +from PyQt5.QtWebEngineCore import ( + QWebEngineUrlRequestInterceptor, QWebEngineUrlRequestInfo +) from ..WebBrowserPage import WebBrowserPage @@ -51,8 +52,8 @@ info.setHttpHeader(b"X-Do-Not-Track", b"1") # Send referrer header? - if info.requestUrl().host() not in \ - Preferences.getWebBrowser("SendRefererWhitelist"): + if info.requestUrl().host() not in Preferences.getWebBrowser( + "SendRefererWhitelist"): self.__setRefererHeader(info) # User Agents header @@ -94,10 +95,10 @@ self.__doNotTrack = Preferences.getWebBrowser("DoNotTrack") self.__sendReferer = Preferences.getWebBrowser("RefererSendReferer") - self.__refererDefaultPolicy = \ - Preferences.getWebBrowser("RefererDefaultPolicy") - self.__refererTrimmingPolicy = \ - Preferences.getWebBrowser("RefererTrimmingPolicy") + self.__refererDefaultPolicy = Preferences.getWebBrowser( + "RefererDefaultPolicy") + self.__refererTrimmingPolicy = Preferences.getWebBrowser( + "RefererTrimmingPolicy") def preferencesChanged(self): """ @@ -169,8 +170,10 @@ refererUrl = self.__refererOrigin(url) else: # no-referrer-when-downgrade - if url.scheme() in ("https", "wss") and \ - not self.__potentiallyTrustworthy(url): + if ( + url.scheme() in ("https", "wss") and + not self.__potentiallyTrustworthy(url) + ): refererUrl = b"" else: refererUrl = self.__trimmedReferer(url) @@ -216,8 +219,10 @@ return True if origin.host().startswith("127.") or origin.host().endswith(":1"): return True - if origin.host() == "localhost" or \ - origin.host().endswith(".localhost"): + if ( + origin.host() == "localhost" or + origin.host().endswith(".localhost") + ): return True if origin.scheme() == "file": return True
--- a/eric6/WebBrowser/Network/QtHelpSchemeHandler.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Network/QtHelpSchemeHandler.py Wed Sep 25 18:48:22 2019 +0200 @@ -11,10 +11,12 @@ import mimetypes import os -from PyQt5.QtCore import pyqtSignal, QByteArray, QIODevice, QBuffer, QMutex, \ - QMutexLocker -from PyQt5.QtWebEngineCore import QWebEngineUrlSchemeHandler, \ - QWebEngineUrlRequestJob +from PyQt5.QtCore import ( + pyqtSignal, QByteArray, QIODevice, QBuffer, QMutex, QMutexLocker +) +from PyQt5.QtWebEngineCore import ( + QWebEngineUrlSchemeHandler, QWebEngineUrlRequestJob +) QtDocPath = "qthelp://org.qt-project."
--- a/eric6/WebBrowser/Network/SslErrorExceptionsDialog.py Wed Sep 25 18:37:35 2019 +0200 +++ b/eric6/WebBrowser/Network/SslErrorExceptionsDialog.py Wed Sep 25 18:48:22 2019 +0200 @@ -70,18 +70,21 @@ } try: self.__errorDescriptions[ - QWebEngineCertificateError.CertificateValidityTooLong] = \ - self.tr("The certificate has a validity period that is" - " too long.") + QWebEngineCertificateError.CertificateValidityTooLong + ] = self.tr( + "The certificate has a validity period that is too long." + ) except AttributeError: # the value was added in Qt 5.7 pass try: self.__errorDescriptions[ - QWebEngineCertificateError.CertificateTransparencyRequired] = \ - self.tr("Certificate Transparency was required for this" - " connection, but the server did not provide" - " information that complied with the policy.") + QWebEngineCertificateError.CertificateTransparencyRequired + ] = self.tr( + "Certificate Transparency was required for this" + " connection, but the server did not provide" + " information that complied with the policy." + ) except AttributeError: # the value was added in Qt 5.8 pass