From 627f910635893f8205f7004572ba2ac7f3d987b8 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Fri, 26 Nov 2021 03:29:48 +0100 Subject: [PATCH] Remove redundant camelcase aliases (#1509) --- pylib/anki/collection.py | 3 --- pylib/anki/exporting.py | 2 +- pylib/anki/notes.py | 2 +- pylib/anki/scheduler/v2.py | 8 ++++---- pylib/tests/test_importing.py | 2 +- qt/aqt/operations/collection.py | 2 +- qt/aqt/reviewer.py | 2 +- 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/pylib/anki/collection.py b/pylib/anki/collection.py index 7a9f31096..37642cf56 100644 --- a/pylib/anki/collection.py +++ b/pylib/anki/collection.py @@ -344,9 +344,6 @@ class Collection(DeprecatedNamesMixin): Unlike note.flush(), this will invalidate any current checkpoint.""" return self.update_notes([note]) - getCard = get_card - getNote = get_note - # Utils ########################################################################## diff --git a/pylib/anki/exporting.py b/pylib/anki/exporting.py index 4b7ecb0c8..2fbaf207c 100644 --- a/pylib/anki/exporting.py +++ b/pylib/anki/exporting.py @@ -121,7 +121,7 @@ class TextCardExporter(Exporter): out = "" for cid in ids: - c = self.col.getCard(cid) + c = self.col.get_card(cid) out += esc(c.question()) out += "\t" + esc(c.answer()) + "\n" file.write(out.encode("utf-8")) diff --git a/pylib/anki/notes.py b/pylib/anki/notes.py index caffedcae..f2175fcad 100644 --- a/pylib/anki/notes.py +++ b/pylib/anki/notes.py @@ -120,7 +120,7 @@ class Note(DeprecatedNamesMixin): return card def cards(self) -> list[anki.cards.Card]: - return [self.col.getCard(id) for id in self.card_ids()] + return [self.col.get_card(id) for id in self.card_ids()] def card_ids(self) -> Sequence[anki.cards.CardId]: return self.col.card_ids_of_note(self.id) diff --git a/pylib/anki/scheduler/v2.py b/pylib/anki/scheduler/v2.py index 924f235c9..9e94a236f 100644 --- a/pylib/anki/scheduler/v2.py +++ b/pylib/anki/scheduler/v2.py @@ -191,7 +191,7 @@ class Scheduler(SchedulerBaseWithLegacy): def _getNewCard(self) -> Card | None: if self._fillNew(): self.newCount -= 1 - return self.col.getCard(self._newQueue.pop()) + return self.col.get_card(self._newQueue.pop()) return None def _updateNewCardRatio(self) -> None: @@ -342,7 +342,7 @@ limit %d""" cutoff += self.col.conf["collapseTime"] if self._lrnQueue[0][0] < cutoff: id = heappop(self._lrnQueue)[1] - card = self.col.getCard(id) + card = self.col.get_card(id) self.lrnCount -= 1 return card return None @@ -381,7 +381,7 @@ did = ? and queue = {QUEUE_TYPE_DAY_LEARN_RELEARN} and due <= ? limit ?""", def _getLrnDayCard(self) -> Card | None: if self._fillLrnDay(): self.lrnCount -= 1 - return self.col.getCard(self._lrnDayQueue.pop()) + return self.col.get_card(self._lrnDayQueue.pop()) return None # Fetching reviews @@ -442,7 +442,7 @@ limit ?""" def _getRevCard(self) -> Card | None: if self._fillRev(): self.revCount -= 1 - return self.col.getCard(self._revQueue.pop()) + return self.col.get_card(self._revQueue.pop()) return None # Answering a card diff --git a/pylib/tests/test_importing.py b/pylib/tests/test_importing.py index 7cc5a4f6b..3ccce0b62 100644 --- a/pylib/tests/test_importing.py +++ b/pylib/tests/test_importing.py @@ -318,7 +318,7 @@ def test_supermemo_xml_01_unicode(): i.run() assert i.total == 1 cid = col.db.scalar("select id from cards") - c = col.getCard(cid) + c = col.get_card(cid) # Applies A Factor-to-E Factor conversion assert c.factor == 2879 assert c.reps == 7 diff --git a/qt/aqt/operations/collection.py b/qt/aqt/operations/collection.py index 672c4a2fa..2b67f06dd 100644 --- a/qt/aqt/operations/collection.py +++ b/qt/aqt/operations/collection.py @@ -70,7 +70,7 @@ def _legacy_undo(*, parent: QWidget) -> None: if reviewing: # push the undone card to the top of the queue cid = result.card.id - card = mw.col.getCard(cid) + card = mw.col.get_card(cid) mw.reviewer.cardQueue.append(card) gui_hooks.review_did_undo(cid) diff --git a/qt/aqt/reviewer.py b/qt/aqt/reviewer.py index 7caa4c1ea..f48aca257 100644 --- a/qt/aqt/reviewer.py +++ b/qt/aqt/reviewer.py @@ -147,7 +147,7 @@ class Reviewer: if self._answeredIds: if not self.card or self._answeredIds[-1] != self.card.id: try: - return self.mw.col.getCard(self._answeredIds[-1]) + return self.mw.col.get_card(self._answeredIds[-1]) except TypeError: # id was deleted return None