diff --git a/pylib/anki/cards.py b/pylib/anki/cards.py index 7d5dc80df..efdda28aa 100644 --- a/pylib/anki/cards.py +++ b/pylib/anki/cards.py @@ -1,5 +1,8 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html + +from __future__ import annotations + import pprint import time from typing import Any, Dict, Optional @@ -29,7 +32,7 @@ class Card: lastIvl: Optional[int] def __init__( - self, col: "anki.collection._Collection", id: Optional[int] = None + self, col: anki.collection._Collection, id: Optional[int] = None ) -> None: self.col = col self.timerStarted = None diff --git a/pylib/anki/decks.py b/pylib/anki/decks.py index 8ab41eb61..59e911af2 100644 --- a/pylib/anki/decks.py +++ b/pylib/anki/decks.py @@ -1,6 +1,8 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +from __future__ import annotations + import copy import json import operator @@ -98,7 +100,7 @@ class DeckManager: # Registry save/load ############################################################# - def __init__(self, col: "anki.storage._Collection") -> None: + def __init__(self, col: anki.storage._Collection) -> None: self.col = col self.decks = {} self.dconf = {} diff --git a/pylib/anki/models.py b/pylib/anki/models.py index 9674e1131..15883cbaa 100644 --- a/pylib/anki/models.py +++ b/pylib/anki/models.py @@ -1,6 +1,8 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +from __future__ import annotations + import copy import json import re @@ -80,7 +82,7 @@ class ModelManager: # Saving/loading registry ############################################################# - def __init__(self, col: "anki.storage._Collection") -> None: + def __init__(self, col: anki.storage._Collection) -> None: self.col = col self.models = {} self.changed = False diff --git a/pylib/anki/notes.py b/pylib/anki/notes.py index 26596dd26..514b5888c 100644 --- a/pylib/anki/notes.py +++ b/pylib/anki/notes.py @@ -1,6 +1,8 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +from __future__ import annotations + from typing import Any, Dict, List, Optional, Tuple import anki # pylint: disable=unused-import @@ -17,7 +19,7 @@ from anki.utils import ( class Note: - col: "anki.storage._Collection" + col: anki.storage._Collection newlyAdded: bool id: int guid: str @@ -32,7 +34,7 @@ class Note: def __init__( self, - col: "anki.storage._Collection", + col: anki.storage._Collection, model: Optional[NoteType] = None, id: Optional[int] = None, ) -> None: diff --git a/pylib/anki/pybackend.py b/pylib/anki/pybackend.py index f3a2f6a8b..5e27e7447 100644 --- a/pylib/anki/pybackend.py +++ b/pylib/anki/pybackend.py @@ -7,6 +7,8 @@ A Python implementation of some backend commands. Unimplemented commands will be forwarded on to the Rust backend. """ +from __future__ import annotations + from typing import Any, Dict, Tuple import anki # pylint: disable=unused-import @@ -14,7 +16,7 @@ import anki.backend_pb2 as pb class PythonBackend: - def __init__(self, col: "anki.storage._Collection"): + def __init__(self, col: anki.storage._Collection): self.col = col def run_command_bytes(self, input: bytes) -> bytes: diff --git a/pylib/anki/schedv2.py b/pylib/anki/schedv2.py index a201e83be..506f363d1 100644 --- a/pylib/anki/schedv2.py +++ b/pylib/anki/schedv2.py @@ -1,6 +1,8 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +from __future__ import annotations + import datetime import itertools import random @@ -38,7 +40,7 @@ class Scheduler: _burySiblingsOnAnswer = True revCount: int - def __init__(self, col: "anki.storage._Collection") -> None: + def __init__(self, col: anki.storage._Collection) -> None: self.col = col self.queueLimit = 50 self.reportLimit = 1000 diff --git a/pylib/anki/sync.py b/pylib/anki/sync.py index b462dbe6b..10e6de04d 100644 --- a/pylib/anki/sync.py +++ b/pylib/anki/sync.py @@ -1,6 +1,8 @@ # Copyright: Ankitects Pty Ltd and contributors # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html +from __future__ import annotations + import gzip import io import json @@ -35,7 +37,7 @@ class UnexpectedSchemaChange(Exception): class Syncer: cursor: Optional[sqlite3.Cursor] - def __init__(self, col: "anki.storage._Collection", server=None) -> None: + def __init__(self, col: anki.storage._Collection, server=None) -> None: self.col = col self.server = server diff --git a/pylib/anki/tags.py b/pylib/anki/tags.py index da353ac98..ff36aeaac 100644 --- a/pylib/anki/tags.py +++ b/pylib/anki/tags.py @@ -9,6 +9,8 @@ tracked, so unused tags can only be removed from the list with a DB check. This module manages the tag cache and tags for notes. """ +from __future__ import annotations + import json import re from typing import Callable, Dict, List, Tuple @@ -23,7 +25,7 @@ class TagManager: # Registry save/load ############################################################# - def __init__(self, col: "anki.storage._Collection") -> None: + def __init__(self, col: anki.storage._Collection) -> None: self.col = col self.tags: Dict[str, int] = {}