A community-maintained Python framework for creating mathematical animations.
Cleanup `TipableVMobject`: avoid mutable default and fix `assign_tip_attr` typo (#4503)
Josie Thompsona6af7f3d7659
diff --git a/manim/mobject/geometry/arc.py b/manim/mobject/geometry/arc.pyindex d78a3622b..32b1133a6 100644--- a/manim/mobject/geometry/arc.py+++ b/manim/mobject/geometry/arc.py@@ -101,12 +101,12 @@ class TipableVMobject(VMobject, metaclass=ConvertToOpenGL):self,tip_length: float = DEFAULT_ARROW_TIP_LENGTH,normal_vector: Vector3DLike = OUT,- tip_style: dict = {},+ tip_style: dict | None = None,**kwargs: Any,) -> None:self.tip_length: float = tip_lengthself.normal_vector = normal_vector- self.tip_style: dict = tip_style+ self.tip_style: dict = tip_style if tip_style is not None else {}super().__init__(**kwargs)# Adding, Creating, Modifying tips@@ -128,7 +128,7 @@ class TipableVMobject(VMobject, metaclass=ConvertToOpenGL):else:self.position_tip(tip, at_start)self.reset_endpoints_based_on_tip(tip, at_start)- self.asign_tip_attr(tip, at_start)+ self.assign_tip_attr(tip, at_start)self.add(tip)return self@@ -201,6 +201,7 @@ class TipableVMobject(VMobject, metaclass=ConvertToOpenGL):axis=axis,) # Rotates the tip along the vertical wrt the axisself._init_positioning_axis = axis+tip.shift(anchor - tip.tip_point)return tip@@ -215,7 +216,7 @@ class TipableVMobject(VMobject, metaclass=ConvertToOpenGL):self.put_start_and_end_on(self.get_start(), tip.base)return self- def asign_tip_attr(self, tip: tips.ArrowTip, at_start: bool) -> Self:+ def assign_tip_attr(self, tip: tips.ArrowTip, at_start: bool) -> Self:if at_start:self.start_tip = tipelse:diff --git a/manim/mobject/opengl/opengl_geometry.py b/manim/mobject/opengl/opengl_geometry.pyindex 24c035fea..6b09a82e2 100644--- a/manim/mobject/opengl/opengl_geometry.py+++ b/manim/mobject/opengl/opengl_geometry.py@@ -107,7 +107,7 @@ class OpenGLTipableVMobject(OpenGLVMobject):"""tip = self.create_tip(at_start, **kwargs)self.reset_endpoints_based_on_tip(tip, at_start)- self.asign_tip_attr(tip, at_start)+ self.assign_tip_attr(tip, at_start)self.add(tip)return self@@ -160,7 +160,7 @@ class OpenGLTipableVMobject(OpenGLVMobject):self.put_start_and_end_on(start, end)return self- def asign_tip_attr(self, tip: OpenGLArrowTip, at_start: bool) -> Self:+ def assign_tip_attr(self, tip: OpenGLArrowTip, at_start: bool) -> Self:if at_start:self.start_tip = tipelse: