From b3b4d23f9d8942c883081bb9fdd16cf3a00aaebc Mon Sep 17 00:00:00 2001 From: Matt Krump <1036969+mkrump@users.noreply.github.com> Date: Thu, 23 Jul 2020 20:32:57 -0600 Subject: [PATCH 1/2] Add type hints for apt.deckconf * Add type hints for apt.deckconf * Turn on check_untyped_defs for apt.deckconf --- qt/aqt/deckconf.py | 12 +++++++----- qt/mypy.ini | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/qt/aqt/deckconf.py b/qt/aqt/deckconf.py index cb8c37a4f..cd62042af 100644 --- a/qt/aqt/deckconf.py +++ b/qt/aqt/deckconf.py @@ -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) diff --git a/qt/mypy.ini b/qt/mypy.ini index 063e7abc8..4a13f5e7d 100644 --- a/qt/mypy.ini +++ b/qt/mypy.ini @@ -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 From 0c640d13ba96e7f063252671b6ead66cc10d3981 Mon Sep 17 00:00:00 2001 From: Matt Krump <1036969+mkrump@users.noreply.github.com> Date: Thu, 23 Jul 2020 22:35:49 -0600 Subject: [PATCH 2/2] Move name in Contributors so contrib.sh recognizes change of email --- CONTRIBUTORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 2d3d27f4f..b22118f34 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -42,8 +42,8 @@ kenden Nickolay Yudin neitrinoweb Andreas Reis -Alexander Presnyakov Matt Krump +Alexander Presnyakov ******************** The text of the 3 clause BSD license follows: