add a few type hints

This commit is contained in:
Damien Elmes 2019-12-25 09:19:57 +10:00
parent 3e1b474dca
commit 518cc44267
3 changed files with 9 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import operator
import unicodedata
from typing import Any, Dict, List, Optional, Set, Tuple, Union
import anki # pylint: disable=unused-import
from anki.consts import *
from anki.errors import DeckRenameError
from anki.hooks import runHook
@ -98,7 +99,7 @@ class DeckManager:
# Registry save/load
#############################################################
def __init__(self, col) -> None:
def __init__(self, col: "anki.storage._Collection") -> None:
self.col = col
self.decks = {}
self.dconf = {}

View File

@ -4,6 +4,7 @@
from typing import Any, List, Optional, Tuple
import anki # pylint: disable=unused-import
from anki.utils import (
fieldChecksum,
guid64,
@ -19,7 +20,10 @@ class Note:
tags: List[str]
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:
assert not (model and id)
self.col = col

View File

@ -14,6 +14,7 @@ import json
import re
from typing import Callable, Dict, List, Tuple
import anki # pylint: disable=unused-import
from anki.hooks import runHook
from anki.utils import ids2str, intTime
@ -23,7 +24,7 @@ class TagManager:
# Registry save/load
#############################################################
def __init__(self, col) -> None:
def __init__(self, col: "anki.storage._Collection") -> None:
self.col = col
self.tags: Dict[str, int] = {}