Skip to content

Commit 011c36a

Browse files
authored
Revert vector type aliases to NumPy ndarrays (#3595)
1 parent ed1b203 commit 011c36a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

manim/typing.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from __future__ import annotations
2222

2323
from os import PathLike
24-
from typing import Callable, Literal, Union
24+
from typing import Callable, Union
2525

2626
import numpy as np
2727
import numpy.typing as npt
@@ -319,7 +319,7 @@
319319
Vector types
320320
"""
321321

322-
Vector2D: TypeAlias = Point2D
322+
Vector2D: TypeAlias = npt.NDArray[PointDType]
323323
"""``shape: (2,)``
324324
325325
A 2-dimensional vector: ``[float, float]``.
@@ -332,7 +332,7 @@
332332
VMobjects!
333333
"""
334334

335-
Vector2D_Array: TypeAlias = Point2D_Array
335+
Vector2D_Array: TypeAlias = npt.NDArray[PointDType]
336336
"""``shape: (M, 2)``
337337
338338
An array of `Vector2D` objects: ``[[float, float], ...]``.
@@ -341,7 +341,7 @@
341341
parameter can handle being passed a `Vector3D_Array` instead.
342342
"""
343343

344-
Vector3D: TypeAlias = Point3D
344+
Vector3D: TypeAlias = npt.NDArray[PointDType]
345345
"""``shape: (3,)``
346346
347347
A 3-dimensional vector: ``[float, float, float]``.
@@ -351,13 +351,13 @@
351351
VMobjects!
352352
"""
353353

354-
Vector3D_Array: TypeAlias = Point3D_Array
354+
Vector3D_Array: TypeAlias = npt.NDArray[PointDType]
355355
"""``shape: (M, 3)``
356356
357357
An array of `Vector3D` objects: ``[[float, float, float], ...]``.
358358
"""
359359

360-
VectorND: TypeAlias = Union[npt.NDArray[PointDType], tuple[float, ...]]
360+
VectorND: TypeAlias = npt.NDArray[PointDType]
361361
"""``shape (N,)``
362362
363363
An :math:`N`-dimensional vector: ``[float, ...]``.
@@ -368,19 +368,19 @@
368368
collisions.
369369
"""
370370

371-
VectorND_Array: TypeAlias = Union[npt.NDArray[PointDType], tuple[VectorND, ...]]
371+
VectorND_Array: TypeAlias = npt.NDArray[PointDType]
372372
"""``shape (M, N)``
373373
374374
An array of `VectorND` objects: ``[[float, ...], ...]``.
375375
"""
376376

377-
RowVector: TypeAlias = Union[npt.NDArray[PointDType], tuple[tuple[float, ...]]]
377+
RowVector: TypeAlias = npt.NDArray[PointDType]
378378
"""``shape: (1, N)``
379379
380380
A row vector: ``[[float, ...]]``.
381381
"""
382382

383-
ColVector: TypeAlias = Union[npt.NDArray[PointDType], tuple[tuple[float], ...]]
383+
ColVector: TypeAlias = npt.NDArray[PointDType]
384384
"""``shape: (N, 1)``
385385
386386
A column vector: ``[[float], [float], ...]``.
@@ -392,13 +392,13 @@
392392
Matrix types
393393
"""
394394

395-
MatrixMN: TypeAlias = Union[npt.NDArray[PointDType], tuple[tuple[float, ...], ...]]
395+
MatrixMN: TypeAlias = npt.NDArray[PointDType]
396396
"""``shape: (M, N)``
397397
398398
A matrix: ``[[float, ...], [float, ...], ...]``.
399399
"""
400400

401-
Zeros: TypeAlias = Union[npt.NDArray[PointDType], tuple[tuple[Literal[0], ...], ...]]
401+
Zeros: TypeAlias = MatrixMN
402402
"""``shape: (M, N)``
403403
404404
A `MatrixMN` filled with zeros, typically created with

0 commit comments

Comments
 (0)