mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
add a few type hints
This commit is contained in:
parent
3e1b474dca
commit
518cc44267
3 changed files with 9 additions and 3 deletions
|
@ -8,6 +8,7 @@ import operator
|
||||||
import unicodedata
|
import unicodedata
|
||||||
from typing import Any, Dict, List, Optional, Set, Tuple, Union
|
from typing import Any, Dict, List, Optional, Set, Tuple, Union
|
||||||
|
|
||||||
|
import anki # pylint: disable=unused-import
|
||||||
from anki.consts import *
|
from anki.consts import *
|
||||||
from anki.errors import DeckRenameError
|
from anki.errors import DeckRenameError
|
||||||
from anki.hooks import runHook
|
from anki.hooks import runHook
|
||||||
|
@ -98,7 +99,7 @@ class DeckManager:
|
||||||
# Registry save/load
|
# Registry save/load
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
def __init__(self, col) -> None:
|
def __init__(self, col: "anki.storage._Collection") -> None:
|
||||||
self.col = col
|
self.col = col
|
||||||
self.decks = {}
|
self.decks = {}
|
||||||
self.dconf = {}
|
self.dconf = {}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
from typing import Any, List, Optional, Tuple
|
from typing import Any, List, Optional, Tuple
|
||||||
|
|
||||||
|
import anki # pylint: disable=unused-import
|
||||||
from anki.utils import (
|
from anki.utils import (
|
||||||
fieldChecksum,
|
fieldChecksum,
|
||||||
guid64,
|
guid64,
|
||||||
|
@ -19,7 +20,10 @@ class Note:
|
||||||
tags: List[str]
|
tags: List[str]
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, col, model: Optional[Any] = None, id: Optional[int] = None
|
self,
|
||||||
|
col: "anki.storage._Collection",
|
||||||
|
model: Optional[Any] = None,
|
||||||
|
id: Optional[int] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
assert not (model and id)
|
assert not (model and id)
|
||||||
self.col = col
|
self.col = col
|
||||||
|
|
|
@ -14,6 +14,7 @@ import json
|
||||||
import re
|
import re
|
||||||
from typing import Callable, Dict, List, Tuple
|
from typing import Callable, Dict, List, Tuple
|
||||||
|
|
||||||
|
import anki # pylint: disable=unused-import
|
||||||
from anki.hooks import runHook
|
from anki.hooks import runHook
|
||||||
from anki.utils import ids2str, intTime
|
from anki.utils import ids2str, intTime
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ class TagManager:
|
||||||
# Registry save/load
|
# Registry save/load
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
def __init__(self, col) -> None:
|
def __init__(self, col: "anki.storage._Collection") -> None:
|
||||||
self.col = col
|
self.col = col
|
||||||
self.tags: Dict[str, int] = {}
|
self.tags: Dict[str, int] = {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue