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 (#3141)

pre-commit-ci[bot]b3e51e391ec1
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 51a08a417..5ba88145d 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -13,7 +13,7 @@ repos:
- id: check-toml
name: Validate Poetry
- repo: https://github.com/pycqa/isort
- rev: 5.11.4
+ rev: 5.12.0
hooks:
- id: isort
name: isort (python)
@@ -35,7 +35,7 @@ repos:
- id: python-check-blanket-noqa
name: Precision flake ignores
- repo: https://github.com/psf/black
- rev: 22.12.0
+ rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
diff --git a/manim/animation/creation.py b/manim/animation/creation.py
index c599708bd..2c8cae142 100644
--- a/manim/animation/creation.py
+++ b/manim/animation/creation.py
@@ -404,7 +404,6 @@ class Unwrite(Write):
reverse: bool = True,
**kwargs,
) -> None:
-
run_time: float | None = kwargs.pop("run_time", None)
lag_ratio: float | None = kwargs.pop("lag_ratio", None)
run_time, lag_ratio = self._set_default_config_from_length(
diff --git a/manim/animation/speedmodifier.py b/manim/animation/speedmodifier.py
index f4218e082..8aa71646b 100644
--- a/manim/animation/speedmodifier.py
+++ b/manim/animation/speedmodifier.py
@@ -97,7 +97,6 @@ class ChangeSpeed(Animation):
affects_speed_updaters: bool = True,
**kwargs,
) -> None:
-
if issubclass(type(anim), AnimationGroup):
self.anim = type(anim)(
*map(self.setup, anim.animations),
diff --git a/manim/animation/transform_matching_parts.py b/manim/animation/transform_matching_parts.py
index 8a400983b..8c9764386 100644
--- a/manim/animation/transform_matching_parts.py
+++ b/manim/animation/transform_matching_parts.py
@@ -76,7 +76,6 @@ class TransformMatchingAbstractBase(AnimationGroup):
key_map: dict | None = None,
**kwargs,
):
-
if isinstance(mobject, OpenGLVMobject):
group_type = OpenGLVGroup
elif isinstance(mobject, OpenGLMobject):
diff --git a/manim/camera/mapping_camera.py b/manim/camera/mapping_camera.py
index 34561c3d9..03f0afc3b 100644
--- a/manim/camera/mapping_camera.py
+++ b/manim/camera/mapping_camera.py
@@ -64,6 +64,7 @@ class MappingCamera(Camera):
# TODO: Add optional separator borders between cameras (or perhaps peel this off into a
# CameraPlusOverlay class)
+
# TODO, the classes below should likely be deleted
class OldMultiCamera(Camera):
def __init__(self, *cameras_with_start_positions, **kwargs):
diff --git a/manim/camera/three_d_camera.py b/manim/camera/three_d_camera.py
index 87b48f9fa..213cebb3b 100644
--- a/manim/camera/three_d_camera.py
+++ b/manim/camera/three_d_camera.py
@@ -380,6 +380,7 @@ class ThreeDCamera(Camera):
The function which returns the centerpoint
with respect to which the mobject will be oriented, by default None
"""
+
# This prevents the computation of mobject.get_center
# every single time a projection happens
def get_static_center_func(mobject):
diff --git a/manim/mobject/graphing/coordinate_systems.py b/manim/mobject/graphing/coordinate_systems.py
index 03f96b838..0873a976e 100644
--- a/manim/mobject/graphing/coordinate_systems.py
+++ b/manim/mobject/graphing/coordinate_systems.py
@@ -2287,7 +2287,6 @@ class ThreeDAxes(Axes):
gloss=0.5,
**kwargs,
):
-
super().__init__(
x_range=x_range,
x_length=x_length,
@@ -2609,7 +2608,6 @@ class NumberPlane(Axes):
make_smooth_after_applying_functions: bool = True,
**kwargs,
):
-
# configs
self.axis_config = {
"stroke_width": 2,
diff --git a/manim/mobject/graphing/functions.py b/manim/mobject/graphing/functions.py
index 4e40d463b..c1f053d73 100644
--- a/manim/mobject/graphing/functions.py
+++ b/manim/mobject/graphing/functions.py
@@ -128,7 +128,6 @@ class ParametricFunction(VMobject, metaclass=ConvertToOpenGL):
return self.function(t)
def generate_points(self):
-
if self.discontinuities is not None:
discontinuities = filter(
lambda t: self.t_min <= t <= self.t_max,
@@ -203,7 +202,6 @@ class FunctionGraph(ParametricFunction):
"""
def __init__(self, function, x_range=None, color=YELLOW, **kwargs):
-
if x_range is None:
x_range = np.array([-config["frame_x_radius"], config["frame_x_radius"]])
diff --git a/manim/mobject/graphing/number_line.py b/manim/mobject/graphing/number_line.py
index db7a1afd8..ededabc8e 100644
--- a/manim/mobject/graphing/number_line.py
+++ b/manim/mobject/graphing/number_line.py
@@ -568,7 +568,6 @@ class NumberLine(Line):
labels = VGroup()
for x, label in dict_values.items():
-
# TODO: remove this check and ability to call
# this method via CoordinateSystem.add_coordinates()
# must be explicitly called
diff --git a/manim/mobject/graphing/probability.py b/manim/mobject/graphing/probability.py
index b0f85cdd1..b38027ddf 100644
--- a/manim/mobject/graphing/probability.py
+++ b/manim/mobject/graphing/probability.py
@@ -254,7 +254,6 @@ class BarChart(Axes):
bar_stroke_width: float = 3,
**kwargs,
):
-
if isinstance(bar_colors, str):
logger.warning(
"Passing a string to `bar_colors` has been deprecated since v0.15.2 and will be removed after v0.17.0, the parameter must be a list. "
@@ -498,7 +497,6 @@ class BarChart(Axes):
if chart_val != 0:
quotient = value / chart_val
if quotient < 0:
-
aligned_edge = UP if chart_val > 0 else DOWN
# if the bar is already positive, then we now want to move it
diff --git a/manim/mobject/text/numbers.py b/manim/mobject/text/numbers.py
index f5a3b9220..b5b9f71c8 100644
--- a/manim/mobject/text/numbers.py
+++ b/manim/mobject/text/numbers.py
@@ -174,7 +174,6 @@ class DecimalNumber(VMobject, metaclass=ConvertToOpenGL):
return num_string
def _string_to_mob(self, string: str, mob_class: VMobject | None = None, **kwargs):
-
if mob_class is None:
mob_class = self.mob_class
@@ -405,7 +404,6 @@ class Variable(VMobject, metaclass=ConvertToOpenGL):
num_decimal_places: int = 2,
**kwargs,
):
-
self.label = MathTex(label) if isinstance(label, str) else label
equals = MathTex("=").next_to(self.label, RIGHT)
self.label.add(equals)
diff --git a/manim/mobject/text/tex_mobject.py b/manim/mobject/text/tex_mobject.py
index 92a4bd2cc..649b5f8c7 100644
--- a/manim/mobject/text/tex_mobject.py
+++ b/manim/mobject/text/tex_mobject.py
@@ -66,7 +66,6 @@ class SingleStringMathTex(SVGMobject):
font_size: float = DEFAULT_FONT_SIZE,
**kwargs,
):
-
if kwargs.get("color") is None:
# makes it so that color isn't explicitly passed for these mobs,
# and can instead inherit from the parent
@@ -510,7 +509,6 @@ class Title(Tex):
underline_buff=MED_SMALL_BUFF,
**kwargs,
):
-
self.include_underline = include_underline
self.match_underline_width_to_text = match_underline_width_to_text
self.underline_buff = underline_buff
diff --git a/manim/mobject/text/text_mobject.py b/manim/mobject/text/text_mobject.py
index 471e74c13..709a2fb27 100644
--- a/manim/mobject/text/text_mobject.py
+++ b/manim/mobject/text/text_mobject.py
@@ -426,7 +426,6 @@ class Text(SVGMobject):
disable_ligatures: bool = False,
**kwargs,
) -> None:
-
self.line_spacing = line_spacing
self.font = font
self._font_size = float(font_size)
@@ -1097,7 +1096,6 @@ class MarkupText(SVGMobject):
disable_ligatures: bool = False,
**kwargs,
) -> None:
-
self.text = text
self.line_spacing = line_spacing
self.font = font
diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.py
index 36bf14626..b5cf76ec0 100644
--- a/manim/mobject/types/vectorized_mobject.py
+++ b/manim/mobject/types/vectorized_mobject.py
@@ -2410,7 +2410,6 @@ class DashedVMobject(VMobject, metaclass=ConvertToOpenGL):
equal_lengths=True,
**kwargs,
):
-
self.dashed_ratio = dashed_ratio
self.num_dashes = num_dashes
super().__init__(color=color, **kwargs)
diff --git a/manim/renderer/shader_wrapper.py b/manim/renderer/shader_wrapper.py
index 8eff1772c..6b38b1b53 100644
--- a/manim/renderer/shader_wrapper.py
+++ b/manim/renderer/shader_wrapper.py
@@ -125,7 +125,7 @@ class ShaderWrapper:
def replace_code(self, old, new):
code_map = self.program_code
- for (name, _code) in code_map.items():
+ for name, _code in code_map.items():
if code_map[name] is None:
continue
code_map[name] = re.sub(old, new, code_map[name])
diff --git a/manim/scene/vector_space_scene.py b/manim/scene/vector_space_scene.py
index f0bdd351b..339beb1c0 100644
--- a/manim/scene/vector_space_scene.py
+++ b/manim/scene/vector_space_scene.py
@@ -585,7 +585,6 @@ class LinearTransformationScene(VectorScene):
leave_ghost_vectors: bool = False,
**kwargs,
):
-
super().__init__(**kwargs)
self.include_background_plane = include_background_plane
diff --git a/scripts/dev_changelog.py b/scripts/dev_changelog.py
index f84dbb1ca..5043a4f8c 100755
--- a/scripts/dev_changelog.py
+++ b/scripts/dev_changelog.py
@@ -183,7 +183,6 @@ def get_summary(body):
try:
has_changelog_pattern = re.search(pattern, body)
if has_changelog_pattern:
-
return has_changelog_pattern.group()[22:-21].strip()
except Exception:
print(f"Error parsing body for changelog: {body}")
diff --git a/tests/module/mobject/graphing/test_coordinate_system.py b/tests/module/mobject/graphing/test_coordinate_system.py
index c01946322..fd86a9bd4 100644
--- a/tests/module/mobject/graphing/test_coordinate_system.py
+++ b/tests/module/mobject/graphing/test_coordinate_system.py
@@ -63,7 +63,6 @@ def test_NumberPlane():
]
for test_data in testing_data:
-
x_range, y_range = test_data
x_start, x_end = x_range
diff --git a/tests/module/mobject/mobject/test_family.py b/tests/module/mobject/mobject/test_family.py
index 90b55ebff..08856b653 100644
--- a/tests/module/mobject/mobject/test_family.py
+++ b/tests/module/mobject/mobject/test_family.py
@@ -40,7 +40,11 @@ def test_family():
def test_overlapping_family():
"""Check that each member of the family is only gathered once."""
- mob, child1, child2, = (
+ (
+ mob,
+ child1,
+ child2,
+ ) = (
Mobject(),
Mobject(),
Mobject(),
@@ -64,7 +68,11 @@ def test_shift_family():
"""
# Note shift() needs the mobject to have a non-empty `points` attribute, so
# we cannot use a plain Mobject or VMobject. We use Circle instead.
- mob, child1, child2, = (
+ (
+ mob,
+ child1,
+ child2,
+ ) = (
Circle(),
Circle(),
Circle(),
diff --git a/tests/module/scene/test_auto_zoom.py b/tests/module/scene/test_auto_zoom.py
index ad5da943b..76c17231f 100644
--- a/tests/module/scene/test_auto_zoom.py
+++ b/tests/module/scene/test_auto_zoom.py
@@ -4,7 +4,6 @@ from manim import *
def test_zoom():
-
s1 = Square()
s1.set_x(-10)
s2 = Square()
diff --git a/tests/opengl/test_coordinate_system_opengl.py b/tests/opengl/test_coordinate_system_opengl.py
index fb0a51748..603f8eba5 100644
--- a/tests/opengl/test_coordinate_system_opengl.py
+++ b/tests/opengl/test_coordinate_system_opengl.py
@@ -69,7 +69,6 @@ def test_NumberPlane(using_opengl_renderer):
]
for test_data in testing_data:
-
x_range, y_range, x_vals, y_vals = test_data
x_start, x_end = x_range
diff --git a/tests/opengl/test_family_opengl.py b/tests/opengl/test_family_opengl.py
index 96a4814d7..f16d0e475 100644
--- a/tests/opengl/test_family_opengl.py
+++ b/tests/opengl/test_family_opengl.py
@@ -41,7 +41,11 @@ def test_family(using_opengl_renderer):
def test_overlapping_family(using_opengl_renderer):
"""Check that each member of the family is only gathered once."""
- mob, child1, child2, = (
+ (
+ mob,
+ child1,
+ child2,
+ ) = (
OpenGLMobject(),
OpenGLMobject(),
OpenGLMobject(),
@@ -65,7 +69,11 @@ def test_shift_family(using_opengl_renderer):
"""
# Note shift() needs the OpenGLMobject to have a non-empty `points` attribute, so
# we cannot use a plain OpenGLMobject or OpenGLVMobject. We use Circle instead.
- mob, child1, child2, = (
+ (
+ mob,
+ child1,
+ child2,
+ ) = (
Circle(),
Circle(),
Circle(),
diff --git a/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py b/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py
index d3ecb1cf2..e9a5d7e96 100644
--- a/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py
+++ b/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py
@@ -50,7 +50,7 @@ def test_resolution_flag(tmp_path, manim_cfg_file, simple_scenes_path):
# (800, 600, ";"),
]
- for (width, height, separator) in resolutions:
+ for width, height, separator in resolutions:
command = [
sys.executable,
"-m",
diff --git a/tests/test_scene_rendering/test_cli_flags.py b/tests/test_scene_rendering/test_cli_flags.py
index d8c76c020..aaee0276a 100644
--- a/tests/test_scene_rendering/test_cli_flags.py
+++ b/tests/test_scene_rendering/test_cli_flags.py
@@ -48,7 +48,7 @@ def test_resolution_flag(tmp_path, manim_cfg_file, simple_scenes_path):
# (800, 600, ";"),
]
- for (width, height, separator) in resolutions:
+ for width, height, separator in resolutions:
command = [
sys.executable,
"-m",