Remove redundant camelcase aliases (#1509)

This commit is contained in:
RumovZ 2021-11-26 03:29:48 +01:00 committed by GitHub
parent b9eccec2b0
commit 627f910635
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 12 deletions

View file

@ -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
##########################################################################

View file

@ -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"))

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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