|
16 | 16 | import warnings |
17 | 17 | from functools import partialmethod, reduce |
18 | 18 | from pathlib import Path |
19 | | -from typing import TYPE_CHECKING, Callable, Iterable, Literal, TypeVar, Union |
| 19 | +from typing import TYPE_CHECKING, Callable, Iterable, Literal |
20 | 20 |
|
21 | 21 | import numpy as np |
22 | | -from typing_extensions import Self, TypeAlias |
23 | 22 |
|
24 | 23 | from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL |
25 | 24 |
|
|
39 | 38 | from ..utils.paths import straight_path |
40 | 39 | from ..utils.space_ops import angle_between_vectors, normalize, rotation_matrix |
41 | 40 |
|
42 | | -# TODO: Explain array_attrs |
43 | | - |
44 | | -TimeBasedUpdater: TypeAlias = Callable[["Mobject", float], None] |
45 | | -NonTimeBasedUpdater: TypeAlias = Callable[["Mobject"], None] |
46 | | -Updater: TypeAlias = Union[NonTimeBasedUpdater, TimeBasedUpdater] |
47 | | -T = TypeVar("T", bound="Mobject") |
48 | | - |
49 | 41 | if TYPE_CHECKING: |
| 42 | + from typing_extensions import Self, TypeAlias |
| 43 | + |
50 | 44 | from manim.typing import ( |
51 | 45 | FunctionOverride, |
52 | 46 | Image, |
|
61 | 55 |
|
62 | 56 | from ..animation.animation import Animation |
63 | 57 |
|
| 58 | + TimeBasedUpdater: TypeAlias = Callable[["Mobject", float], object] |
| 59 | + NonTimeBasedUpdater: TypeAlias = Callable[["Mobject"], object] |
| 60 | + Updater: TypeAlias = NonTimeBasedUpdater | TimeBasedUpdater |
| 61 | + |
64 | 62 |
|
65 | 63 | class Mobject: |
66 | 64 | """Mathematical Object: base class for objects that can be displayed on screen. |
@@ -237,7 +235,7 @@ def construct(self): |
237 | 235 | cls.__init__ = cls._original__init__ |
238 | 236 |
|
239 | 237 | @property |
240 | | - def animate(self: T) -> _AnimationBuilder | T: |
| 238 | + def animate(self) -> _AnimationBuilder | Self: |
241 | 239 | """Used to animate the application of any method of :code:`self`. |
242 | 240 |
|
243 | 241 | Any method called on :code:`animate` is converted to an animation of applying |
@@ -2926,7 +2924,7 @@ def set_z_index( |
2926 | 2924 | self, |
2927 | 2925 | z_index_value: float, |
2928 | 2926 | family: bool = True, |
2929 | | - ) -> T: |
| 2927 | + ) -> Self: |
2930 | 2928 | """Sets the :class:`~.Mobject`'s :attr:`z_index` to the value specified in `z_index_value`. |
2931 | 2929 |
|
2932 | 2930 | Parameters |
|
0 commit comments