mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
fixes for latest mypy
This commit is contained in:
parent
c96784c0eb
commit
727ddd74b6
3 changed files with 7 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
from typing import cast
|
||||||
|
|
||||||
from anki.db import DB
|
from anki.db import DB
|
||||||
from anki.importing.noteimp import ForeignCard, ForeignNote, NoteImporter
|
from anki.importing.noteimp import ForeignCard, ForeignNote, NoteImporter
|
||||||
|
@ -160,17 +161,17 @@ acq_reps+ret_reps, lapses, card_type_id from cards"""
|
||||||
t = mm.newTemplate("Recognition")
|
t = mm.newTemplate("Recognition")
|
||||||
t["qfmt"] = "{{Expression}}"
|
t["qfmt"] = "{{Expression}}"
|
||||||
t["afmt"] = (
|
t["afmt"] = (
|
||||||
t["qfmt"]
|
cast(str, t["qfmt"])
|
||||||
+ """\n\n<hr id=answer>\n\n\
|
+ """\n\n<hr id=answer>\n\n\
|
||||||
{{Pronunciation}}<br>\n{{Meaning}}<br>\n{{Notes}}""" # type: ignore
|
{{Pronunciation}}<br>\n{{Meaning}}<br>\n{{Notes}}"""
|
||||||
)
|
)
|
||||||
mm.addTemplate(m, t)
|
mm.addTemplate(m, t)
|
||||||
t = mm.newTemplate("Production")
|
t = mm.newTemplate("Production")
|
||||||
t["qfmt"] = "{{Meaning}}"
|
t["qfmt"] = "{{Meaning}}"
|
||||||
t["afmt"] = (
|
t["afmt"] = (
|
||||||
t["qfmt"]
|
cast(str, t["qfmt"])
|
||||||
+ """\n\n<hr id=answer>\n\n\
|
+ """\n\n<hr id=answer>\n\n\
|
||||||
{{Expression}}<br>\n{{Pronunciation}}<br>\n{{Notes}}""" # type: ignore
|
{{Expression}}<br>\n{{Pronunciation}}<br>\n{{Notes}}"""
|
||||||
)
|
)
|
||||||
mm.addTemplate(m, t)
|
mm.addTemplate(m, t)
|
||||||
mm.add(m)
|
mm.add(m)
|
||||||
|
|
|
@ -39,7 +39,7 @@ class PaukerImporter(NoteImporter):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = gzip.open(self.file)
|
f = gzip.open(self.file)
|
||||||
tree = ET.parse(f)
|
tree = ET.parse(f) # type: ignore
|
||||||
lesson = tree.getroot()
|
lesson = tree.getroot()
|
||||||
assert lesson.tag == "Lesson"
|
assert lesson.tag == "Lesson"
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -491,7 +491,7 @@ def _replaceWithApkg(mw, filename, backup):
|
||||||
with z.open(colname) as source, open(mw.pm.collectionPath(), "wb") as target:
|
with z.open(colname) as source, open(mw.pm.collectionPath(), "wb") as target:
|
||||||
# ignore appears related to https://github.com/python/typeshed/issues/4349
|
# ignore appears related to https://github.com/python/typeshed/issues/4349
|
||||||
# see if can turn off once issue fix is merged in
|
# see if can turn off once issue fix is merged in
|
||||||
shutil.copyfileobj(source, target) # type: ignore
|
shutil.copyfileobj(source, target)
|
||||||
|
|
||||||
d = os.path.join(mw.pm.profileFolder(), "collection.media")
|
d = os.path.join(mw.pm.profileFolder(), "collection.media")
|
||||||
for n, (cStr, file) in enumerate(
|
for n, (cStr, file) in enumerate(
|
||||||
|
|
Loading…
Reference in a new issue