Skip to content

Commit 9a84ec6

Browse files
authored
Fix typing of Animation (#3568)
1 parent 4e3cfd2 commit 9a84ec6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

manim/animation/animation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
from copy import deepcopy
1919
from typing import TYPE_CHECKING, Callable, Iterable, Sequence
2020

21+
from typing_extensions import Self
22+
2123
if TYPE_CHECKING:
2224
from manim.scene.scene import Scene
2325

@@ -112,7 +114,7 @@ def __new__(
112114
*args,
113115
use_override=True,
114116
**kwargs,
115-
):
117+
) -> Self:
116118
if isinstance(mobject, Mobject) and use_override:
117119
func = mobject.animation_override_for(cls)
118120
if func is not None:

manim/typing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,9 @@
561561
# Due to current limitations
562562
# (see https://github.com/python/mypy/issues/14656 / 8263),
563563
# we don't specify the first argument type (Mobject).
564-
FunctionOverride: TypeAlias = Callable[..., None]
564+
# Nor are we able to specify the return type (Animation) since we cannot import
565+
# that here.
566+
FunctionOverride: TypeAlias = Callable
565567
"""Function type returning an :class:`~.Animation` for the specified
566568
:class:`~.Mobject`.
567569
"""

0 commit comments

Comments
 (0)