This commit is contained in:
Florian Bruhin 2018-12-10 18:34:11 +01:00
parent 98543af57b
commit a3279772d5
4 changed files with 6 additions and 4 deletions

View File

@ -27,6 +27,7 @@ from qutebrowser.extensions.interceptors import Request
def register(interceptor: interceptors.InterceptorType) -> None:
"""Register a request interceptor.
Whenever a request happens, the interceptor gets called with a Request object.
Whenever a request happens, the interceptor gets called with a Request
object.
"""
interceptors.register(interceptor)

View File

@ -109,7 +109,7 @@ class HostBlocker:
self._config_hosts_file = str(config_dir / 'blocked-hosts')
def _is_blocked(self, request_url: QUrl,
first_party_url: QUrl = None) -> None:
first_party_url: QUrl = None) -> bool:
"""Check whether the given request is blocked."""
if first_party_url is not None and not first_party_url.isValid():
first_party_url = None

View File

@ -87,7 +87,7 @@ def add_module_info(module: types.ModuleType) -> ModuleInfo:
return module.__qute_module_info # type: ignore
def load_components(*, skip_hooks=False) -> None:
def load_components(*, skip_hooks: bool = False) -> None:
"""Load everything from qutebrowser.components."""
for info in walk_components():
_load_component(info, skip_hooks=skip_hooks)
@ -143,7 +143,7 @@ def _get_init_context() -> InitContext:
def _load_component(info: ExtensionInfo, *,
skip_hooks=False) -> types.ModuleType:
skip_hooks: bool = False) -> types.ModuleType:
"""Load the given extension and run its init hook (if any).
Args:

View File

@ -75,6 +75,7 @@ def test_get_init_context(data_tmpdir, config_tmpdir, fake_args):
def test_add_module_info():
# pylint: disable=no-member
mod = types.ModuleType('testmodule')
info1 = loader.add_module_info(mod)
assert mod.__qute_module_info is info1