From 22d5b7e90a1e04eb6e5c4b9e21a4dfa85bfd9065 Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Sun, 29 Mar 2020 23:22:35 -0400 Subject: [PATCH] setup: Disallow untyped calls. --- conservancy_beancount/plugin/__init__.py | 8 ++++++-- setup.cfg | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/conservancy_beancount/plugin/__init__.py b/conservancy_beancount/plugin/__init__.py index 1730c8d..20ded0b 100644 --- a/conservancy_beancount/plugin/__init__.py +++ b/conservancy_beancount/plugin/__init__.py @@ -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)) diff --git a/setup.cfg b/setup.cfg index 7ea8404..5b5b19d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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