From 6ef24739fcad8dea6c73afd2cd077c428db8f17a Mon Sep 17 00:00:00 2001 From: Arthur Milchior Date: Wed, 19 Mar 2025 02:14:13 +0100 Subject: [PATCH] NF: sligthly optimize cards.py (#3870) As AnkiDroid wants to be similar to Anki, instead of making AnkiDroid slightly less efficient, I prefer to slightly improve Anki. AnkiDroid related PR: https://github.com/ankidroid/Anki-Android/pull/18112. --- pylib/anki/cards.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pylib/anki/cards.py b/pylib/anki/cards.py index 8a822a7f1..dafc29145 100644 --- a/pylib/anki/cards.py +++ b/pylib/anki/cards.py @@ -172,10 +172,11 @@ class Card(DeprecatedNamesMixin): def template(self) -> TemplateDict: notetype = self.note_type() + templates = notetype["tmpls"] if notetype["type"] == MODEL_STD: - return self.note_type()["tmpls"][self.ord] + return templates[self.ord] else: - return self.note_type()["tmpls"][0] + return templates[0] def start_timer(self) -> None: self.timer_started = time.time()