Add type hints to importing

* Add type hints to importing
* Turn on type checking for aqt.importing
This commit is contained in:
Matt Krump 2020-07-24 12:38:34 -06:00
parent 186f1c7720
commit a844a8b0c5
2 changed files with 7 additions and 2 deletions

View File

@ -10,6 +10,7 @@ import traceback
import unicodedata
import zipfile
from concurrent.futures import Future
from typing import Optional
import anki.importing as importing
import aqt.deckchooser
@ -55,7 +56,7 @@ class ChangeMap(QDialog):
self.frm.fields.setCurrentRow(n)
else:
self.frm.fields.setCurrentRow(n + 1)
self.field = None
self.field: Optional[str] = None
def getField(self):
self.exec_()
@ -488,7 +489,9 @@ def _replaceWithApkg(mw, filename, backup):
colname = "collection.anki2"
with z.open(colname) as source, open(mw.pm.collectionPath(), "wb") as target:
shutil.copyfileobj(source, target)
# ignore appears related to https://github.com/python/typeshed/issues/4349
# see if can turn off once issue fix is merged in
shutil.copyfileobj(source, target) # type: ignore
d = os.path.join(mw.pm.profileFolder(), "collection.media")
for n, (cStr, file) in enumerate(

View File

@ -72,3 +72,5 @@ check_untyped_defs=true
check_untyped_defs=true
[mypy-aqt.errors]
check_untyped_defs=true
[mypy-aqt.importing]
check_untyped_defs=true