diff options
author | Árni Dagur <arni@dagur.eu> | 2020-11-06 12:44:41 +0000 |
---|---|---|
committer | Árni Dagur <arni@dagur.eu> | 2020-12-19 20:29:51 +0000 |
commit | 2c5faef203cc9aed4901ca5bcd1722a1c87a389b (patch) | |
tree | 5feca4b7219f880b48de9b5ff070545f0459934f /qutebrowser/components | |
parent | 6cdbb3147ed42b1f3b3ae393bf7a4d5397b7ff62 (diff) | |
download | qutebrowser-2c5faef203cc9aed4901ca5bcd1722a1c87a389b.tar.gz qutebrowser-2c5faef203cc9aed4901ca5bcd1722a1c87a389b.zip |
braveadblock.py: Get rid of adblock global
Diffstat (limited to 'qutebrowser/components')
-rw-r--r-- | qutebrowser/components/braveadblock.py | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/qutebrowser/components/braveadblock.py b/qutebrowser/components/braveadblock.py index e60a5a0ef..2089ef8d5 100644 --- a/qutebrowser/components/braveadblock.py +++ b/qutebrowser/components/braveadblock.py @@ -281,20 +281,15 @@ def on_method_changed() -> None: def init(context: apitypes.InitContext) -> None: """Initialize the Brave ad blocker.""" global ad_blocker - global adblock global _outdated_version - if adblock is not None: - _adblock_info = version.MODULE_INFO["adblock"] - if _adblock_info.is_outdated(): - adblock = None # type: ignore[assignment] - _outdated_version = _adblock_info.get_version() - - if adblock is None: + _adblock_info = version.MODULE_INFO["adblock"] + if adblock is None or _adblock_info.is_outdated(): # type: ignore[unreachable] # We want 'adblock' to be an optional dependency. If the module is # not installed or is outdated, we simply set the `ad_blocker` global to # `None`. - ad_blocker = None # type: ignore[unreachable] + ad_blocker = None + _outdated_version = _adblock_info.get_version() _possibly_show_missing_dependency_warning() return |