Improve mypy config

- Make mypy stricter
- Warn for unnecessary workarounds
This commit is contained in:
Alan Du 2020-02-25 22:52:03 -05:00
parent e04cbfd7f8
commit cbeb47f8df
3 changed files with 6 additions and 2 deletions

View file

@ -183,7 +183,7 @@ class _Collection:
select crt, mod, scm, dty, usn, ls,
conf, models, decks, dconf, tags from col"""
)
self.conf = json.loads(conf) # type: ignore
self.conf = json.loads(conf)
self.models.load(models)
self.decks.load(decks, dconf)
self.tags.load(tags)

View file

@ -152,7 +152,7 @@ def fields_for_rendering(col: anki.storage._Collection, card: Card, note: Note):
fields["Type"] = card.note_type()["name"]
fields["Deck"] = col.decks.name(card.odid or card.did)
fields["Subdeck"] = fields["Deck"].split("::")[-1]
fields["Card"] = card.template()["name"] # type: ignore
fields["Card"] = card.template()["name"]
flag = card.userFlag()
fields["CardFlag"] = flag and f"flag{flag}" or ""
fields["c%d" % (card.ord + 1)] = "1"

View file

@ -4,6 +4,10 @@ pretty = false
no_strict_optional = true
show_error_codes = true
check_untyped_defs = true
disallow_untyped_decorators = True
warn_redundant_casts = True
warn_unused_configs = True
warn_unused_ignores = True
[mypy-win32file]
ignore_missing_imports = True