mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00

Earlier today I pushed a change that split this code up into multiple repos, but that has proved to complicate things too much. So we're back to a single repo, except the individual submodules are better separated than they were before. The README files need updating again; I will push them out soon. Aside from splitting out the different modules, the sound code has moved from from anki to aqt.
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
from typing import Any, Dict, List, Tuple, Union
|
|
|
|
# Model attributes are stored in a dict keyed by strings. This type alias
|
|
# provides more descriptive function signatures than just 'Dict[str, Any]'
|
|
# for methods that operate on models.
|
|
# TODO: Use https://www.python.org/dev/peps/pep-0589/ when available in
|
|
# supported Python versions.
|
|
|
|
NoteType = Dict[str, Any]
|
|
|
|
Field = Dict[str, Any]
|
|
|
|
Template = Dict[str, Union[str, int, None]]
|
|
|
|
QAData = Tuple[
|
|
# Card ID this QA comes from. Corresponds to 'cid' column.
|
|
int,
|
|
# Note ID this QA comes from. Corresponds to 'nid' column.
|
|
int,
|
|
# ID of the model (i.e., NoteType) for this QA's note. Corresponds to 'mid' column.
|
|
int,
|
|
# Deck ID. Corresponds to 'did' column.
|
|
int,
|
|
# Index of the card template (within the NoteType) this QA was built
|
|
# from. Corresponds to 'ord' column.
|
|
int,
|
|
# Tags, separated by space. Corresponds to 'tags' column.
|
|
str,
|
|
# Corresponds to 'flds' column. TODO: document.
|
|
str,
|
|
# Corresponds to 'cardFlags' column. TODO: document
|
|
int,
|
|
]
|
|
|
|
TemplateRequirementType = str # Union["all", "any", "none"]
|
|
# template ordinal, type, list of field ordinals
|
|
TemplateRequiredFieldOrds = Tuple[int, TemplateRequirementType, List[int]]
|
|
AllTemplateReqs = List[TemplateRequiredFieldOrds]
|