setup: Disallow untyped calls.
This commit is contained in:
parent
747ef25da6
commit
22d5b7e90a
2 changed files with 7 additions and 2 deletions
|
@ -24,6 +24,7 @@ from typing import (
|
||||||
Dict,
|
Dict,
|
||||||
Iterable,
|
Iterable,
|
||||||
List,
|
List,
|
||||||
|
Optional,
|
||||||
Set,
|
Set,
|
||||||
Tuple,
|
Tuple,
|
||||||
Type,
|
Type,
|
||||||
|
@ -57,8 +58,11 @@ class HookRegistry:
|
||||||
self.group_name_map.setdefault(key, set()).add(hook_cls)
|
self.group_name_map.setdefault(key, set()).add(hook_cls)
|
||||||
return hook_cls # to allow use as a decorator
|
return hook_cls # to allow use as a decorator
|
||||||
|
|
||||||
# This method is too dynamic to typecheck.
|
def import_hooks(self,
|
||||||
def import_hooks(self, mod_name, *hook_names, package=__module__): # type:ignore
|
mod_name: str,
|
||||||
|
*hook_names: str,
|
||||||
|
package: Optional[str]=__module__, # type:ignore[name-defined]
|
||||||
|
) -> None:
|
||||||
module = importlib.import_module(mod_name, package)
|
module = importlib.import_module(mod_name, package)
|
||||||
for hook_name in hook_names:
|
for hook_name in hook_names:
|
||||||
self.add_hook(getattr(module, hook_name))
|
self.add_hook(getattr(module, hook_name))
|
||||||
|
|
|
@ -4,6 +4,7 @@ typecheck=pytest --addopts="--mypy conservancy_beancount"
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
disallow_any_unimported = True
|
disallow_any_unimported = True
|
||||||
|
disallow_untyped_calls = True
|
||||||
disallow_untyped_defs = True
|
disallow_untyped_defs = True
|
||||||
show_error_codes = True
|
show_error_codes = True
|
||||||
strict_equality = True
|
strict_equality = True
|
||||||
|
|
Loading…
Reference in a new issue