mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Enable strict_optional for aqt/importing.py (#3527)
* Enable strict_optional * Fix mypy errors
This commit is contained in:
parent
97b729c5d4
commit
e4eaaa57ab
2 changed files with 8 additions and 2 deletions
|
@ -40,6 +40,8 @@ strict_optional = True
|
||||||
strict_optional = True
|
strict_optional = True
|
||||||
[mypy-aqt.editor]
|
[mypy-aqt.editor]
|
||||||
strict_optional = True
|
strict_optional = True
|
||||||
|
[mypy-aqt.importing]
|
||||||
|
strict_optional = True
|
||||||
[mypy-aqt.preferences]
|
[mypy-aqt.preferences]
|
||||||
strict_optional = True
|
strict_optional = True
|
||||||
[mypy-anki.scheduler.base]
|
[mypy-anki.scheduler.base]
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ChangeMap(QDialog):
|
||||||
self.frm.fields.setCurrentRow(n + 1)
|
self.frm.fields.setCurrentRow(n + 1)
|
||||||
self.field: str | None = None
|
self.field: str | None = None
|
||||||
|
|
||||||
def getField(self) -> str:
|
def getField(self) -> str | None:
|
||||||
self.exec()
|
self.exec()
|
||||||
return self.field
|
return self.field
|
||||||
|
|
||||||
|
@ -91,8 +91,10 @@ class ImportDialog(QDialog):
|
||||||
self.importer = importer
|
self.importer = importer
|
||||||
self.frm = aqt.forms.importing.Ui_ImportDialog()
|
self.frm = aqt.forms.importing.Ui_ImportDialog()
|
||||||
self.frm.setupUi(self)
|
self.frm.setupUi(self)
|
||||||
|
help_button = self.frm.buttonBox.button(QDialogButtonBox.StandardButton.Help)
|
||||||
|
assert help_button is not None
|
||||||
qconnect(
|
qconnect(
|
||||||
self.frm.buttonBox.button(QDialogButtonBox.StandardButton.Help).clicked,
|
help_button.clicked,
|
||||||
self.helpRequested,
|
self.helpRequested,
|
||||||
)
|
)
|
||||||
disable_help_button(self)
|
disable_help_button(self)
|
||||||
|
@ -103,6 +105,7 @@ class ImportDialog(QDialog):
|
||||||
gui_hooks.current_note_type_did_change.append(self.modelChanged)
|
gui_hooks.current_note_type_did_change.append(self.modelChanged)
|
||||||
qconnect(self.frm.autoDetect.clicked, self.onDelimiter)
|
qconnect(self.frm.autoDetect.clicked, self.onDelimiter)
|
||||||
self.updateDelimiterButtonText()
|
self.updateDelimiterButtonText()
|
||||||
|
assert self.mw.pm.profile is not None
|
||||||
self.frm.allowHTML.setChecked(self.mw.pm.profile.get("allowHTML", True))
|
self.frm.allowHTML.setChecked(self.mw.pm.profile.get("allowHTML", True))
|
||||||
qconnect(self.frm.importMode.currentIndexChanged, self.importModeChanged)
|
qconnect(self.frm.importMode.currentIndexChanged, self.importModeChanged)
|
||||||
self.frm.importMode.setCurrentIndex(self.mw.pm.profile.get("importMode", 1))
|
self.frm.importMode.setCurrentIndex(self.mw.pm.profile.get("importMode", 1))
|
||||||
|
@ -187,6 +190,7 @@ class ImportDialog(QDialog):
|
||||||
showWarning(tr.importing_the_first_field_of_the_note())
|
showWarning(tr.importing_the_first_field_of_the_note())
|
||||||
return
|
return
|
||||||
self.importer.importMode = self.frm.importMode.currentIndex()
|
self.importer.importMode = self.frm.importMode.currentIndex()
|
||||||
|
assert self.mw.pm.profile is not None
|
||||||
self.mw.pm.profile["importMode"] = self.importer.importMode
|
self.mw.pm.profile["importMode"] = self.importer.importMode
|
||||||
self.importer.allowHTML = self.frm.allowHTML.isChecked()
|
self.importer.allowHTML = self.frm.allowHTML.isChecked()
|
||||||
self.mw.pm.profile["allowHTML"] = self.importer.allowHTML
|
self.mw.pm.profile["allowHTML"] = self.importer.allowHTML
|
||||||
|
|
Loading…
Reference in a new issue