diff --git a/qutebrowser/api/interceptor.py b/qutebrowser/api/interceptor.py index 634ae1409..78819dc46 100644 --- a/qutebrowser/api/interceptor.py +++ b/qutebrowser/api/interceptor.py @@ -24,7 +24,11 @@ from qutebrowser.extensions import interceptors from qutebrowser.extensions.interceptors import Request -def register(interceptor: interceptors.InterceptorType) -> None: +#: Type annotation for an interceptor function. +InterceptorType = interceptors.InterceptorType + + +def register(interceptor: InterceptorType) -> None: """Register a request interceptor. Whenever a request happens, the interceptor gets called with a diff --git a/qutebrowser/extensions/interceptors.py b/qutebrowser/extensions/interceptors.py index 269c82ab8..7defcf213 100644 --- a/qutebrowser/extensions/interceptors.py +++ b/qutebrowser/extensions/interceptors.py @@ -47,6 +47,7 @@ class Request: self.is_blocked = True +#: Type annotation for an interceptor function. InterceptorType = typing.Callable[[Request], None]