Skip to content

Commit

Permalink
Fix typehint of :meth:.Scene.play to allow .animate (#4038)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGrace2282 authored Dec 7, 2024
1 parent 953888e commit 6abcc61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 2 additions & 4 deletions manim/renderer/cairo_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@

from .. import config, logger
from ..camera.camera import Camera
from ..mobject.mobject import Mobject
from ..mobject.mobject import Mobject, _AnimationBuilder
from ..scene.scene_file_writer import SceneFileWriter
from ..utils.exceptions import EndSceneEarlyException
from ..utils.iterables import list_update

if typing.TYPE_CHECKING:
import types
from collections.abc import Iterable
from typing import Any

from manim.animation.animation import Animation
Expand Down Expand Up @@ -60,7 +58,7 @@ def init_scene(self, scene):
def play(
self,
scene: Scene,
*args: Animation | Iterable[Animation] | types.GeneratorType[Animation],
*args: Animation | Mobject | _AnimationBuilder,
**kwargs,
):
# Reset skip_animations to the original state.
Expand Down
10 changes: 6 additions & 4 deletions manim/scene/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@
from ..utils.iterables import list_difference_update, list_update

if TYPE_CHECKING:
from collections.abc import Iterable, Sequence
from collections.abc import Sequence
from typing import Callable

from manim.mobject.mobject import _AnimationBuilder


class RerunSceneHandler(FileSystemEventHandler):
"""A class to handle rerunning a Scene after the input file is modified."""
Expand Down Expand Up @@ -878,7 +880,7 @@ def get_moving_and_static_mobjects(self, animations):

def compile_animations(
self,
*args: Animation | Iterable[Animation] | types.GeneratorType[Animation],
*args: Animation | Mobject | _AnimationBuilder,
**kwargs,
):
"""
Expand Down Expand Up @@ -1070,7 +1072,7 @@ def get_run_time(self, animations: list[Animation]):

def play(
self,
*args: Animation | Iterable[Animation] | types.GeneratorType[Animation],
*args: Animation | Mobject | _AnimationBuilder,
subcaption=None,
subcaption_duration=None,
subcaption_offset=0,
Expand Down Expand Up @@ -1205,7 +1207,7 @@ def wait_until(self, stop_condition: Callable[[], bool], max_time: float = 60):

def compile_animation_data(
self,
*animations: Animation | Iterable[Animation] | types.GeneratorType[Animation],
*animations: Animation | Mobject | _AnimationBuilder,
**play_kwargs,
):
"""Given a list of animations, compile the corresponding
Expand Down

0 comments on commit 6abcc61

Please sign in to comment.