Source code for tisserande.tracking.annotations

"""Type annotations for marking function arguments with their provenance role.

Usage::

    from tisserande.tracking.annotations import DataFile, Param

    @track
    def process(input_file: DataFile[str], threshold: Param[float]) -> DataFile[str]:
        ...
"""

from typing import Annotated, TypeVar

[docs] T = TypeVar("T")
[docs] DataFile = Annotated[T, "tisserande:data_file"]
[docs] ConfigFile = Annotated[T, "tisserande:config_file"]
[docs] ConfigDict = Annotated[T, "tisserande:config_dict"]
[docs] Param = Annotated[T, "tisserande:parameter"]
[docs] ArrayArg = Annotated[T, "tisserande:array"]
[docs] ObjectArg = Annotated[T, "tisserande:object"]
[docs] Untracked = Annotated[T, "tisserande:untracked"]
[docs] ANNOTATION_MAP: dict[str, str] = { "tisserande:data_file": "data_file", "tisserande:config_file": "config_file", "tisserande:config_dict": "config_dict", "tisserande:parameter": "parameter", "tisserande:array": "array", "tisserande:object": "object", "tisserande:untracked": "untracked", }