Merge pull request #1191 from abdnh/addmodel-fix

Fix wrong stock note type being used
This commit is contained in:
Damien Elmes 2021-05-24 10:43:30 +10:00 committed by GitHub
commit cf91e85fe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@
from __future__ import annotations
from typing import Callable, List, Tuple
from typing import Any, Callable, List, Tuple
import anki
import anki._backend.backend_pb2 as _pb
@ -40,11 +40,11 @@ def get_stock_notetypes(
m = from_json_bytes(col._backend.get_stock_notetype_legacy(kind))
def instance_getter(
col: anki.collection.Collection,
) -> anki.models.NotetypeDict:
return m # pylint:disable=cell-var-from-loop
model: Any,
) -> Callable[[anki.collection.Collection], anki.models.NotetypeDict]:
return lambda col: model
out.append((m["name"], instance_getter))
out.append((m["name"], instance_getter(m)))
# add extras from add-ons
for (name_or_func, func) in models:
if not isinstance(name_or_func, str):