mirror of
https://github.com/ankitects/anki.git
synced 2025-12-11 13:56:55 -05:00
Add type hints to aqt.models
* Add type hints to aqt.models * Turn on type checking for aqt.models
This commit is contained in:
parent
61e8611b7b
commit
b0dd85f87e
2 changed files with 5 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ from typing import List, Optional
|
||||||
|
|
||||||
import aqt.clayout
|
import aqt.clayout
|
||||||
from anki import stdmodels
|
from anki import stdmodels
|
||||||
|
from anki.backend_pb2 import NoteTypeNameIDUseCount
|
||||||
from anki.lang import _, ngettext
|
from anki.lang import _, ngettext
|
||||||
from anki.models import NoteType
|
from anki.models import NoteType
|
||||||
from anki.notes import Note
|
from anki.notes import Note
|
||||||
|
|
@ -88,7 +89,7 @@ class Models(QDialog):
|
||||||
|
|
||||||
self.mw.taskman.with_progress(save, on_done, self)
|
self.mw.taskman.with_progress(save, on_done, self)
|
||||||
|
|
||||||
def updateModelsList(self, notetypes):
|
def updateModelsList(self, notetypes: List[NoteTypeNameIDUseCount]) -> None:
|
||||||
row = self.form.modelsList.currentRow()
|
row = self.form.modelsList.currentRow()
|
||||||
if row == -1:
|
if row == -1:
|
||||||
row = 0
|
row = 0
|
||||||
|
|
@ -96,8 +97,7 @@ class Models(QDialog):
|
||||||
|
|
||||||
self.models = notetypes
|
self.models = notetypes
|
||||||
for m in self.models:
|
for m in self.models:
|
||||||
mUse = m.use_count
|
mUse = ngettext("%d note", "%d notes", m.use_count) % m.use_count
|
||||||
mUse = ngettext("%d note", "%d notes", mUse) % mUse
|
|
||||||
item = QListWidgetItem("%s [%s]" % (m.name, mUse))
|
item = QListWidgetItem("%s [%s]" % (m.name, mUse))
|
||||||
self.form.modelsList.addItem(item)
|
self.form.modelsList.addItem(item)
|
||||||
self.form.modelsList.setCurrentRow(row)
|
self.form.modelsList.setCurrentRow(row)
|
||||||
|
|
|
||||||
|
|
@ -68,3 +68,5 @@ check_untyped_defs=true
|
||||||
check_untyped_defs=true
|
check_untyped_defs=true
|
||||||
[mypy-aqt.dyndeckconf]
|
[mypy-aqt.dyndeckconf]
|
||||||
check_untyped_defs=true
|
check_untyped_defs=true
|
||||||
|
[mypy-aqt.models]
|
||||||
|
check_untyped_defs=true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue