Add type annotations to misc.objects

This commit is contained in:
Florian Bruhin 2018-11-29 11:08:24 +01:00
parent ccab751d3c
commit 4caa2e056b

View File

@ -22,14 +22,20 @@
# NOTE: We need to be careful with imports here, as this is imported from # NOTE: We need to be careful with imports here, as this is imported from
# earlyinit. # earlyinit.
import typing
MYPY = False
if MYPY:
# pylint: disable=unused-import,useless-suppression
from qutebrowser.utils import usertypes
class NoBackend: class NoBackend:
"""Special object when there's no backend set so we notice that.""" """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!") raise AssertionError("No backend set!")
# A usertypes.Backend member backend = NoBackend() # type: typing.Union[usertypes.Backend, NoBackend]
backend = NoBackend()