Merge pull request #704 from mkrump/help-wanted-4-add-type-hints-deckconf

Add type hints for apt.deckconf
This commit is contained in:
Damien Elmes 2020-07-25 11:41:35 +10:00 committed by GitHub
commit 8780fa4986
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 6 deletions

View File

@ -42,8 +42,8 @@ kenden
Nickolay Yudin <kelciour@gmail.com> Nickolay Yudin <kelciour@gmail.com>
neitrinoweb <github.com/neitrinoweb/> neitrinoweb <github.com/neitrinoweb/>
Andreas Reis <github.com/rathsky> Andreas Reis <github.com/rathsky>
Alexander Presnyakov <flagist0@gmail.com>
Matt Krump <github.com/mkrump> Matt Krump <github.com/mkrump>
Alexander Presnyakov <flagist0@gmail.com>
******************** ********************
The text of the 3 clause BSD license follows: The text of the 3 clause BSD license follows:

View File

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

View File

@ -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.deckconf]
check_untyped_defs=true