Skip to content

Commit

Permalink
Replace string annotation with new typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-serwin committed Jan 20, 2022
1 parent 4ed29a8 commit 7a77ee6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions manim/animation/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def __init__(
self.introducer: bool = introducer
self.suspend_mobject_updating: bool = suspend_mobject_updating
self.lag_ratio: float = lag_ratio
self._on_finish: Callable[["Scene"], None] = _on_finish
self._on_finish: Callable[[Scene], None] = _on_finish
if config["renderer"] == "opengl":
self.starting_mobject: OpenGLMobject = OpenGLMobject()
self.mobject: OpenGLMobject = (
Expand Down Expand Up @@ -228,7 +228,7 @@ def clean_up_from_scene(self, scene: Scene) -> None:
if self.is_remover():
scene.remove(self.mobject)

def _setup_scene(self, scene: "Scene") -> None:
def _setup_scene(self, scene: Scene) -> None:
"""Setup up the :class:`~.Scene` before starting the animation.
This includes to :meth:`~.Scene.add` the Animation's
Expand Down
28 changes: 14 additions & 14 deletions manim/mobject/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,13 +502,13 @@ def __repr__(self: Graph) -> str:
def _create_vertex(
self,
vertex: Hashable,
position: Optional[np.ndarray] = None,
position: np.ndarray | None = None,
label: bool = False,
label_fill_color: str = BLACK,
vertex_type: Type["Mobject"] = Dot,
vertex_config: Optional[dict] = None,
vertex_mobject: Optional[dict] = None,
) -> Tuple[Hashable, np.ndarray, dict, "Mobject"]:
vertex_type: type[Mobject] = Dot,
vertex_config: dict | None = None,
vertex_mobject: dict | None = None,
) -> tuple[Hashable, np.ndarray, dict, Mobject]:
if position is None:
position = self.get_center()

Expand Down Expand Up @@ -550,8 +550,8 @@ def _add_created_vertex(
vertex: Hashable,
position: np.ndarray,
vertex_config: dict,
vertex_mobject: "Mobject",
) -> "Mobject":
vertex_mobject: Mobject,
) -> Mobject:
if vertex in self.vertices:
raise ValueError(
f"Vertex identifier '{vertex}' is already used for a vertex in this graph.",
Expand Down Expand Up @@ -621,15 +621,15 @@ def _add_vertex(
)

def _create_vertices(
self: "Graph",
self: Graph,
*vertices: Hashable,
positions: Optional[dict] = None,
positions: dict | None = None,
labels: bool = False,
label_fill_color: str = BLACK,
vertex_type: Type["Mobject"] = Dot,
vertex_config: Optional[dict] = None,
vertex_mobjects: Optional[dict] = None,
) -> Iterable[Tuple[Hashable, np.ndarray, dict, "Mobject"]]:
vertex_type: type[Mobject] = Dot,
vertex_config: dict | None = None,
vertex_mobjects: dict | None = None,
) -> Iterable[tuple[Hashable, np.ndarray, dict, Mobject]]:
if positions is None:
positions = {}
if vertex_mobjects is None:
Expand Down Expand Up @@ -734,7 +734,7 @@ def _add_vertices_animation(self, *args, anim_args=None, **kwargs):

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

def on_finish(scene: "Scene"):
def on_finish(scene: Scene):
for v in vertex_mobjects:
scene.remove(v[-1])
self._add_created_vertex(*v)
Expand Down

0 comments on commit 7a77ee6

Please sign in to comment.