diff --git a/.mypy.ini b/.mypy.ini index be7fcefa8..f9fdf42f5 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -30,6 +30,12 @@ disallow_untyped_defs = False strict_optional = True [mypy-aqt.browser.*] strict_optional = True +[mypy-aqt.data.*] +strict_optional = True +[mypy-aqt.forms.*] +strict_optional = True +[mypy-aqt.import_export.*] +strict_optional = True [mypy-aqt.operations.*] strict_optional = True [mypy-anki.scheduler.base] @@ -41,10 +47,10 @@ disallow_untyped_defs = False [mypy-stringcase] ignore_missing_imports = True [mypy-aqt.mpv] -disallow_untyped_defs=False -ignore_errors=True +disallow_untyped_defs = False +ignore_errors = True [mypy-aqt.winpaths] -disallow_untyped_defs=False +disallow_untyped_defs = False [mypy-win32file] ignore_missing_imports = True diff --git a/CONTRIBUTORS b/CONTRIBUTORS index cf5dd1538..b0002241c 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -187,7 +187,7 @@ Christian Donat Asuka Minato Dillon Baldwin Voczi -Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com> +Ben Nguyen <105088397+bpnguyen107@users.noreply.github.com> Themis Demetriades Luke Bartholomew Gregory Abrasaldo diff --git a/qt/aqt/import_export/exporting.py b/qt/aqt/import_export/exporting.py index ad7fc4ef6..4903faea3 100644 --- a/qt/aqt/import_export/exporting.py +++ b/qt/aqt/import_export/exporting.py @@ -88,7 +88,9 @@ class ExportDialog(QDialog): self.frm.includeHTML.setChecked(True) # set default option if accessed through deck button if did: - name = self.mw.col.decks.get(did)["name"] + deck = self.mw.col.decks.get(did) + assert deck is not None + name = deck["name"] index = self.frm.deck.findText(name) self.frm.deck.setCurrentIndex(index) self.frm.includeSched.setChecked(False) diff --git a/qt/aqt/import_export/import_dialog.py b/qt/aqt/import_export/import_dialog.py index 1a5118503..68482d39e 100644 --- a/qt/aqt/import_export/import_dialog.py +++ b/qt/aqt/import_export/import_dialog.py @@ -64,7 +64,7 @@ class ImportDialog(QDialog): restoreGeom(self, self.args.title, default_size=self.DEFAULT_SIZE) addCloseShortcut(self) - self.web = AnkiWebView(kind=self.args.kind) + self.web: AnkiWebView | None = AnkiWebView(kind=self.args.kind) self.web.setVisible(False) self.web.load_sveltekit_page(f"{self.args.ts_page}/{quote(self.args.path)}") layout = QVBoxLayout() @@ -78,6 +78,7 @@ class ImportDialog(QDialog): def reject(self) -> None: if self.mw.col and self.windowModality() == Qt.WindowModality.ApplicationModal: self.mw.col.set_wants_abort() + assert self.web is not None self.web.cleanup() self.web = None saveGeom(self, self.args.title)