mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
use 3.7 annotations
This commit is contained in:
parent
8b94d69abc
commit
e7ea121196
8 changed files with 26 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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] = {}
|
||||
|
||||
|
|
Loading…
Reference in a new issue