diff --git a/manimlib/animation/animation.py b/manimlib/animation/animation.py index 115e9839..95166a15 100644 --- a/manimlib/animation/animation.py +++ b/manimlib/animation/animation.py @@ -49,7 +49,7 @@ class Animation(object): self.lag_ratio = lag_ratio self.suspend_mobject_updating = suspend_mobject_updating - assert(isinstance(mobject, Mobject)) + assert isinstance(mobject, Mobject) def __str__(self) -> str: return self.name diff --git a/manimlib/animation/composition.py b/manimlib/animation/composition.py index a0a7255c..4d24f696 100644 --- a/manimlib/animation/composition.py +++ b/manimlib/animation/composition.py @@ -133,7 +133,7 @@ class Succession(AnimationGroup): super().__init__(*animations, lag_ratio=lag_ratio, **kwargs) def begin(self) -> None: - assert(len(self.animations) > 0) + assert len(self.animations) > 0 self.active_animation = self.animations[0] self.active_animation.begin() diff --git a/manimlib/animation/creation.py b/manimlib/animation/creation.py index d82b8a06..4342f837 100644 --- a/manimlib/animation/creation.py +++ b/manimlib/animation/creation.py @@ -84,7 +84,7 @@ class DrawBorderThenFill(Animation): fill_animation_config: dict = {}, **kwargs ): - assert(isinstance(vmobject, VMobject)) + assert isinstance(vmobject, VMobject) self.sm_to_index = {hash(sm): 0 for sm in vmobject.get_family()} self.stroke_width = stroke_width self.stroke_color = stroke_color diff --git a/manimlib/animation/numbers.py b/manimlib/animation/numbers.py index c516b2e9..4a192b6a 100644 --- a/manimlib/animation/numbers.py +++ b/manimlib/animation/numbers.py @@ -19,7 +19,7 @@ class ChangingDecimal(Animation): suspend_mobject_updating: bool = False, **kwargs ): - assert(isinstance(decimal_mob, DecimalNumber)) + assert isinstance(decimal_mob, DecimalNumber) self.number_update_func = number_update_func super().__init__( decimal_mob, diff --git a/manimlib/animation/transform.py b/manimlib/animation/transform.py index 8b76a304..363445ea 100644 --- a/manimlib/animation/transform.py +++ b/manimlib/animation/transform.py @@ -179,7 +179,7 @@ class ApplyMethod(Transform): "Whoops, looks like you accidentally invoked " "the method you want to animate" ) - assert(isinstance(method.__self__, Mobject)) + assert isinstance(method.__self__, Mobject) def create_target(self) -> Mobject: method = self.method diff --git a/manimlib/camera/camera.py b/manimlib/camera/camera.py index d4a1e14e..4ac5d0f8 100644 --- a/manimlib/camera/camera.py +++ b/manimlib/camera/camera.py @@ -99,7 +99,7 @@ class Camera(object): self.light_source = Point(self.light_source_position) def use_window_fbo(self, use: bool = True): - assert(self.window is not None) + assert self.window is not None if use: self.fbo = self.window_fbo else: diff --git a/manimlib/event_handler/event_dispatcher.py b/manimlib/event_handler/event_dispatcher.py index c2c19a38..31471d6c 100644 --- a/manimlib/event_handler/event_dispatcher.py +++ b/manimlib/event_handler/event_dispatcher.py @@ -20,12 +20,12 @@ class EventDispatcher(object): self.draggable_object_listners: list[EventListener] = [] def add_listner(self, event_listner: EventListener): - assert(isinstance(event_listner, EventListener)) + assert isinstance(event_listner, EventListener) self.event_listners[event_listner.event_type].append(event_listner) return self def remove_listner(self, event_listner: EventListener): - assert(isinstance(event_listner, EventListener)) + assert isinstance(event_listner, EventListener) try: while event_listner in self.event_listners[event_listner.event_type]: self.event_listners[event_listner.event_type].remove(event_listner) @@ -56,7 +56,7 @@ class EventDispatcher(object): if event_type == EventType.MouseDragEvent: for listner in self.draggable_object_listners: - assert(isinstance(listner, EventListener)) + assert isinstance(listner, EventListener) propagate_event = listner.callback(listner.mobject, event_data) if propagate_event is not None and propagate_event is False: return propagate_event diff --git a/manimlib/mobject/interactive.py b/manimlib/mobject/interactive.py index 394f7f31..50bc87c5 100644 --- a/manimlib/mobject/interactive.py +++ b/manimlib/mobject/interactive.py @@ -37,7 +37,7 @@ class MotionMobject(Mobject): """ def __init__(self, mobject: Mobject, **kwargs): super().__init__(**kwargs) - assert(isinstance(mobject, Mobject)) + assert isinstance(mobject, Mobject) self.mobject = mobject self.mobject.add_mouse_drag_listner(self.mob_on_mouse_drag) # To avoid locking it as static mobject @@ -58,7 +58,7 @@ class Button(Mobject): def __init__(self, mobject: Mobject, on_click: Callable[[Mobject]], **kwargs): super().__init__(**kwargs) - assert(isinstance(mobject, Mobject)) + assert isinstance(mobject, Mobject) self.on_click = on_click self.mobject = mobject self.mobject.add_mouse_press_listner(self.mob_on_mouse_press) @@ -119,7 +119,7 @@ class EnableDisableButton(ControlMobject): self.add_mouse_press_listner(self.on_mouse_press) def assert_value(self, value: bool) -> None: - assert(isinstance(value, bool)) + assert isinstance(value, bool) def set_value_anim(self, value: bool) -> None: if value: @@ -168,7 +168,7 @@ class Checkbox(ControlMobject): self.add_mouse_press_listner(self.on_mouse_press) def assert_value(self, value: bool) -> None: - assert(isinstance(value, bool)) + assert isinstance(value, bool) def toggle_value(self) -> None: super().set_value(not self.get_value()) @@ -252,7 +252,7 @@ class LinearNumberSlider(ControlMobject): super().__init__(value, self.bar, self.slider, self.slider_axis, **kwargs) def assert_value(self, value: float) -> None: - assert(self.min_value <= value <= self.max_value) + assert self.min_value <= value <= self.max_value def set_value_anim(self, value: float) -> None: prop = (value - self.min_value) / (self.max_value - self.min_value) @@ -351,7 +351,7 @@ class ColorSliders(Group): grid.move_to(self.selected_color_box) for idx, square in enumerate(grid): - assert(isinstance(square, Square)) + assert isinstance(square, Square) square.set_stroke(width=0.0, opacity=0.0) square.set_fill(colors[idx % len(colors)], 1.0) diff --git a/manimlib/mobject/mobject.py b/manimlib/mobject/mobject.py index fc706c2d..3e2ca303 100644 --- a/manimlib/mobject/mobject.py +++ b/manimlib/mobject/mobject.py @@ -125,11 +125,11 @@ class Mobject(object): return self.__class__.__name__ def __add__(self, other: Mobject) -> Mobject: - assert(isinstance(other, Mobject)) + assert isinstance(other, Mobject) return self.get_group_class()(self, other) def __mul__(self, other: int) -> Mobject: - assert(isinstance(other, int)) + assert isinstance(other, int) return self.replicate(other) def init_data(self, length: int = 0): @@ -228,7 +228,7 @@ class Mobject(object): # Only these methods should directly affect points @affects_data def set_data(self, data: np.ndarray) -> Self: - assert(data.dtype == self.data.dtype) + assert data.dtype == self.data.dtype self.resize_points(len(data)) self.data[:] = data return self diff --git a/manimlib/mobject/mobject_update_utils.py b/manimlib/mobject/mobject_update_utils.py index d47270ff..ff4af379 100644 --- a/manimlib/mobject/mobject_update_utils.py +++ b/manimlib/mobject/mobject_update_utils.py @@ -18,9 +18,9 @@ if TYPE_CHECKING: def assert_is_mobject_method(method): - assert(inspect.ismethod(method)) + assert inspect.ismethod(method) mobject = method.__self__ - assert(isinstance(mobject, Mobject)) + assert isinstance(mobject, Mobject) def always(method, *args, **kwargs): diff --git a/manimlib/mobject/probability.py b/manimlib/mobject/probability.py index 44a3fbf5..83cad718 100644 --- a/manimlib/mobject/probability.py +++ b/manimlib/mobject/probability.py @@ -153,7 +153,7 @@ class SampleSpace(Rectangle): direction: np.ndarray = LEFT, **kwargs ) -> VGroup: - assert(hasattr(self, "horizontal_parts")) + assert hasattr(self, "horizontal_parts") parts = self.horizontal_parts return self.get_subdivision_braces_and_labels(parts, labels, direction, **kwargs) @@ -162,7 +162,7 @@ class SampleSpace(Rectangle): labels: str, **kwargs ) -> VGroup: - assert(hasattr(self, "vertical_parts")) + assert hasattr(self, "vertical_parts") parts = self.vertical_parts return self.get_subdivision_braces_and_labels(parts, labels, UP, **kwargs) @@ -171,7 +171,7 @@ class SampleSpace(Rectangle): labels: str, **kwargs ) -> VGroup: - assert(hasattr(self, "vertical_parts")) + assert hasattr(self, "vertical_parts") parts = self.vertical_parts return self.get_subdivision_braces_and_labels(parts, labels, DOWN, **kwargs) diff --git a/manimlib/mobject/types/surface.py b/manimlib/mobject/types/surface.py index ee983c59..c458a0e9 100644 --- a/manimlib/mobject/types/surface.py +++ b/manimlib/mobject/types/surface.py @@ -167,7 +167,7 @@ class Surface(Mobject): b: float, axis: int | None = None ) -> Self: - assert(isinstance(smobject, Surface)) + assert isinstance(smobject, Surface) if axis is None: axis = self.prefered_creation_axis if a <= 0 and b >= 1: diff --git a/manimlib/mobject/types/vectorized_mobject.py b/manimlib/mobject/types/vectorized_mobject.py index ff3ec8f2..6d19c948 100644 --- a/manimlib/mobject/types/vectorized_mobject.py +++ b/manimlib/mobject/types/vectorized_mobject.py @@ -473,7 +473,7 @@ class VMobject(Mobject): if len(anchors) == 0: self.clear_points() return self - assert(len(anchors) == len(handles) + 1) + assert len(anchors) == len(handles) + 1 points = resize_array(self.get_points(), 2 * len(anchors) - 1) points[0::2] = anchors points[1::2] = handles @@ -1057,7 +1057,7 @@ class VMobject(Mobject): return self def pointwise_become_partial(self, vmobject: VMobject, a: float, b: float) -> Self: - assert(isinstance(vmobject, VMobject)) + assert isinstance(vmobject, VMobject) vm_points = vmobject.get_points() self.data["joint_product"] = vmobject.data["joint_product"] if a <= 0 and b >= 1: @@ -1259,7 +1259,7 @@ class VMobject(Mobject): return wrapper def set_points(self, points: Vect3Array, refresh_joints: bool = True) -> Self: - assert(len(points) == 0 or len(points) % 2 == 1) + assert len(points) == 0 or len(points) % 2 == 1 super().set_points(points) self.refresh_triangulation() if refresh_joints: @@ -1269,7 +1269,7 @@ class VMobject(Mobject): @triggers_refreshed_triangulation def append_points(self, points: Vect3Array) -> Self: - assert(len(points) % 2 == 0) + assert len(points) % 2 == 0 super().append_points(points) return self diff --git a/manimlib/scene/scene.py b/manimlib/scene/scene.py index c46587f2..a545f183 100644 --- a/manimlib/scene/scene.py +++ b/manimlib/scene/scene.py @@ -868,7 +868,7 @@ class Scene(object): point: Vect3, d_point: Vect3 ) -> None: - assert(self.window is not None) + assert self.window is not None self.mouse_point.move_to(point) event_data = {"point": point, "d_point": d_point} diff --git a/manimlib/shader_wrapper.py b/manimlib/shader_wrapper.py index 8fa3801e..6e0a38f5 100644 --- a/manimlib/shader_wrapper.py +++ b/manimlib/shader_wrapper.py @@ -219,7 +219,7 @@ class ShaderWrapper(object): self.set_ctx_clip_plane(self.use_clip_plane()) def render(self): - assert(self.vao is not None) + assert self.vao is not None self.vao.render() def update_program_uniforms(self, camera_uniforms: UniformDict):