type hints
This commit is contained in:
parent
cc9a36c11a
commit
69a7ee430d
@ -29,7 +29,8 @@ class Card:
|
||||
_qa: Optional[Dict[str, Union[str, int]]]
|
||||
_note: Optional[Note]
|
||||
timerStarted: Optional[float]
|
||||
lastIvl: Optional[int]
|
||||
lastIvl: int
|
||||
ord: int
|
||||
|
||||
def __init__(
|
||||
self, col: anki.collection._Collection, id: Optional[int] = None
|
||||
|
@ -116,7 +116,7 @@ insert or replace into notes values (?,?,?,?,?,?,?,?,?,?,?)""",
|
||||
def joinedFields(self) -> str:
|
||||
return joinFields(self.fields)
|
||||
|
||||
def cards(self) -> List:
|
||||
def cards(self) -> List[anki.cards.Card]:
|
||||
return [
|
||||
self.col.getCard(id)
|
||||
for id in self.col.db.list(
|
||||
|
@ -6,12 +6,12 @@ import random
|
||||
import time
|
||||
from heapq import *
|
||||
from operator import itemgetter
|
||||
from typing import List, Set
|
||||
from typing import List, Optional, Set
|
||||
|
||||
from anki import hooks
|
||||
from anki.cards import Card
|
||||
from anki.consts import *
|
||||
from anki.lang import _
|
||||
|
||||
from anki.utils import fmtTimeSpan, ids2str, intTime
|
||||
|
||||
# queue types: 0=new/cram, 1=lrn, 2=rev, 3=day lrn, -1=suspended, -2=buried
|
||||
@ -37,7 +37,7 @@ class Scheduler:
|
||||
self._haveQueues = False
|
||||
self._updateCutoff()
|
||||
|
||||
def getCard(self):
|
||||
def getCard(self) -> Optional[Card]:
|
||||
"Pop the next card from the queue. None if finished."
|
||||
self._checkDay()
|
||||
if not self._haveQueues:
|
||||
@ -50,6 +50,7 @@ class Scheduler:
|
||||
self.reps += 1
|
||||
card.startTimer()
|
||||
return card
|
||||
return None
|
||||
|
||||
def reset(self):
|
||||
self._updateCutoff()
|
||||
|
Loading…
Reference in New Issue
Block a user