Changeset - 22d5b7e90a1e
[Not reviewed]
0 2 0
Brett Smith - 4 years ago 2020-03-30 03:22:35
brettcsmith@brettcsmith.org
setup: Disallow untyped calls.
2 files changed with 7 insertions and 2 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/plugin/__init__.py
Show inline comments
...
 
@@ -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))
setup.cfg
Show inline comments
...
 
@@ -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
0 comments (0 inline, 0 general)