From 4caa2e056b8f9330e9af1d487cabc8b9d92a9f71 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 29 Nov 2018 11:08:24 +0100 Subject: [PATCH] Add type annotations to misc.objects --- qutebrowser/misc/objects.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qutebrowser/misc/objects.py b/qutebrowser/misc/objects.py index d6c116eab..ec558aa37 100644 --- a/qutebrowser/misc/objects.py +++ b/qutebrowser/misc/objects.py @@ -22,14 +22,20 @@ # NOTE: We need to be careful with imports here, as this is imported from # earlyinit. +import typing + +MYPY = False +if MYPY: + # pylint: disable=unused-import,useless-suppression + from qutebrowser.utils import usertypes + class NoBackend: """Special object when there's no backend set so we notice that.""" - def __eq__(self, other): + def __eq__(self, other: typing.Any) -> bool: raise AssertionError("No backend set!") -# A usertypes.Backend member -backend = NoBackend() +backend = NoBackend() # type: typing.Union[usertypes.Backend, NoBackend]