Fix type annotation for old stats dialog class

This commit is contained in:
Glutanimate 2020-07-17 03:08:09 +02:00
parent b89811bfba
commit 0fedf5c825
2 changed files with 6 additions and 6 deletions

View File

@ -2345,20 +2345,20 @@ state_will_change = _StateWillChangeHook()
class _StatsDialogOldWillShowHook: class _StatsDialogOldWillShowHook:
"""Allows changing the old stats dialog before it is shown.""" """Allows changing the old stats dialog before it is shown."""
_hooks: List[Callable[["aqt.stats.NewDeckStats"], None]] = [] _hooks: List[Callable[["aqt.stats.DeckStats"], None]] = []
def append(self, cb: Callable[["aqt.stats.NewDeckStats"], None]) -> None: def append(self, cb: Callable[["aqt.stats.DeckStats"], None]) -> None:
"""(dialog: aqt.stats.NewDeckStats)""" """(dialog: aqt.stats.DeckStats)"""
self._hooks.append(cb) self._hooks.append(cb)
def remove(self, cb: Callable[["aqt.stats.NewDeckStats"], None]) -> None: def remove(self, cb: Callable[["aqt.stats.DeckStats"], None]) -> None:
if cb in self._hooks: if cb in self._hooks:
self._hooks.remove(cb) self._hooks.remove(cb)
def count(self) -> int: def count(self) -> int:
return len(self._hooks) return len(self._hooks)
def __call__(self, dialog: aqt.stats.NewDeckStats) -> None: def __call__(self, dialog: aqt.stats.DeckStats) -> None:
for hook in self._hooks: for hook in self._hooks:
try: try:
hook(dialog) hook(dialog)

View File

@ -610,7 +610,7 @@ hooks = [
), ),
Hook( Hook(
name="stats_dialog_old_will_show", name="stats_dialog_old_will_show",
args=["dialog: aqt.stats.NewDeckStats"], args=["dialog: aqt.stats.DeckStats"],
doc="""Allows changing the old stats dialog before it is shown.""", doc="""Allows changing the old stats dialog before it is shown.""",
), ),
# Other # Other