Skip to content

Commit 97f818e

Browse files
[pre-commit.ci] pre-commit autoupdate (#4035)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.0 → v0.9.1](astral-sh/ruff-pre-commit@v0.8.0...v0.9.1) - [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.14.1](pre-commit/mirrors-mypy@v1.13.0...v1.14.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * enh: ignore ruff lint rule A005 (module shadowing standard library module) --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Benjamin Hackl <[email protected]>
1 parent c933c74 commit 97f818e

22 files changed

+78
-62
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
- id: check-toml
1414
name: Validate Poetry
1515
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: v0.8.0
16+
rev: v0.9.1
1717
hooks:
1818
- id: ruff
1919
name: ruff lint
@@ -22,7 +22,7 @@ repos:
2222
- id: ruff-format
2323
types: [python]
2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.13.0
25+
rev: v1.14.1
2626
hooks:
2727
- id: mypy
2828
additional_dependencies:

manim/animation/speedmodifier.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ def __init__(
113113
self.anim = self.setup(anim)
114114

115115
if affects_speed_updaters:
116-
assert (
117-
ChangeSpeed.is_changing_dt is False
118-
), "Only one animation at a time can play that changes speed (dt) for ChangeSpeed updaters"
116+
assert ChangeSpeed.is_changing_dt is False, (
117+
"Only one animation at a time can play that changes speed (dt) for ChangeSpeed updaters"
118+
)
119119
ChangeSpeed.is_changing_dt = True
120120
self.t = 0
121121
self.affects_speed_updaters = affects_speed_updaters

manim/animation/transform.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def __init__(self, mobject: Mobject, **kwargs) -> None:
429429
def check_validity_of_input(self, mobject: Mobject) -> None:
430430
if not hasattr(mobject, "target"):
431431
raise ValueError(
432-
"MoveToTarget called on mobject" "without attribute 'target'",
432+
"MoveToTarget called on mobjectwithout attribute 'target'",
433433
)
434434

435435

manim/cli/render/render_options.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def validate_resolution(
143143
+ ", ".join(
144144
reversed(
145145
[
146-
f'{q["pixel_width"]}x{q["pixel_height"]} {q["frame_rate"]}FPS'
146+
f"{q['pixel_width']}x{q['pixel_height']} {q['frame_rate']}FPS"
147147
for q in QUALITIES.values()
148148
if q["flag"]
149149
]

manim/mobject/graph.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,9 @@ class LargeTreeGeneration(MovingCameraScene):
15011501
VERTEX_CONF = {"radius": 0.25, "color": BLUE_B, "fill_opacity": 1}
15021502
15031503
def expand_vertex(self, g, vertex_id: str, depth: int):
1504-
new_vertices = [f"{vertex_id}/{i}" for i in range(self.CHILDREN_PER_VERTEX)]
1504+
new_vertices = [
1505+
f"{vertex_id}/{i}" for i in range(self.CHILDREN_PER_VERTEX)
1506+
]
15051507
new_edges = [(vertex_id, child_id) for child_id in new_vertices]
15061508
g.add_edges(
15071509
*new_edges,

manim/mobject/graphing/coordinate_systems.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3235,7 +3235,7 @@ def get_coordinate_labels(
32353235
elif self.azimuth_units == "degrees":
32363236
a_tex = [
32373237
MathTex(
3238-
f'{360 * i["label"]:g}' + r"^{\circ}",
3238+
f"{360 * i['label']:g}" + r"^{\circ}",
32393239
font_size=self.azimuth_label_font_size,
32403240
).next_to(
32413241
i["point"],
@@ -3248,7 +3248,7 @@ def get_coordinate_labels(
32483248
elif self.azimuth_units == "gradians":
32493249
a_tex = [
32503250
MathTex(
3251-
f'{400 * i["label"]:g}' + r"^{g}",
3251+
f"{400 * i['label']:g}" + r"^{g}",
32523252
font_size=self.azimuth_label_font_size,
32533253
).next_to(
32543254
i["point"],
@@ -3261,7 +3261,7 @@ def get_coordinate_labels(
32613261
elif self.azimuth_units is None:
32623262
a_tex = [
32633263
MathTex(
3264-
f'{i["label"]:g}',
3264+
f"{i['label']:g}",
32653265
font_size=self.azimuth_label_font_size,
32663266
).next_to(
32673267
i["point"],

manim/mobject/mobject.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ def animate(self) -> _AnimationBuilder | Self:
318318
319319
::
320320
321-
self.play(my_mobject.animate.shift(RIGHT), my_mobject.animate.rotate(PI))
321+
self.play(
322+
my_mobject.animate.shift(RIGHT), my_mobject.animate.rotate(PI)
323+
)
322324
323325
make use of method chaining.
324326
@@ -3070,8 +3072,7 @@ def __getattr__(self, method_name) -> types.MethodType:
30703072

30713073
if (self.is_chaining and has_overridden_animation) or self.overridden_animation:
30723074
raise NotImplementedError(
3073-
"Method chaining is currently not supported for "
3074-
"overridden animations",
3075+
"Method chaining is currently not supported for overridden animations",
30753076
)
30763077

30773078
def update_target(*method_args, **method_kwargs):

manim/mobject/opengl/opengl_mobject.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ def animate(self) -> _AnimationBuilder | Self:
401401
402402
::
403403
404-
self.play(my_mobject.animate.shift(RIGHT), my_mobject.animate.rotate(PI))
404+
self.play(
405+
my_mobject.animate.shift(RIGHT), my_mobject.animate.rotate(PI)
406+
)
405407
406408
make use of method chaining for ``animate``, meaning::
407409
@@ -2957,8 +2959,7 @@ def __getattr__(self, method_name: str) -> Callable[..., Self]:
29572959

29582960
if (self.is_chaining and has_overridden_animation) or self.overridden_animation:
29592961
raise NotImplementedError(
2960-
"Method chaining is currently not supported for "
2961-
"overridden animations",
2962+
"Method chaining is currently not supported for overridden animations",
29622963
)
29632964

29642965
def update_target(*method_args, **method_kwargs):

manim/mobject/text/text_mobject.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ def _merge_settings(
703703
default = default_args[arg]
704704
if left != default and getattr(right_setting, arg) != default:
705705
raise ValueError(
706-
f"Ambiguous style for text '{self.text[right_setting.start:right_setting.end]}':"
706+
f"Ambiguous style for text '{self.text[right_setting.start : right_setting.end]}':"
707707
+ f"'{arg}' cannot be both '{left}' and '{right}'."
708708
)
709709
setattr(right_setting, arg, left if left != default else right)
@@ -1561,7 +1561,7 @@ def register_font(font_file: str | Path):
15611561
logger.debug("Found file at %s", file_path.absolute())
15621562
break
15631563
else:
1564-
error = f"Can't find {font_file}." f"Tried these : {possible_paths}"
1564+
error = f"Can't find {font_file}.Tried these : {possible_paths}"
15651565
raise FileNotFoundError(error)
15661566

15671567
try:

manim/mobject/types/vectorized_mobject.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,7 @@ def __init__(
21192119
self.add(*vmobjects)
21202120

21212121
def __repr__(self) -> str:
2122-
return f'{self.__class__.__name__}({", ".join(str(mob) for mob in self.submobjects)})'
2122+
return f"{self.__class__.__name__}({', '.join(str(mob) for mob in self.submobjects)})"
21232123

21242124
def __str__(self) -> str:
21252125
return (

manim/utils/deprecation.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,9 @@ def baz(self):
160160
from manim.utils.deprecation import deprecated
161161
162162
163-
@deprecated(since="v0.2", until="v0.4", replacement="bar", message="It is cooler.")
163+
@deprecated(
164+
since="v0.2", until="v0.4", replacement="bar", message="It is cooler."
165+
)
164166
def foo():
165167
pass
166168

manim/utils/docbuild/manim_directive.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def run(self) -> list[nodes.Element]:
236236
ref_block = "References: " + " ".join(ref_content) if ref_content else ""
237237

238238
if "quality" in self.options:
239-
quality = f'{self.options["quality"]}_quality'
239+
quality = f"{self.options['quality']}_quality"
240240
else:
241241
quality = "example_quality"
242242
frame_rate = QUALITIES[quality]["frame_rate"]

manim/utils/qhull.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ def initialize(self, points: PointND_Array) -> None:
133133
self.neighbors.setdefault(sf, set()).add(f)
134134

135135
def classify(self, facet: Facet) -> None:
136-
assert (
137-
self.unclaimed is not None
138-
), "Call .initialize() before using .classify()."
136+
assert self.unclaimed is not None, (
137+
"Call .initialize() before using .classify()."
138+
)
139139

140140
if not self.unclaimed.size:
141141
self.outside[facet] = (None, None)

pyproject.toml

+2
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ select = [
155155
]
156156

157157
ignore = [
158+
# (sub)module shadows standard library module
159+
"A005",
158160
# mutable argument defaults (too many changes)
159161
"B006",
160162
# No function calls in defaults

tests/interface/test_commands.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def test_manim_checkhealth_subcommand():
7575
result = runner.invoke(main, command)
7676
output_lines = result.output.split("\n")
7777
num_passed = len([line for line in output_lines if "PASSED" in line])
78-
assert num_passed == len(
79-
HEALTH_CHECKS
80-
), f"Some checks failed! Full output:\n{result.output}"
78+
assert num_passed == len(HEALTH_CHECKS), (
79+
f"Some checks failed! Full output:\n{result.output}"
80+
)
8181
assert "No problems detected, your installation seems healthy!" in output_lines
8282

8383

tests/module/mobject/graphing/test_number_line.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def test_add_labels():
6565
dict(zip(list(range(-3, 3)), [Integer(m) for m in range(-1, 5)])),
6666
)
6767
actual_label_length = len(num_line.labels)
68-
assert (
69-
actual_label_length == expected_label_length
70-
), f"Expected a VGroup with {expected_label_length} integers but got {actual_label_length}."
68+
assert actual_label_length == expected_label_length, (
69+
f"Expected a VGroup with {expected_label_length} integers but got {actual_label_length}."
70+
)
7171

7272

7373
def test_number_to_point():

tests/module/mobject/text/test_markup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def test_special_tags_markup():
2222
success = True
2323
except ValueError:
2424
success = False
25-
assert success, '\'<color col="RED">foo</color>\' and \'<gradient from="RED" to="YELLOW">foo</gradient>\' should not fail validation'
25+
assert success, (
26+
'\'<color col="RED">foo</color>\' and \'<gradient from="RED" to="YELLOW">foo</gradient>\' should not fail validation'
27+
)
2628

2729

2830
def test_unbalanced_tag_markup():

tests/opengl/test_markup_opengl.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def test_special_tags_markup(using_opengl_renderer):
2222
success = True
2323
except ValueError:
2424
success = False
25-
assert success, '\'<color col="RED">foo</color>\' and \'<gradient from="RED" to="YELLOW">foo</gradient>\' should not fail validation'
25+
assert success, (
26+
'\'<color col="RED">foo</color>\' and \'<gradient from="RED" to="YELLOW">foo</gradient>\' should not fail validation'
27+
)
2628

2729

2830
def test_unbalanced_tag_markup(using_opengl_renderer):

tests/opengl/test_number_line_opengl.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ def test_add_labels():
6565
dict(zip(list(range(-3, 3)), [Integer(m) for m in range(-1, 5)])),
6666
)
6767
actual_label_length = len(num_line.labels)
68-
assert (
69-
actual_label_length == expected_label_length
70-
), f"Expected a VGroup with {expected_label_length} integers but got {actual_label_length}."
68+
assert actual_label_length == expected_label_length, (
69+
f"Expected a VGroup with {expected_label_length} integers but got {actual_label_length}."
70+
)

tests/test_graphical_units/test_threed.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ def test_Cone_get_start_and_get_end():
3737
cone = Cone().shift(RIGHT).rotate(PI / 4, about_point=ORIGIN, about_edge=OUT)
3838
start = [0.70710678, 0.70710678, -1.0]
3939
end = [0.70710678, 0.70710678, 0.0]
40-
assert np.allclose(
41-
cone.get_start(), start, atol=0.01
42-
), "start points of Cone do not match"
43-
assert np.allclose(
44-
cone.get_end(), end, atol=0.01
45-
), "end points of Cone do not match"
40+
assert np.allclose(cone.get_start(), start, atol=0.01), (
41+
"start points of Cone do not match"
42+
)
43+
assert np.allclose(cone.get_end(), end, atol=0.01), (
44+
"end points of Cone do not match"
45+
)
4646

4747

4848
@frames_comparison(base_scene=ThreeDScene)
@@ -166,9 +166,9 @@ def param_surface(u, v):
166166
def test_get_start_and_end_Arrow3d():
167167
start, end = ORIGIN, np.array([2, 1, 0])
168168
arrow = Arrow3D(start, end)
169-
assert np.allclose(
170-
arrow.get_start(), start, atol=0.01
171-
), "start points of Arrow3D do not match"
172-
assert np.allclose(
173-
arrow.get_end(), end, atol=0.01
174-
), "end points of Arrow3D do not match"
169+
assert np.allclose(arrow.get_start(), start, atol=0.01), (
170+
"start points of Arrow3D do not match"
171+
)
172+
assert np.allclose(arrow.get_end(), end, atol=0.01), (
173+
"end points of Arrow3D do not match"
174+
)

tests/test_scene_rendering/opengl/test_cli_flags_opengl.py

+12-10
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ def test_no_image_output_with_interactive_embed(
198198
assert not exists, "running manim with static scene rendered a video"
199199

200200
is_empty = not any((tmp_path / "images" / "simple_scenes").iterdir())
201-
assert (
202-
is_empty
203-
), "running manim static scene with interactive embed rendered an image"
201+
assert is_empty, (
202+
"running manim static scene with interactive embed rendered an image"
203+
)
204204

205205

206206
@pytest.mark.slow
@@ -227,9 +227,9 @@ def test_no_default_image_output_with_non_static_scene(
227227
assert not exists, "running manim with static scene rendered a video"
228228

229229
is_empty = not any((tmp_path / "images" / "simple_scenes").iterdir())
230-
assert (
231-
is_empty
232-
), "running manim static scene with interactive embed rendered an image"
230+
assert is_empty, (
231+
"running manim static scene with interactive embed rendered an image"
232+
)
233233

234234

235235
@pytest.mark.slow
@@ -342,14 +342,16 @@ def test_a_flag(tmp_path, manim_cfg_file, infallible_scenes_path):
342342
two_is_not_empty = (
343343
tmp_path / "images" / "infallible_scenes" / f"Wait2_ManimCE_v{__version__}.png"
344344
).is_file()
345-
assert two_is_not_empty, "running manim with -a flag did not render an image, possible leak of the config dictionary"
345+
assert two_is_not_empty, (
346+
"running manim with -a flag did not render an image, possible leak of the config dictionary"
347+
)
346348

347349
three_is_not_empty = (
348350
tmp_path / "videos" / "infallible_scenes" / "480p15" / "Wait3.mp4"
349351
).is_file()
350-
assert (
351-
three_is_not_empty
352-
), "running manim with -a flag did not render the second scene"
352+
assert three_is_not_empty, (
353+
"running manim with -a flag did not render the second scene"
354+
)
353355

354356

355357
@pytest.mark.slow

tests/test_scene_rendering/test_cli_flags.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,16 @@ def test_a_flag(tmp_path, manim_cfg_file, infallible_scenes_path):
239239
two_is_not_empty = (
240240
tmp_path / "images" / "infallible_scenes" / f"Wait2_ManimCE_v{__version__}.png"
241241
).is_file()
242-
assert two_is_not_empty, "running manim with -a flag did not render an image, possible leak of the config dictionary."
242+
assert two_is_not_empty, (
243+
"running manim with -a flag did not render an image, possible leak of the config dictionary."
244+
)
243245

244246
three_is_not_empty = (
245247
tmp_path / "videos" / "infallible_scenes" / "480p15" / "Wait3.mp4"
246248
).is_file()
247-
assert (
248-
three_is_not_empty
249-
), "running manim with -a flag did not render the second scene"
249+
assert three_is_not_empty, (
250+
"running manim with -a flag did not render the second scene"
251+
)
250252

251253

252254
@pytest.mark.slow

0 commit comments

Comments
 (0)