From 6e3b69eb3d44a895f82be58cff7f71e1f39fcce2 Mon Sep 17 00:00:00 2001
From: Árni Dagur <agudmundsson@fc-md.umd.edu>
Date: Wed, 8 Apr 2020 01:34:39 -0400
Subject: Add adblock dependency to README, version.py, remove from setup.py

---
 README.asciidoc | 1 +
 1 file changed, 1 insertion(+)

(limited to 'README.asciidoc')

diff --git a/README.asciidoc b/README.asciidoc
index 1f1bb5308..6f61e6ffb 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -133,6 +133,7 @@ The following software and libraries are required to run qutebrowser:
 
 The following libraries are optional:
 
+* https://pypi.org/project/adblock/[adblock] (for Ad-blocking using ABP syntax)
 * http://cthedot.de/cssutils/[cssutils] (for an improved `:download --mhtml`
   with QtWebKit).
 * On Windows, https://pypi.python.org/pypi/colorama/[colorama] for colored log
-- 
cgit v1.2.3-54-g00ecf


From 333152bc22bc5f84cbc30a771fb7fafe67bb61fd Mon Sep 17 00:00:00 2001
From: Árni Dagur <arni@dagur.eu>
Date: Thu, 24 Sep 2020 20:26:29 +0000
Subject: Apply style changes from code review

Co-authored-by: Florian Bruhin <me@the-compiler.org>
---
 README.asciidoc                                    |  2 +-
 misc/requirements/requirements-qutebrowser.txt-raw |  2 +-
 qutebrowser/components/braveadblock.py             | 10 +++++-----
 qutebrowser/config/configdata.yml                  |  2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

(limited to 'README.asciidoc')

diff --git a/README.asciidoc b/README.asciidoc
index cb1bb9833..4da2c0edc 100644
--- a/README.asciidoc
+++ b/README.asciidoc
@@ -135,7 +135,7 @@ The following software and libraries are required to run qutebrowser:
 
 The following libraries are optional:
 
-* https://pypi.org/project/adblock/[adblock] (for Ad-blocking using ABP syntax)
+* https://pypi.org/project/adblock/[adblock] (for improved adblocking using ABP syntax)
 * http://cthedot.de/cssutils/[cssutils] (for an improved `:download --mhtml`
   with QtWebKit).
 * On Windows, https://pypi.python.org/pypi/colorama/[colorama] for colored log
diff --git a/misc/requirements/requirements-qutebrowser.txt-raw b/misc/requirements/requirements-qutebrowser.txt-raw
index a5027bdca..eb7ed011d 100644
--- a/misc/requirements/requirements-qutebrowser.txt-raw
+++ b/misc/requirements/requirements-qutebrowser.txt-raw
@@ -5,4 +5,4 @@ PyYAML
 colorama
 cssutils
 attrs
-adblock
+adblock  # Optional, for improved adblocking
diff --git a/qutebrowser/components/braveadblock.py b/qutebrowser/components/braveadblock.py
index 80329d62c..21145c5f3 100644
--- a/qutebrowser/components/braveadblock.py
+++ b/qutebrowser/components/braveadblock.py
@@ -17,7 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with qutebrowser.  If not, see <http://www.gnu.org/licenses/>.
 
-"""Functions related to ad blocking."""
+"""Functions related to the Brave adblocker."""
 
 import io
 import os.path
@@ -114,7 +114,7 @@ def resource_type_to_string(resource_type: typing.Optional[ResourceType]) -> str
 
 class BraveAdBlocker:
 
-    """Manage blocked hosts based from /etc/hosts-like files.
+    """Manage blocked hosts based on Brave's adblocker.
 
     Attributes:
         enabled: Should we block ads or not
@@ -173,7 +173,7 @@ class BraveAdBlocker:
 
         if not result.matched:
             return False
-        if result.exception is not None and not result.important:
+        elif result.exception is not None and not result.important:
             logger.debug(
                 "Excepting %s from being blocked by %s because of %s",
                 request_url.toDisplayString(),
@@ -181,7 +181,7 @@ class BraveAdBlocker:
                 result.exception,
             )
             return False
-        if _is_whitelisted_url(request_url):
+        elif _is_whitelisted_url(request_url):
             logger.debug(
                 "Request to %s is whitelisted, thus not blocked",
                 request_url.toDisplayString(),
@@ -229,7 +229,7 @@ class BraveAdBlocker:
                     url, self._on_download_finished, self._in_progress
                 )
             self._finished_registering_downloads = True
-            if len(self._in_progress) == 0 and self._wip_filter_set is not None:
+            if not self._in_progress and self._wip_filter_set is not None:
                 self._on_lists_downloaded()
 
     def _on_lists_downloaded(self) -> None:
diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml
index cf3100582..46b8aff85 100644
--- a/qutebrowser/config/configdata.yml
+++ b/qutebrowser/config/configdata.yml
@@ -668,7 +668,7 @@ content.blocking.adblock.lists:
     valtype: Url
     none_ok: true
   desc: |
-    List of URLs of lists which contain adblock rules.
+    List of URLs to ABP-style adblocking rulesets.
 
 content.blocking.whitelist:
   default: []
-- 
cgit v1.2.3-54-g00ecf

