Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

[pre-commit.ci] pre-commit autoupdate (#2086)

pre-commit-ci[bot]eb09675fc567
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index d72e5e96f..09437e652 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -28,7 +28,7 @@ repos:
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade
- rev: v2.26.0
+ rev: v2.28.0
hooks:
- id: pyupgrade
name: Update code to new python versions
diff --git a/manim/animation/indication.py b/manim/animation/indication.py
index bc8db19dd..f2fbb0b92 100644
--- a/manim/animation/indication.py
+++ b/manim/animation/indication.py
@@ -325,8 +325,7 @@ class ShowPassingFlashWithThinningStrokeWidth(AnimationGroup):
self.remover = remover
max_stroke_width = vmobject.get_stroke_width()
max_time_width = kwargs.pop("time_width", self.time_width)
- AnimationGroup.__init__(
- self,
+ super().__init__(
*(
ShowPassingFlash(
vmobject.deepcopy().set_stroke(width=stroke_width),
diff --git a/manim/animation/movement.py b/manim/animation/movement.py
index 0c2c4f5b7..ed7b4f6bf 100644
--- a/manim/animation/movement.py
+++ b/manim/animation/movement.py
@@ -60,7 +60,7 @@ class SmoothedVectorizedHomotopy(Homotopy):
starting_submobject: "Mobject",
alpha: float,
) -> None:
- Homotopy.interpolate_submobject(self, submobject, starting_submobject, alpha)
+ super().interpolate_submobject(submobject, starting_submobject, alpha)
submobject.make_smooth()
@@ -81,7 +81,7 @@ class ComplexHomotopy(Homotopy):
c = complex_homotopy(complex(x, y), t)
return (c.real, c.imag, z)
- Homotopy.__init__(self, homotopy, mobject, **kwargs)
+ super().__init__(homotopy, mobject, **kwargs)
class PhaseFlow(Animation):
diff --git a/manim/animation/transform.py b/manim/animation/transform.py
index 176276dbc..e420b1f4b 100644
--- a/manim/animation/transform.py
+++ b/manim/animation/transform.py
@@ -465,7 +465,7 @@ class TransformAnimations(Transform):
def interpolate(self, alpha: float) -> None:
self.start_anim.interpolate(alpha)
self.end_anim.interpolate(alpha)
- Transform.interpolate(self, alpha)
+ super().interpolate(alpha)
class FadeTransform(Transform):
diff --git a/manim/camera/mapping_camera.py b/manim/camera/mapping_camera.py
index 03e92bb67..690639d98 100644
--- a/manim/camera/mapping_camera.py
+++ b/manim/camera/mapping_camera.py
@@ -28,11 +28,10 @@ class MappingCamera(Camera):
self.mapping_func = mapping_func
self.min_num_curves = min_num_curves
self.allow_object_intrusion = allow_object_intrusion
- Camera.__init__(self, **kwargs)
+ super().__init__(**kwargs)
def points_to_pixel_coords(self, points):
- return Camera.points_to_pixel_coords(
- self,
+ return super().points_to_pixel_coords(
np.apply_along_axis(self.mapping_func, 1, points),
)
@@ -48,8 +47,7 @@ class MappingCamera(Camera):
and 0 < mobject.get_num_curves() < self.min_num_curves
):
mobject.insert_n_curves(self.min_num_curves)
- Camera.capture_mobjects(
- self,
+ super().capture_mobjects(
mobject_copies,
include_submobjects=False,
excluded_mobjects=None,
@@ -79,7 +77,7 @@ class OldMultiCamera(Camera):
)
for camera_with_start_positions in cameras_with_start_positions
]
- Camera.__init__(self, **kwargs)
+ super().__init__(**kwargs)
def capture_mobjects(self, mobjects, **kwargs):
for shifted_camera in self.shifted_cameras:
@@ -101,7 +99,7 @@ class OldMultiCamera(Camera):
)
def set_pixel_array(self, pixel_array, **kwargs):
- Camera.set_pixel_array(self, pixel_array, **kwargs)
+ super().set_pixel_array(pixel_array, **kwargs)
for shifted_camera in self.shifted_cameras:
shifted_camera.camera.set_pixel_array(
pixel_array[
@@ -112,7 +110,7 @@ class OldMultiCamera(Camera):
)
def init_background(self):
- Camera.init_background(self)
+ super().init_background()
for shifted_camera in self.shifted_cameras:
shifted_camera.camera.init_background()
@@ -132,8 +130,7 @@ class SplitScreenCamera(OldMultiCamera):
# TODO: Round up on one if width is odd
camera.reset_pixel_shape(camera.pixel_height, half_width)
- OldMultiCamera.__init__(
- self,
+ super().__init__(
(left_camera, (0, 0)),
(right_camera, (0, half_width)),
)
diff --git a/manim/camera/moving_camera.py b/manim/camera/moving_camera.py
index 22f2d0e13..f6e278409 100644
--- a/manim/camera/moving_camera.py
+++ b/manim/camera/moving_camera.py
@@ -20,7 +20,7 @@ from ..utils.color import WHITE
# TODO, think about how to incorporate perspective
class CameraFrame(VGroup):
def __init__(self, center=ORIGIN, **kwargs):
- VGroup.__init__(self, center=center, **kwargs)
+ super().__init__(center=center, **kwargs)
self.width = config["frame_width"]
self.height = config["frame_height"]
@@ -57,7 +57,7 @@ class MovingCamera(Camera):
self.default_frame_stroke_width,
)
self.frame = frame
- Camera.__init__(self, **kwargs)
+ super().__init__(**kwargs)
# TODO, make these work for a rotated frame
@property
@@ -131,7 +131,7 @@ class MovingCamera(Camera):
def capture_mobjects(self, mobjects, **kwargs):
# self.reset_frame_center()
# self.realign_frame_shape()
- Camera.capture_mobjects(self, mobjects, **kwargs)
+ super().capture_mobjects(mobjects, **kwargs)
# Since the frame can be moving around, the cairo
# context used for updating should be regenerated
diff --git a/manim/camera/multi_camera.py b/manim/camera/multi_camera.py
index 0d0285b81..81e832888 100644
--- a/manim/camera/multi_camera.py
+++ b/manim/camera/multi_camera.py
@@ -32,7 +32,7 @@ class MultiCamera(MovingCamera):
self.allow_cameras_to_capture_their_own_display = (
allow_cameras_to_capture_their_own_display
)
- MovingCamera.__init__(self, **kwargs)
+ super().__init__(**kwargs)
def add_image_mobject_from_camera(self, image_mobject_from_camera):
"""Adds an ImageMobject that's been obtained from the camera
@@ -72,7 +72,7 @@ class MultiCamera(MovingCamera):
"""
for imfc in self.image_mobjects_from_cameras:
imfc.camera.reset()
- MovingCamera.reset(self)
+ super().reset()
return self
def capture_mobjects(self, mobjects, **kwargs):
@@ -82,7 +82,7 @@ class MultiCamera(MovingCamera):
if not self.allow_cameras_to_capture_their_own_display:
to_add = list_difference_update(to_add, imfc.get_family())
imfc.camera.capture_mobjects(to_add, **kwargs)
- MovingCamera.capture_mobjects(self, mobjects, **kwargs)
+ super().capture_mobjects(mobjects, **kwargs)
def get_mobjects_indicating_movement(self):
"""Returns all mobjects whose movement implies that the camera
diff --git a/manim/camera/three_d_camera.py b/manim/camera/three_d_camera.py
index fb8a6771e..717bfa82c 100644
--- a/manim/camera/three_d_camera.py
+++ b/manim/camera/three_d_camera.py
@@ -78,7 +78,7 @@ class ThreeDCamera(Camera):
def capture_mobjects(self, mobjects, **kwargs):
self.reset_rotation_matrix()
- Camera.capture_mobjects(self, mobjects, **kwargs)
+ super().capture_mobjects(mobjects, **kwargs)
def get_value_trackers(self):
"""Returns list of ValueTrackers of phi, theta, distance and gamma
@@ -131,7 +131,7 @@ class ThreeDCamera(Camera):
return self.modified_rgbas(vmobject, vmobject.get_fill_rgbas())
def get_mobjects_to_display(self, *args, **kwargs): # NOTE : DocStrings From parent
- mobjects = Camera.get_mobjects_to_display(self, *args, **kwargs)
+ mobjects = super().get_mobjects_to_display(*args, **kwargs)
rot_matrix = self.get_rotation_matrix()
def z_key(mob):
diff --git a/manim/mobject/coordinate_systems.py b/manim/mobject/coordinate_systems.py
index cf6c814ab..fcf024682 100644
--- a/manim/mobject/coordinate_systems.py
+++ b/manim/mobject/coordinate_systems.py
@@ -1843,8 +1843,7 @@ class ThreeDAxes(Axes):
**kwargs,
):
- Axes.__init__(
- self,
+ super().__init__(
x_range=x_range,
x_length=x_length,
y_range=y_range,
diff --git a/manim/mobject/frame.py b/manim/mobject/frame.py
index d939e0a21..757762a81 100644
--- a/manim/mobject/frame.py
+++ b/manim/mobject/frame.py
@@ -16,7 +16,7 @@ from ..utils.color import BLACK
class ScreenRectangle(Rectangle):
def __init__(self, aspect_ratio=16.0 / 9.0, height=4, **kwargs):
- Rectangle.__init__(self, width=aspect_ratio * height, height=height, **kwargs)
+ super().__init__(width=aspect_ratio * height, height=height, **kwargs)
@property
def aspect_ratio(self):
@@ -35,14 +35,13 @@ class ScreenRectangle(Rectangle):
class FullScreenRectangle(ScreenRectangle):
def __init__(self, **kwargs):
- ScreenRectangle.__init__(self, **kwargs)
+ super().__init__(**kwargs)
self.height = config["frame_height"]
class FullScreenFadeRectangle(FullScreenRectangle):
def __init__(self, stroke_width=0, fill_color=BLACK, fill_opacity=0.7, **kwargs):
- FullScreenRectangle.__init__(
- self,
+ super().__init__(
stroke_width=stroke_width,
fill_color=fill_color,
fill_opacity=fill_opacity,
@@ -52,7 +51,7 @@ class FullScreenFadeRectangle(FullScreenRectangle):
class PictureInPictureFrame(Rectangle):
def __init__(self, height=3, aspect_ratio=16.0 / 9.0, **kwargs):
- Rectangle.__init__(self, width=aspect_ratio * height, height=height, **kwargs)
+ super().__init__(width=aspect_ratio * height, height=height, **kwargs)
@property
def aspect_ratio(self):
diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.py
index 0cad357cc..184f33889 100644
--- a/manim/mobject/geometry.py
+++ b/manim/mobject/geometry.py
@@ -749,7 +749,7 @@ class LabeledDot(Dot):
if radius is None:
radius = 0.1 + max(rendered_label.width, rendered_label.height) / 2
- Dot.__init__(self, radius=radius, **kwargs)
+ super().__init__(radius=radius, **kwargs)
rendered_label.move_to(self.get_center())
self.add(rendered_label)
@@ -1182,7 +1182,7 @@ class DashedLine(Line):
if len(self.submobjects) > 0:
return self.submobjects[0].get_start()
else:
- return Line.get_start(self)
+ return super().get_start()
def get_end(self) -> np.ndarray:
"""Returns the end point of the line.
diff --git a/manim/mobject/logo.py b/manim/mobject/logo.py
index 09c076033..ff3414efb 100644
--- a/manim/mobject/logo.py
+++ b/manim/mobject/logo.py
@@ -53,7 +53,7 @@ class ManimBanner(VGroup):
"""
def __init__(self, dark_theme: bool = True):
- VGroup.__init__(self)
+ super().__init__()
logo_green = "#81b29a"
logo_blue = "#454866"
diff --git a/manim/mobject/matrix.py b/manim/mobject/matrix.py
index 6fc6a841f..3f6037d6d 100644
--- a/manim/mobject/matrix.py
+++ b/manim/mobject/matrix.py
@@ -467,8 +467,7 @@ class DecimalMatrix(Matrix):
element_to_mobject_config : Dict[:class:`str`, :class:`~.Mobject`], optional
Config for the desired mobject, by default {"num_decimal_places": 1}
"""
- Matrix.__init__(
- self,
+ super().__init__(
matrix,
element_to_mobject=element_to_mobject,
element_to_mobject_config=element_to_mobject_config,
@@ -505,7 +504,7 @@ class IntegerMatrix(Matrix):
element_to_mobject : :class:`~.Mobject`, optional
Mobject to use, by default Integer
"""
- Matrix.__init__(self, matrix, element_to_mobject=element_to_mobject, **kwargs)
+ super().__init__(matrix, element_to_mobject=element_to_mobject, **kwargs)
class MobjectMatrix(Matrix):
@@ -528,7 +527,7 @@ class MobjectMatrix(Matrix):
"""
def __init__(self, matrix, element_to_mobject=lambda m: m, **kwargs):
- Matrix.__init__(self, matrix, element_to_mobject=element_to_mobject, **kwargs)
+ super().__init__(matrix, element_to_mobject=element_to_mobject, **kwargs)
def get_det_text(
diff --git a/manim/mobject/opengl_geometry.py b/manim/mobject/opengl_geometry.py
index f0c26407b..52bd0f53c 100644
--- a/manim/mobject/opengl_geometry.py
+++ b/manim/mobject/opengl_geometry.py
@@ -60,7 +60,7 @@ class OpenGLTipableVMobject(OpenGLVMobject):
self.tip_length = tip_length
self.normal_vector = normal_vector
self.tip_config = tip_config
- OpenGLVMobject.__init__(self, **kwargs)
+ super().__init__(**kwargs)
def add_tip(self, at_start=False, **kwargs):
"""
@@ -182,13 +182,13 @@ class OpenGLTipableVMobject(OpenGLVMobject):
if self.has_tip():
return self.tip.get_start()
else:
- return OpenGLVMobject.get_end(self)
+ return super().get_end()
def get_start(self):
if self.has_start_tip():
return self.start_tip.get_start()
else:
- return OpenGLVMobject.get_start(self)
+ return super().get_start()
def get_length(self):
start, end = self.get_start_and_end()
@@ -284,19 +284,19 @@ class OpenGLArcBetweenPoints(OpenGLArc):
class OpenGLCurvedArrow(OpenGLArcBetweenPoints):
def __init__(self, start_point, end_point, **kwargs):
- OpenGLArcBetweenPoints.__init__(self, start_point, end_point, **kwargs)
+ super().__init__(start_point, end_point, **kwargs)
self.add_tip()
class OpenGLCurvedDoubleArrow(OpenGLCurvedArrow):
def __init__(self, start_point, end_point, **kwargs):
- OpenGLCurvedArrow.__init__(self, start_point, end_point, **kwargs)
+ super().__init__(start_point, end_point, **kwargs)
self.add_tip(at_start=True)
class OpenGLCircle(OpenGLArc):
def __init__(self, color=RED, **kwargs):
- OpenGLArc.__init__(self, 0, TAU, color=color, **kwargs)
+ super().__init__(0, TAU, color=color, **kwargs)
def surround(self, mobject, dim_to_match=0, stretch=False, buff=MED_SMALL_BUFF):
# Ignores dim_to_match and stretch; result will always be a circle
@@ -352,8 +352,7 @@ class OpenGLAnnularSector(OpenGLArc):
):
self.inner_radius = inner_radius
self.outer_radius = outer_radius
- OpenGLArc.__init__(
- self,
+ super().__init__(
start_angle=start_angle,
angle=angle,
fill_opacity=fill_opacity,
@@ -381,9 +380,7 @@ class OpenGLAnnularSector(OpenGLArc):
class OpenGLSector(OpenGLAnnularSector):
def __init__(self, outer_radius=1, inner_radius=0, **kwargs):
- OpenGLAnnularSector.__init__(
- self, inner_radius=inner_radius, outer_radius=outer_radius, **kwargs
- )
+ super().__init__(inner_radius=inner_radius, outer_radius=outer_radius, **kwargs)
class OpenGLAnnulus(OpenGLCircle):
@@ -400,12 +397,8 @@ class OpenGLAnnulus(OpenGLCircle):
self.mark_paths_closed = mark_paths_closed # is this even used?
self.inner_radius = inner_radius
self.outer_radius = outer_radius
- OpenGLCircle.__init__(
- self,
- fill_opacity=fill_opacity,
- stroke_width=stroke_width,
- color=color,
- **kwargs
+ super().__init__(
+ fill_opacity=fill_opacity, stroke_width=stroke_width, color=color, **kwargs
)
def init_points(self):
@@ -558,13 +551,13 @@ class OpenGLDashedLine(OpenGLLine):
if len(self.submobjects) > 0:
return self.submobjects[0].get_start()
else:
- return OpenGLLine.get_start(self)
+ return super().get_start()
def get_end(self):
if len(self.submobjects) > 0:
return self.submobjects[-1].get_end()
else:
- return OpenGLLine.get_end(self)
+ return super().get_end()
def get_first_handle(self):
return self.submobjects[0].points[1]
@@ -735,13 +728,13 @@ class OpenGLVector(OpenGLArrow):
class OpenGLDoubleArrow(OpenGLArrow):
def __init__(self, *args, **kwargs):
- OpenGLArrow.__init__(self, *args, **kwargs)
+ super().__init__(*args, **kwargs)
self.add_tip(at_start=True)
class OpenGLCubicBezier(OpenGLVMobject):
def __init__(self, a0, h0, h1, a1, **kwargs):
- OpenGLVMobject.__init__(self, **kwargs)
+ super().__init__(**kwargs)
self.add_cubic_bezier_curve(a0, h0, h1, a1)
@@ -822,8 +815,7 @@ class OpenGLArrowTip(OpenGLTriangle):
angle=0,
**kwargs
):
- OpenGLTriangle.__init__(
- self,
+ super().__init__(
start_angle=0,
fill_opacity=fill_opacity,
fill_color=fill_color,
@@ -851,7 +843,7 @@ class OpenGLArrowTip(OpenGLTriangle):
class OpenGLRectangle(OpenGLPolygon):
def __init__(self, color=WHITE, width=4.0, height=2.0, **kwargs):
- OpenGLPolygon.__init__(self, UR, UL, DL, DR, color=color, **kwargs)
+ super().__init__(UR, UL, DL, DR, color=color, **kwargs)
self.set_width(width, stretch=True)
self.set_height(height, stretch=True)
@@ -867,5 +859,5 @@ class OpenGLSquare(OpenGLRectangle):
class OpenGLRoundedRectangle(OpenGLRectangle):
def __init__(self, corner_radius=0.5, **kwargs):
self.corner_radius = corner_radius
- OpenGLRectangle.__init__(self, **kwargs)
+ super().__init__(**kwargs)
self.round_corners(self.corner_radius)
diff --git a/manim/mobject/opengl_mobject.py b/manim/mobject/opengl_mobject.py
index 39c1f63ef..e981e051e 100644
--- a/manim/mobject/opengl_mobject.py
+++ b/manim/mobject/opengl_mobject.py
@@ -1982,7 +1982,7 @@ class OpenGLGroup(OpenGLMobject):
def __init__(self, *mobjects, **kwargs):
if not all([isinstance(m, OpenGLMobject) for m in mobjects]):
raise Exception("All submobjects must be of type Mobject")
- OpenGLMobject.__init__(self, **kwargs)
+ super().__init__(**kwargs)
self.add(*mobjects)
@@ -1992,7 +1992,7 @@ class OpenGLPoint(OpenGLMobject):
):
self.artificial_width = artificial_width
self.artificial_height = artificial_height
- OpenGLMobject.__init__(self, **kwargs)
+ super().__init__(**kwargs)
self.set_location(location)
def get_width(self):
diff --git a/manim/mobject/polyhedra.py b/manim/mobject/polyhedra.py
index 947e23b32..6ad06a87c 100644
--- a/manim/mobject/polyhedra.py
+++ b/manim/mobject/polyhedra.py
@@ -172,8 +172,7 @@ class Tetrahedron(Polyhedron):
def __init__(self, edge_length: float = 1, **kwargs):
unit = edge_length * np.sqrt(2) / 4
- Polyhedron.__init__(
- self,
+ super().__init__(
vertex_coords=[
np.array([unit, unit, unit]),
np.array([unit, -unit, -unit]),
@@ -208,8 +207,7 @@ class Octahedron(Polyhedron):
def __init__(self, edge_length: float = 1, **kwargs):
unit = edge_length * np.sqrt(2) / 2
- Polyhedron.__init__(
- self,
+ super().__init__(
vertex_coords=[
np.array([unit, 0, 0]),
np.array([-unit, 0, 0]),
@@ -256,8 +254,7 @@ class Icosahedron(Polyhedron):
def __init__(self, edge_length: float = 1, **kwargs):
unit_a = edge_length * ((1 + np.sqrt(5)) / 4)
unit_b = edge_length * (1 / 2)
- Polyhedron.__init__(
- self,
+ super().__init__(
vertex_coords=[
np.array([0, unit_b, unit_a]),
np.array([0, -unit_b, unit_a]),
@@ -323,8 +320,7 @@ class Dodecahedron(Polyhedron):
unit_a = edge_length * ((1 + np.sqrt(5)) / 4)
unit_b = edge_length * ((3 + np.sqrt(5)) / 4)
unit_c = edge_length * (1 / 2)
- Polyhedron.__init__(
- self,
+ super().__init__(
vertex_coords=[
np.array([unit_a, unit_a, unit_a]),
np.array([unit_a, unit_a, -unit_a]),
diff --git a/manim/mobject/probability.py b/manim/mobject/probability.py
index 1cbffc473..af1098dee 100644
--- a/manim/mobject/probability.py
+++ b/manim/mobject/probability.py
@@ -58,8 +58,7 @@ class SampleSpace(Rectangle):
stroke_color=LIGHT_GREY,
default_label_scale_val=1,
):
- Rectangle.__init__(
- self,
+ super().__init__(
height=height,
width=width,
fill_color=fill_color,
@@ -260,7 +259,7 @@ class BarChart(VGroup):
bar_label_scale_val: float = 0.75,
**kwargs
): # What's the return type?
- VGroup.__init__(self, **kwargs)
+ super().__init__(**kwargs)
self.n_ticks = n_ticks
self.tick_width = tick_width
self.label_y_axis = label_y_axis
diff --git a/manim/mobject/shape_matchers.py b/manim/mobject/shape_matchers.py
index ca2505443..e08fac8a1 100644
--- a/manim/mobject/shape_matchers.py
+++ b/manim/mobject/shape_matchers.py
@@ -41,8 +41,7 @@ class SurroundingRectangle(RoundedRectangle):
):
self.color = color
self.buff = buff
- RoundedRectangle.__init__(
- self,
+ super().__init__(
color=color,
width=mobject.width + 2 * self.buff,
height=mobject.height + 2 * self.buff,
@@ -87,8 +86,7 @@ class BackgroundRectangle(SurroundingRectangle):
buff=0,
**kwargs
):
- SurroundingRectangle.__init__(
- self,
+ super().__init__(
mobject,
color=color,
stroke_width=stroke_width,
diff --git a/manim/mobject/svg/brace.py b/manim/mobject/svg/brace.py
index e84831548..46296aeef 100644
--- a/manim/mobject/svg/brace.py
+++ b/manim/mobject/svg/brace.py
@@ -102,8 +102,7 @@ class Brace(SVGPathMobject):
-linear_section_length,
)
- SVGPathMobject.__init__(
- self,
+ super().__init__(
path_string=path,
stroke_width=stroke_width,
fill_opacity=fill_opacity,
@@ -258,7 +257,7 @@ class BraceBetweenPoints(Brace):
if all(direction == ORIGIN):
line_vector = np.array(point_2) - np.array(point_1)
direction = np.array([line_vector[1], -line_vector[0], 0])
- Brace.__init__(self, Line(point_1, point_2), direction=direction, **kwargs)
+ super().__init__(Line(point_1, point_2), direction=direction, **kwargs)
class ArcBrace(Brace):
@@ -328,10 +327,10 @@ class ArcBrace(Brace):
if arc.radius >= 1:
line.scale(arc.radius, about_point=ORIGIN)
- Brace.__init__(self, line, direction=direction, **kwargs)
+ super().__init__(line, direction=direction, **kwargs)
self.scale(1 / (arc.radius), about_point=ORIGIN)
else:
- Brace.__init__(self, line, direction=direction, **kwargs)
+ super().__init__(line, direction=direction, **kwargs)
if arc.radius >= 0.3:
self.shift(scale_shift)
diff --git a/manim/mobject/svg/opengl_tex_mobject.py b/manim/mobject/svg/opengl_tex_mobject.py
index a79d49e40..f1154d411 100644
--- a/manim/mobject/svg/opengl_tex_mobject.py
+++ b/manim/mobject/svg/opengl_tex_mobject.py
@@ -234,8 +234,7 @@ class OpenGLSingleStringMathTex(OpenGLSVGMobject):
environment=self.tex_environment,
tex_template=self.tex_template,
)
- OpenGLSVGMobject.__init__(
- self,
+ super().__init__(
file_name=file_name,
should_center=should_center,
stroke_width=stroke_width,
@@ -399,8 +398,7 @@ class OpenGLMathTex(OpenGLSingleStringMathTex):
self.tex_environment = tex_environment
tex_strings = self.break_up_tex_strings(tex_strings)
self.tex_strings = tex_strings
- OpenGLSingleStringMathTex.__init__(
- self,
+ super().__init__(
self.arg_separator.join(tex_strings),
tex_environment=self.tex_environment,
tex_template=self.tex_template,
@@ -525,8 +523,7 @@ class OpenGLTex(OpenGLMathTex):
def __init__(
self, *tex_strings, arg_separator="", tex_environment="center", **kwargs
):
- OpenGLMathTex.__init__(
- self,
+ super().__init__(
*tex_strings,
arg_separator=arg_separator,
tex_environment=tex_environment,
diff --git a/manim/mobject/svg/opengl_text_mobject.py b/manim/mobject/svg/opengl_text_mobject.py
index 2e5f41d7b..16e0d5e3e 100644
--- a/manim/mobject/svg/opengl_text_mobject.py
+++ b/manim/mobject/svg/opengl_text_mobject.py
@@ -162,8 +162,8 @@ class OpenGLParagraph(OpenGLVGroup):
self.lines[1].extend(
[self.alignment for _ in range(chars_lines_text_list.__len__())],
)
- OpenGLVGroup.__init__(
- self, *(self.lines[0][i] for i in range(self.lines[0].__len__())), **config
+ super().__init__(
+ *(self.lines[0][i] for i in range(self.lines[0].__len__())), **config
)
self.move_to(np.array([0, 0, 0]))
if self.alignment:
@@ -451,8 +451,7 @@ class OpenGLText(OpenGLSVGMobject):
self.line_spacing = self.size + self.size * self.line_spacing
file_name = self.text2svg()
PangoUtils.remove_last_M(file_name)
- OpenGLSVGMobject.__init__(
- self,
+ super().__init__(
file_name,
color=color,
fill_opacity=fill_opacity,
@@ -949,8 +948,7 @@ class OpenGLMarkupText(OpenGLSVGMobject):
file_name = self.text2svg()
PangoUtils.remove_last_M(file_name)
- OpenGLSVGMobject.__init__(
- self,
+ super().__init__(
file_name,
fill_opacity=fill_opacity,
stroke_width=stroke_width,
diff --git a/manim/mobject/svg/svg_mobject.py b/manim/mobject/svg/svg_mobject.py
index a94b1a424..49edbbfb9 100644
--- a/manim/mobject/svg/svg_mobject.py
+++ b/manim/mobject/svg/svg_mobject.py
@@ -585,4 +585,4 @@ class SVGMobject(VMobject, metaclass=ConvertToOpenGL):
recurse=propagate_colors,
)
else:
- VMobject.init_colors(self, propagate_colors=propagate_colors)
+ super().init_colors(propagate_colors=propagate_colors)
diff --git a/manim/mobject/three_dimensions.py b/manim/mobject/three_dimensions.py
index fcdc4ed9f..883f96ebb 100644
--- a/manim/mobject/three_dimensions.py
+++ b/manim/mobject/three_dimensions.py
@@ -426,7 +426,7 @@ class Prism(Cube):
super().__init__(**kwargs)
def generate_points(self):
- Cube.generate_points(self)
+ super().generate_points()
for dim, value in enumerate(self.dimensions):
self.rescale_to_fit(value, dim, stretch=True)
diff --git a/manim/mobject/types/image_mobject.py b/manim/mobject/types/image_mobject.py
index 9d9d90ba9..809d9da40 100644
--- a/manim/mobject/types/image_mobject.py
+++ b/manim/mobject/types/image_mobject.py
@@ -185,7 +185,7 @@ class ImageMobject(AbstractImageMobject):
self.change_to_rgba_array()
if self.invert:
self.pixel_array[:, :, :3] = 255 - self.pixel_array[:, :, :3]
- AbstractImageMobject.__init__(self, scale_to_resolution, **kwargs)
+ super().__init__(scale_to_resolution, **kwargs)
def change_to_rgba_array(self):
"""Converts an RGB array into RGBA with the alpha value opacity maxed."""
diff --git a/manim/mobject/types/point_cloud_mobject.py b/manim/mobject/types/point_cloud_mobject.py
index bac458c13..61782be18 100644
--- a/manim/mobject/types/point_cloud_mobject.py
+++ b/manim/mobject/types/point_cloud_mobject.py
@@ -60,7 +60,7 @@ class PMobject(Mobject, metaclass=ConvertToOpenGL):
return self
def get_array_attrs(self):
- return Mobject.get_array_attrs(self) + ["rgbas"]
+ return super().get_array_attrs() + ["rgbas"]
def add_points(self, points, rgbas=None, color=None, alpha=1):
"""
@@ -214,7 +214,7 @@ class Mobject1D(PMobject, metaclass=ConvertToOpenGL):
def __init__(self, density=DEFAULT_POINT_DENSITY_1D, **kwargs):
self.density = density
self.epsilon = 1.0 / self.density
- PMobject.__init__(self, **kwargs)
+ super().__init__(**kwargs)
def add_line(self, start, end, color=None):
start, end = list(map(np.array, [start, end]))
@@ -231,7 +231,7 @@ class Mobject2D(PMobject, metaclass=ConvertToOpenGL):
def __init__(self, density=DEFAULT_POINT_DENSITY_2D, **kwargs):
self.density = density
self.epsilon = 1.0 / self.density
- PMobject.__init__(self, **kwargs)
+ super().__init__(**kwargs)
class PGroup(PMobject):
diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py
index 06c74740a..1e7c47fb0 100644
--- a/manim/mobject/types/vectorized_mobject.py
+++ b/manim/mobject/types/vectorized_mobject.py
@@ -105,7 +105,7 @@ class VMobject(Mobject):
self.shade_in_3d = shade_in_3d
self.tolerance_for_point_equality = tolerance_for_point_equality
self.n_points_per_cubic_curve = n_points_per_cubic_curve
- Mobject.__init__(self, **kwargs)
+ super().__init__(**kwargs)
def get_group_class(self):
return VGroup
@@ -852,7 +852,7 @@ class VMobject(Mobject):
def apply_function(self, function):
factor = self.pre_function_handle_to_anchor_scale_factor
self.scale_handle_to_anchor_distances(factor)
- Mobject.apply_function(self, function)
+ super().apply_function(function)
self.scale_handle_to_anchor_distances(1.0 / factor)
if self.make_smooth_after_applying_functions:
self.make_smooth()
@@ -2176,7 +2176,7 @@ class CurvesAsSubmobjects(VGroup):
"""
def __init__(self, vmobject, **kwargs):
- VGroup.__init__(self, **kwargs)
+ super().__init__(**kwargs)
tuples = vmobject.get_cubic_bezier_tuples()
for tup in tuples:
part = VMobject()
diff --git a/manim/scene/moving_camera_scene.py b/manim/scene/moving_camera_scene.py
index d9534da73..893e94128 100644
--- a/manim/scene/moving_camera_scene.py
+++ b/manim/scene/moving_camera_scene.py
@@ -85,7 +85,7 @@ class MovingCameraScene(Scene):
"""
def __init__(self, camera_class=MovingCamera, **kwargs):
- Scene.__init__(self, camera_class=camera_class, **kwargs)
+ super().__init__(camera_class=camera_class, **kwargs)
def get_moving_mobjects(self, *animations):
"""
@@ -97,7 +97,7 @@ class MovingCameraScene(Scene):
*animations : Animation
The Animations whose mobjects will be checked.
"""
- moving_mobjects = Scene.get_moving_mobjects(self, *animations)
+ moving_mobjects = super().get_moving_mobjects(*animations)
all_moving_mobjects = extract_mobject_family_members(moving_mobjects)
movement_indicators = self.renderer.camera.get_mobjects_indicating_movement()
for movement_indicator in movement_indicators:
diff --git a/manim/scene/reconfigurable_scene.py b/manim/scene/reconfigurable_scene.py
index 0a7ac386f..5877629b5 100644
--- a/manim/scene/reconfigurable_scene.py
+++ b/manim/scene/reconfigurable_scene.py
@@ -12,7 +12,7 @@ class ReconfigurableScene(Scene):
"""
def __init__(self, allow_recursion=True, **kwargs):
- Scene.__init__(self, **kwargs)
+ super().__init__(**kwargs)
self.allow_recursion = allow_recursion
def setup(self):
diff --git a/manim/scene/three_d_scene.py b/manim/scene/three_d_scene.py
index 0cb21ea25..45eaac642 100644
--- a/manim/scene/three_d_scene.py
+++ b/manim/scene/three_d_scene.py
@@ -246,7 +246,7 @@ class ThreeDScene(Scene):
*animations : Animation
The animations whose mobjects will be checked.
"""
- moving_mobjects = Scene.get_moving_mobjects(self, *animations)
+ moving_mobjects = super().get_moving_mobjects(*animations)
camera_mobjects = self.renderer.camera.get_value_trackers() + [
self.renderer.camera._frame_center,
]
@@ -387,7 +387,7 @@ class SpecialThreeDScene(ThreeDScene):
else:
_config = self.low_quality_config
_config = merge_dicts_recursively(_config, kwargs)
- ThreeDScene.__init__(self, **_config)
+ super().__init__(**_config)
def get_axes(self):
"""Return a set of 3D axes.
diff --git a/manim/scene/vector_space_scene.py b/manim/scene/vector_space_scene.py
index 6de9654df..c758a9fdd 100644
--- a/manim/scene/vector_space_scene.py
+++ b/manim/scene/vector_space_scene.py
@@ -42,7 +42,7 @@ Z_COLOR = BLUE_D
# actually doing a lot of animating.
class VectorScene(Scene):
def __init__(self, basis_vector_stroke_width=6, **kwargs):
- Scene.__init__(self, **kwargs)
+ super().__init__(**kwargs)
self.basis_vector_stroke_width = basis_vector_stroke_width
def add_plane(self, animate=False, **kwargs):
@@ -572,7 +572,7 @@ class LinearTransformationScene(VectorScene):
**kwargs
):
- VectorScene.__init__(self, **kwargs)
+ super().__init__(**kwargs)
self.include_background_plane = include_background_plane
self.include_foreground_plane = include_foreground_plane
@@ -801,7 +801,7 @@ class LinearTransformationScene(VectorScene):
Arrow
The arrow representing the vector.
"""
- vector = VectorScene.add_vector(self, vector, color=color, **kwargs)
+ vector = super().add_vector(vector, color=color, **kwargs)
self.moving_vectors.append(vector)
return vector
@@ -824,7 +824,7 @@ class LinearTransformationScene(VectorScene):
Matrix
The column matrix representing the vector.
"""
- coords = VectorScene.write_vector_coordinates(self, vector, **kwargs)
+ coords = super().write_vector_coordinates(vector, **kwargs)
self.add_foreground_mobject(coords)
return coords
diff --git a/manim/scene/zoomed_scene.py b/manim/scene/zoomed_scene.py
index 9abbb208c..4d57ba161 100644
--- a/manim/scene/zoomed_scene.py
+++ b/manim/scene/zoomed_scene.py
@@ -99,14 +99,14 @@ class ZoomedScene(MovingCameraScene):
self.zoom_factor = zoom_factor
self.image_frame_stroke_width = image_frame_stroke_width
self.zoom_activated = zoom_activated
- MovingCameraScene.__init__(self, camera_class=camera_class, **kwargs)
+ super().__init__(camera_class=camera_class, **kwargs)
def setup(self):
"""
This method is used internally by Manim to
setup the scene for proper use.
"""
- MovingCameraScene.setup(self)
+ super().setup()
# Initialize camera and display
zoomed_camera = MovingCamera(**self.zoomed_camera_config)
zoomed_display = ImageMobjectFromCamera(
diff --git a/scripts/simple_cors_http_server.py b/scripts/simple_cors_http_server.py
index 2038f95a6..2a9ba81a3 100755
--- a/scripts/simple_cors_http_server.py
+++ b/scripts/simple_cors_http_server.py
@@ -6,7 +6,7 @@ from http.server import HTTPServer, SimpleHTTPRequestHandler, test
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header("Access-Control-Allow-Origin", "*")
- SimpleHTTPRequestHandler.end_headers(self)
+ super().end_headers()
if __name__ == "__main__":