Skip to content

Commit 7a77ee6

Browse files
committed
Replace string annotation with new typehints
1 parent 4ed29a8 commit 7a77ee6

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

manim/animation/animation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def __init__(
147147
self.introducer: bool = introducer
148148
self.suspend_mobject_updating: bool = suspend_mobject_updating
149149
self.lag_ratio: float = lag_ratio
150-
self._on_finish: Callable[["Scene"], None] = _on_finish
150+
self._on_finish: Callable[[Scene], None] = _on_finish
151151
if config["renderer"] == "opengl":
152152
self.starting_mobject: OpenGLMobject = OpenGLMobject()
153153
self.mobject: OpenGLMobject = (
@@ -228,7 +228,7 @@ def clean_up_from_scene(self, scene: Scene) -> None:
228228
if self.is_remover():
229229
scene.remove(self.mobject)
230230

231-
def _setup_scene(self, scene: "Scene") -> None:
231+
def _setup_scene(self, scene: Scene) -> None:
232232
"""Setup up the :class:`~.Scene` before starting the animation.
233233
234234
This includes to :meth:`~.Scene.add` the Animation's

manim/mobject/graph.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -502,13 +502,13 @@ def __repr__(self: Graph) -> str:
502502
def _create_vertex(
503503
self,
504504
vertex: Hashable,
505-
position: Optional[np.ndarray] = None,
505+
position: np.ndarray | None = None,
506506
label: bool = False,
507507
label_fill_color: str = BLACK,
508-
vertex_type: Type["Mobject"] = Dot,
509-
vertex_config: Optional[dict] = None,
510-
vertex_mobject: Optional[dict] = None,
511-
) -> Tuple[Hashable, np.ndarray, dict, "Mobject"]:
508+
vertex_type: type[Mobject] = Dot,
509+
vertex_config: dict | None = None,
510+
vertex_mobject: dict | None = None,
511+
) -> tuple[Hashable, np.ndarray, dict, Mobject]:
512512
if position is None:
513513
position = self.get_center()
514514

@@ -550,8 +550,8 @@ def _add_created_vertex(
550550
vertex: Hashable,
551551
position: np.ndarray,
552552
vertex_config: dict,
553-
vertex_mobject: "Mobject",
554-
) -> "Mobject":
553+
vertex_mobject: Mobject,
554+
) -> Mobject:
555555
if vertex in self.vertices:
556556
raise ValueError(
557557
f"Vertex identifier '{vertex}' is already used for a vertex in this graph.",
@@ -621,15 +621,15 @@ def _add_vertex(
621621
)
622622

623623
def _create_vertices(
624-
self: "Graph",
624+
self: Graph,
625625
*vertices: Hashable,
626-
positions: Optional[dict] = None,
626+
positions: dict | None = None,
627627
labels: bool = False,
628628
label_fill_color: str = BLACK,
629-
vertex_type: Type["Mobject"] = Dot,
630-
vertex_config: Optional[dict] = None,
631-
vertex_mobjects: Optional[dict] = None,
632-
) -> Iterable[Tuple[Hashable, np.ndarray, dict, "Mobject"]]:
629+
vertex_type: type[Mobject] = Dot,
630+
vertex_config: dict | None = None,
631+
vertex_mobjects: dict | None = None,
632+
) -> Iterable[tuple[Hashable, np.ndarray, dict, Mobject]]:
633633
if positions is None:
634634
positions = {}
635635
if vertex_mobjects is None:
@@ -734,7 +734,7 @@ def _add_vertices_animation(self, *args, anim_args=None, **kwargs):
734734

735735
vertex_mobjects = self._create_vertices(*args, **kwargs)
736736

737-
def on_finish(scene: "Scene"):
737+
def on_finish(scene: Scene):
738738
for v in vertex_mobjects:
739739
scene.remove(v[-1])
740740
self._add_created_vertex(*v)

0 commit comments

Comments
 (0)