summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÁrni Dagur <arni@dagur.eu>2020-11-26 19:04:30 +0000
committerÁrni Dagur <arni@dagur.eu>2020-12-19 20:30:10 +0000
commit2d321ebb7f6a7a8c6213dd4d395663f797c67e7e (patch)
tree24e207c6b6f7c1d782bcb9779f7ed7357f0eb009
parent3417fd58977b7e98fe616be163b1db62c222560e (diff)
downloadqutebrowser-2d321ebb7f6a7a8c6213dd4d395663f797c67e7e.tar.gz
qutebrowser-2d321ebb7f6a7a8c6213dd4d395663f797c67e7e.zip
Fix flake8 complaints
-rw-r--r--qutebrowser/components/braveadblock.py2
-rw-r--r--tests/end2end/data/brave-adblock/generate.py26
2 files changed, 22 insertions, 6 deletions
diff --git a/qutebrowser/components/braveadblock.py b/qutebrowser/components/braveadblock.py
index 2089ef8d5..4f7afee7c 100644
--- a/qutebrowser/components/braveadblock.py
+++ b/qutebrowser/components/braveadblock.py
@@ -284,7 +284,7 @@ def init(context: apitypes.InitContext) -> None:
global _outdated_version
_adblock_info = version.MODULE_INFO["adblock"]
- if adblock is None or _adblock_info.is_outdated(): # type: ignore[unreachable]
+ 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`.
diff --git a/tests/end2end/data/brave-adblock/generate.py b/tests/end2end/data/brave-adblock/generate.py
index 954dcebd5..28a8aab67 100644
--- a/tests/end2end/data/brave-adblock/generate.py
+++ b/tests/end2end/data/brave-adblock/generate.py
@@ -1,6 +1,22 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-# vim: fenc=utf-8:et:ts=4:sts=4:sw=4:fdm=marker
+# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
+
+# Copyright 2020 Árni Dagur <arni@dagur.eu>
+#
+# This file is part of qutebrowser.
+#
+# qutebrowser is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# qutebrowser is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import io
import os
@@ -16,7 +32,7 @@ ROWS_TO_USE = 30_000
def type_rename(type_str: str) -> Optional[str]:
- # Use the same resource type names as QtWebEngine
+ """Use the same resource type names as QtWebEngine."""
if type_str == "other":
return "unknown"
if type_str == "xmlhttprequest":
@@ -32,7 +48,7 @@ if __name__ == "__main__":
# Download file or use cached version
if os.path.isfile(CACHE_LOCATION):
print(f"Using cached file {CACHE_LOCATION}")
- with open(CACHE_LOCATION, "r") as cache_f:
+ with open(CACHE_LOCATION, "r", encoding="utf-8") as cache_f:
data = io.StringIO(cache_f.read())
else:
request = urllib.request.Request(URL)
@@ -41,7 +57,7 @@ if __name__ == "__main__":
assert response.status == 200
data_str = response.read().decode("utf-8")
print(f"Saving to cache file {CACHE_LOCATION} ...")
- with open(CACHE_LOCATION, "w") as cache_f:
+ with open(CACHE_LOCATION, "w", encoding="utf-8") as cache_f:
cache_f.write(data_str)
data = io.StringIO(data_str)