mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Improve mypy config
- Make mypy stricter - Warn for unnecessary workarounds
This commit is contained in:
parent
e04cbfd7f8
commit
cbeb47f8df
3 changed files with 6 additions and 2 deletions
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue