setup: Disallow untyped calls.

This commit is contained in:
Brett Smith 2020-03-29 23:22:35 -04:00
parent 747ef25da6
commit 22d5b7e90a
2 changed files with 7 additions and 2 deletions

View file

@ -24,6 +24,7 @@ from typing import (
Dict,
Iterable,
List,
Optional,
Set,
Tuple,
Type,
@ -57,8 +58,11 @@ class HookRegistry:
self.group_name_map.setdefault(key, set()).add(hook_cls)
return hook_cls # to allow use as a decorator
# This method is too dynamic to typecheck.
def import_hooks(self, mod_name, *hook_names, package=__module__): # type:ignore
def import_hooks(self,
mod_name: str,
*hook_names: str,
package: Optional[str]=__module__, # type:ignore[name-defined]
) -> None:
module = importlib.import_module(mod_name, package)
for hook_name in hook_names:
self.add_hook(getattr(module, hook_name))

View file

@ -4,6 +4,7 @@ typecheck=pytest --addopts="--mypy conservancy_beancount"
[mypy]
disallow_any_unimported = True
disallow_untyped_calls = True
disallow_untyped_defs = True
show_error_codes = True
strict_equality = True