From 9f002491a40b36aacad0765013887f1372fe2963 Mon Sep 17 00:00:00 2001
From: bpnguyen107 <105088397+bpnguyen107@users.noreply.github.com>
Date: Sat, 26 Oct 2024 19:07:35 -0700
Subject: [PATCH 1/4] Enable strict_optional for aqt/overview.py
---
.mypy.ini | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.mypy.ini b/.mypy.ini
index 4a9cd17f4..30db8f069 100644
--- a/.mypy.ini
+++ b/.mypy.ini
@@ -44,6 +44,8 @@ strict_optional = True
strict_optional = True
[mypy-aqt.preferences]
strict_optional = True
+[mypy-aqt.overview]
+strict_optional = True
[mypy-anki.scheduler.base]
strict_optional = True
[mypy-anki._backend.rsbridge]
From 364a1ada00897a5aa6bf0f941b31387eca6f6182 Mon Sep 17 00:00:00 2001
From: bpnguyen107 <105088397+bpnguyen107@users.noreply.github.com>
Date: Sat, 26 Oct 2024 19:07:43 -0700
Subject: [PATCH 2/4] Fix mypy errors
---
qt/aqt/overview.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/qt/aqt/overview.py b/qt/aqt/overview.py
index 20d276dbb..da017714f 100644
--- a/qt/aqt/overview.py
+++ b/qt/aqt/overview.py
@@ -224,13 +224,14 @@ class Overview:
dyn = ""
return f'
{desc}
'
- def _table(self) -> str | None:
+ def _table(self) -> str:
counts = list(self.mw.col.sched.counts())
current_did = self.mw.col.decks.get_current_id()
deck_node = self.mw.col.sched.deck_due_tree(current_did)
but = self.mw.button
if self.mw.col.v3_scheduler():
+ assert deck_node is not None
buried_new = deck_node.new_count - counts[0]
buried_learning = deck_node.learn_count - counts[1]
buried_review = deck_node.review_count - counts[2]
From 8189255b34fa574208b17ab6949c1e656d0ef407 Mon Sep 17 00:00:00 2001
From: bpnguyen107 <105088397+bpnguyen107@users.noreply.github.com>
Date: Sat, 26 Oct 2024 19:17:25 -0700
Subject: [PATCH 3/4] Enable strict_optional
---
.mypy.ini | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.mypy.ini b/.mypy.ini
index 4a9cd17f4..c13cdf5b4 100644
--- a/.mypy.ini
+++ b/.mypy.ini
@@ -44,6 +44,8 @@ strict_optional = True
strict_optional = True
[mypy-aqt.preferences]
strict_optional = True
+[mypy-aqt.customstudy]
+strict_optional = True
[mypy-anki.scheduler.base]
strict_optional = True
[mypy-anki._backend.rsbridge]
From c02f234ce0082dea6b60fede39ac06f5a514b416 Mon Sep 17 00:00:00 2001
From: bpnguyen107 <105088397+bpnguyen107@users.noreply.github.com>
Date: Sat, 26 Oct 2024 19:19:20 -0700
Subject: [PATCH 4/4] Fix mypy errors
---
qt/aqt/customstudy.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/qt/aqt/customstudy.py b/qt/aqt/customstudy.py
index 730f3843b..eb8921627 100644
--- a/qt/aqt/customstudy.py
+++ b/qt/aqt/customstudy.py
@@ -144,7 +144,11 @@ class CustomStudy(QDialog):
form.spin.setValue(current_spinner_value)
form.preSpin.setText(text_before_spinner)
form.postSpin.setText(text_after_spinner)
- form.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setText(ok)
+
+ ok_button = form.buttonBox.button(QDialogButtonBox.StandardButton.Ok)
+ assert ok_button is not None
+ ok_button.setText(ok)
+
self.radioIdx = idx
def accept(self) -> None: