Document known typecheck failures.

This commit is contained in:
Brett Smith 2020-03-18 08:24:07 -04:00
parent 1caeb9a1a6
commit 661fe676e1
2 changed files with 5 additions and 3 deletions

View file

@ -95,7 +95,7 @@ class Posting(BasePosting):
# of Beancount's type declaration being a smidge too specific: I think it
# would be very unusual for code to actually require a dict over a more
# generic mapping. If it did, this would work fine.
meta: MutableMapping[MetaKey, MetaValue]
meta: MutableMapping[MetaKey, MetaValue] # type:ignore[assignment]
def iter_postings(txn: Transaction) -> Iterator[Posting]:
@ -103,5 +103,6 @@ def iter_postings(txn: Transaction) -> Iterator[Posting]:
yield Posting(
Account(source.account),
*source[1:5],
PostingMeta(txn, index, source),
# see rationale above about Posting.meta
PostingMeta(txn, index, source), # type:ignore[arg-type]
)

View file

@ -56,7 +56,8 @@ class HookRegistry:
self.group_name_map.setdefault(key, set()).add(hook_cls)
return hook_cls # to allow use as a decorator
def import_hooks(self, mod_name, *hook_names, package=__module__):
# This method is too dynamic to typecheck.
def import_hooks(self, mod_name, *hook_names, package=__module__): # type:ignore
module = importlib.import_module(mod_name, package)
for hook_name in hook_names:
self.add_hook(getattr(module, hook_name))