diff --git a/.flake8 b/.flake8 index 8c03ef729..7a783a4b0 100644 --- a/.flake8 +++ b/.flake8 @@ -46,6 +46,7 @@ ignore = min-version = 3.4.0 max-complexity = 12 per-file-ignores = + /qutebrowser/api/hook.py : N801 /tests/**/*.py : D100,D101,D401 /tests/unit/browser/test_history.py : N806 /tests/helpers/fixtures.py : N806 diff --git a/qutebrowser/api/downloads.py b/qutebrowser/api/downloads.py index f743f5d7a..82c68d0bd 100644 --- a/qutebrowser/api/downloads.py +++ b/qutebrowser/api/downloads.py @@ -18,6 +18,9 @@ # along with qutebrowser. If not, see . +"""APIs related to downloading files.""" + + import io from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, QUrl @@ -33,6 +36,7 @@ class TempDownload(QObject): finished = pyqtSignal() def __init__(self, item: qtnetworkdownloads.DownloadItem) -> None: + super().__init__() self._item = item self._item.finished.connect(self._on_download_finished) self.successful = False diff --git a/qutebrowser/api/hook.py b/qutebrowser/api/hook.py index bd8e2a635..3f06121da 100644 --- a/qutebrowser/api/hook.py +++ b/qutebrowser/api/hook.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . +# pylint: disable=invalid-name + """Hooks for extensions.""" import importlib @@ -32,7 +34,7 @@ def _add_module_info(func: typing.Callable) -> loader.ModuleInfo: return loader.add_module_info(module) -class init: # noqa: N801,N806 pylint: disable=invalid-name +class init: """Decorator to mark a function to run when initializing.""" diff --git a/qutebrowser/api/requests.py b/qutebrowser/api/requests.py index 990faec88..5c23418b4 100644 --- a/qutebrowser/api/requests.py +++ b/qutebrowser/api/requests.py @@ -19,11 +19,6 @@ """APIs related to intercepting/blocking requests.""" -import typing - -import attr -from PyQt5.QtCore import QUrl - from qutebrowser.extensions import requests # pylint: disable=unused-import from qutebrowser.extensions.requests import Request diff --git a/qutebrowser/components/adblock.py b/qutebrowser/components/adblock.py index aad802bd2..706620948 100644 --- a/qutebrowser/components/adblock.py +++ b/qutebrowser/components/adblock.py @@ -76,7 +76,8 @@ class _FakeDownload(downloads.TempDownload): """A download stub to use on_download_finished with local files.""" - def __init__(self, fileobj: typing.IO[bytes]) -> None: + def __init__(self, # pylint: disable=super-init-not-called + fileobj: typing.IO[bytes]) -> None: self.fileobj = fileobj self.successful = True @@ -337,6 +338,7 @@ def on_config_changed() -> None: @hook.init() def init(context: apitypes.InitContext) -> None: + """Initialize the host blocker.""" global _host_blocker _host_blocker = HostBlocker(data_dir=context.data_dir, config_dir=context.config_dir, diff --git a/qutebrowser/extensions/loader.py b/qutebrowser/extensions/loader.py index 338449c5b..1a9b3d858 100644 --- a/qutebrowser/extensions/loader.py +++ b/qutebrowser/extensions/loader.py @@ -28,7 +28,7 @@ import pathlib import attr -from PyQt5.QtCore import pyqtSlot, QObject +from PyQt5.QtCore import pyqtSlot from qutebrowser import components from qutebrowser.config import config diff --git a/scripts/dev/run_vulture.py b/scripts/dev/run_vulture.py index 51662f3c9..f9262c946 100755 --- a/scripts/dev/run_vulture.py +++ b/scripts/dev/run_vulture.py @@ -130,6 +130,9 @@ def whitelist_generator(): # noqa yield 'scripts.get_coredumpctl_traces.Line.gid' yield 'scripts.importer.import_moz_places.places.row_factory' + # component hooks + yield 'qutebrowser.components.adblock.on_config_changed' + def filter_func(item): """Check if a missing function should be filtered or not.