Add type hints for apt.deckconf

* Add type hints for apt.deckconf
* Turn on check_untyped_defs for apt.deckconf
This commit is contained in:
Matt Krump 2020-07-23 20:32:57 -06:00
parent 61e8611b7b
commit b3b4d23f9d
2 changed files with 9 additions and 5 deletions

View file

@ -3,7 +3,9 @@
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from operator import itemgetter
from typing import Dict, Union
from typing import Any, Dict
from PyQt5.QtWidgets import QLineEdit
import aqt
from anki.consts import NEW_CARDS_RANDOM
@ -257,14 +259,14 @@ class DeckConf(QDialog):
# Saving
##################################################
def updateList(self, conf, key, w, minSize=1):
def updateList(self, conf: Any, key: str, w: QLineEdit, minSize: int = 1) -> None:
items = str(w.text()).split(" ")
ret = []
for i in items:
if not i:
for item in items:
if not item:
continue
try:
i = float(i)
i = float(item)
assert i > 0
if i == int(i):
i = int(i)

View file

@ -68,3 +68,5 @@ check_untyped_defs=true
check_untyped_defs=true
[mypy-aqt.dyndeckconf]
check_untyped_defs=true
[mypy-aqt.deckconf]
check_untyped_defs=true