Improve typing deck_due_tree() (#3003)

* Improve typing `deck_due_tree()`

* Add me to CONTRIBUTORS
This commit is contained in:
Han Yeong-woo 2024-02-12 14:56:29 +09:00 committed by GitHub
parent f4a8f7d9c7
commit 9ba527afa2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View file

@ -160,6 +160,7 @@ Pedro Lameiras <pedrolameiras@tecnico.ulisboa.pt>
Kai Knoblich <kai@FreeBSD.org> Kai Knoblich <kai@FreeBSD.org>
Lucas Scharenbroch <lucasscharenbroch@gmail.com> Lucas Scharenbroch <lucasscharenbroch@gmail.com>
Antonio Cavallo <a.cavallo@cavallinux.eu> Antonio Cavallo <a.cavallo@cavallinux.eu>
Han Yeong-woo <han@yeongwoo.dev>
******************** ********************

View file

@ -22,7 +22,7 @@ ScheduleCardsAsNewDefaults = scheduler_pb2.ScheduleCardsAsNewDefaultsResponse
FilteredDeckForUpdate = decks_pb2.FilteredDeckForUpdate FilteredDeckForUpdate = decks_pb2.FilteredDeckForUpdate
RepositionDefaults = scheduler_pb2.RepositionDefaultsResponse RepositionDefaults = scheduler_pb2.RepositionDefaultsResponse
from typing import Sequence from typing import Sequence, overload
from anki import config_pb2 from anki import config_pb2
from anki.cards import CardId from anki.cards import CardId
@ -65,6 +65,14 @@ class SchedulerBase(DeprecatedNamesMixin):
# Deck list # Deck list
########################################################################## ##########################################################################
@overload
def deck_due_tree(self, top_deck_id: None = None) -> DeckTreeNode:
...
@overload
def deck_due_tree(self, top_deck_id: DeckId) -> DeckTreeNode | None:
...
def deck_due_tree(self, top_deck_id: DeckId | None = None) -> DeckTreeNode | None: def deck_due_tree(self, top_deck_id: DeckId | None = None) -> DeckTreeNode | None:
"""Returns a tree of decks with counts. """Returns a tree of decks with counts.
If top_deck_id provided, only the according subtree is returned.""" If top_deck_id provided, only the according subtree is returned."""