diff -r aedc309827c7 -r a28338eaf694 eric6/WebBrowser/AdBlock/AdBlockRule.py --- 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()