mypy: Add annotations for qutebrowser.config.configtypes
This commit is contained in:
parent
403e63d6f2
commit
f53fd56c3d
4
mypy.ini
4
mypy.ini
@ -98,6 +98,10 @@ disallow_incomplete_defs = True
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.config.configtypes]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
||||
[mypy-qutebrowser.api.*]
|
||||
disallow_untyped_defs = True
|
||||
disallow_incomplete_defs = True
|
||||
|
@ -76,7 +76,8 @@ class ValidationError(Error):
|
||||
msg: Additional error message.
|
||||
"""
|
||||
|
||||
def __init__(self, value: typing.Any, msg: str) -> None:
|
||||
def __init__(self, value: typing.Any,
|
||||
msg: typing.Union[str, Exception]) -> None:
|
||||
super().__init__("Invalid value '{}' - {}".format(value, msg))
|
||||
self.option = None
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@ if MYPY:
|
||||
from qutebrowser.config import configdata
|
||||
|
||||
|
||||
class _UnsetObject:
|
||||
class Unset:
|
||||
|
||||
"""Sentinel object."""
|
||||
|
||||
@ -45,7 +45,7 @@ class _UnsetObject:
|
||||
return '<UNSET>'
|
||||
|
||||
|
||||
UNSET = _UnsetObject()
|
||||
UNSET = Unset()
|
||||
|
||||
|
||||
@attr.s
|
||||
|
@ -1542,7 +1542,7 @@ class TestRegex:
|
||||
regex.to_py('foo')
|
||||
|
||||
@pytest.mark.parametrize('flags, expected', [
|
||||
(0, 0),
|
||||
(None, 0),
|
||||
('IGNORECASE', re.IGNORECASE),
|
||||
('IGNORECASE | VERBOSE', re.IGNORECASE | re.VERBOSE),
|
||||
])
|
||||
|
@ -26,7 +26,7 @@ from qutebrowser.utils import urlmatch
|
||||
|
||||
|
||||
def test_unset_object_identity():
|
||||
assert configutils._UnsetObject() is not configutils._UnsetObject()
|
||||
assert configutils.Unset() is not configutils.Unset()
|
||||
assert configutils.UNSET is configutils.UNSET
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user