Skip to content

Commit b0f5847

Browse files
committed
Fix typing of FunctionOverride
1 parent 286f366 commit b0f5847

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

manim/animation/animation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
from copy import deepcopy
19-
from typing import TYPE_CHECKING, Callable, Iterable, Sequence
19+
from typing import TYPE_CHECKING, Callable, Iterable, Self, Sequence, cast
2020

2121
if TYPE_CHECKING:
2222
from manim.scene.scene import Scene
@@ -112,7 +112,7 @@ def __new__(
112112
*args,
113113
use_override=True,
114114
**kwargs,
115-
):
115+
) -> Self:
116116
if isinstance(mobject, Mobject) and use_override:
117117
func = mobject.animation_override_for(cls)
118118
if func is not None:
@@ -122,7 +122,7 @@ def __new__(
122122
f"{type(mobject).__name__} mobjects. use_override = False can "
123123
f" be used as keyword argument to prevent animation overriding.",
124124
)
125-
return anim
125+
return cast(Self, anim)
126126
return super().__new__(cls)
127127

128128
def __init__(

manim/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@
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+
FunctionOverride: TypeAlias = Callable
565565
"""Function type returning an :class:`~.Animation` for the specified
566566
:class:`~.Mobject`.
567567
"""

0 commit comments

Comments
 (0)