Coverage for src/manimgx/typing.py: 100%
36 statements
« prev ^ index » next coverage.py v7.16.1, created at 2026-10-26 05:52 +0000
« prev ^ index » next coverage.py v7.16.1, created at 2026-10-26 05:52 +0000
1"""Array aliases, by rank: a point is 1-D, an array of points 2-D (numpy types the rank, not the 3)."""
3from collections.abc import Callable, Sequence
4from os import PathLike
5from typing import TYPE_CHECKING
7import numpy as np
8import numpy.typing as npt
10if TYPE_CHECKING:
11 from manimgx.mobjects.text import Typst
13type Float = np.float64
14type Vec = np.ndarray[tuple[int], np.dtype[np.float64]] # 1-D
15type Rows = np.ndarray[tuple[int, int], np.dtype[np.float64]] # 2-D
16type Point3D = Vec
17type Point3D_Array = Rows
18type Vector3D = Vec
19# an input: any array of floats (as CE's docs pass a tracker's `points`), a tuple or a sequence
20type Point3DLike = (
21 npt.NDArray[np.floating] | tuple[float, float, float] | Sequence[float]
22)
23type Vector3DLike = Point3DLike
24type Point3DLike_Array = Point3D_Array | Sequence[Point3DLike]
25type RGBA_Array = Rows
26type MatrixMN = Rows
27type RateFunc = Callable[[float], float]
28type PathFunc = Callable[[Point3D_Array, Point3D_Array, float], Point3D_Array]
29type PointsFunc = Callable[[Point3D_Array], Point3D_Array]
30type Point2D = Vec
31type Point2DLike = Point2D | tuple[float, float] | Sequence[float]
32type Vector2D = Point2D
33type Vector2DLike = Point2DLike
34type Vector3D_Array = Point3D_Array
35type ManimFloat = np.float64
36type ManimTextLabel = Typst # every text class typesets through Typst
37type MappingFunction = Callable[[Point3D], Point3D] # a point to a point (CE)
38type StrPath = str | PathLike[str]
39type Point2D_Array = Point3D_Array
40type Point2DLike_Array = Point3DLike_Array
41type PointND = Point3D
42type PointND_Array = Point3D_Array
43type FloatRGB = Vec
44type FloatRGB_Array = Rows
45type FloatRGBA_Array = RGBA_Array
46type QuadraticSpline = Point3D_Array