Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #4035

Merged
merged 4 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: check-toml
name: Validate Poetry
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0
rev: v0.9.1
hooks:
- id: ruff
name: ruff lint
Expand All @@ -22,7 +22,7 @@ repos:
- id: ruff-format
types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
6 changes: 3 additions & 3 deletions manim/animation/speedmodifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def __init__(
self.anim = self.setup(anim)

if affects_speed_updaters:
assert (
ChangeSpeed.is_changing_dt is False
), "Only one animation at a time can play that changes speed (dt) for ChangeSpeed updaters"
assert ChangeSpeed.is_changing_dt is False, (
"Only one animation at a time can play that changes speed (dt) for ChangeSpeed updaters"
)
ChangeSpeed.is_changing_dt = True
self.t = 0
self.affects_speed_updaters = affects_speed_updaters
Expand Down
2 changes: 1 addition & 1 deletion manim/animation/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ def __init__(self, mobject: Mobject, **kwargs) -> None:
def check_validity_of_input(self, mobject: Mobject) -> None:
if not hasattr(mobject, "target"):
raise ValueError(
"MoveToTarget called on mobject" "without attribute 'target'",
"MoveToTarget called on mobjectwithout attribute 'target'",
)


Expand Down
2 changes: 1 addition & 1 deletion manim/cli/render/render_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def validate_resolution(
+ ", ".join(
reversed(
[
f'{q["pixel_width"]}x{q["pixel_height"]} {q["frame_rate"]}FPS'
f"{q['pixel_width']}x{q['pixel_height']} {q['frame_rate']}FPS"
for q in QUALITIES.values()
if q["flag"]
]
Expand Down
4 changes: 3 additions & 1 deletion manim/mobject/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,9 @@ class LargeTreeGeneration(MovingCameraScene):
VERTEX_CONF = {"radius": 0.25, "color": BLUE_B, "fill_opacity": 1}

def expand_vertex(self, g, vertex_id: str, depth: int):
new_vertices = [f"{vertex_id}/{i}" for i in range(self.CHILDREN_PER_VERTEX)]
new_vertices = [
f"{vertex_id}/{i}" for i in range(self.CHILDREN_PER_VERTEX)
]
new_edges = [(vertex_id, child_id) for child_id in new_vertices]
g.add_edges(
*new_edges,
Expand Down
6 changes: 3 additions & 3 deletions manim/mobject/graphing/coordinate_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -3235,7 +3235,7 @@ def get_coordinate_labels(
elif self.azimuth_units == "degrees":
a_tex = [
MathTex(
f'{360 * i["label"]:g}' + r"^{\circ}",
f"{360 * i['label']:g}" + r"^{\circ}",
font_size=self.azimuth_label_font_size,
).next_to(
i["point"],
Expand All @@ -3248,7 +3248,7 @@ def get_coordinate_labels(
elif self.azimuth_units == "gradians":
a_tex = [
MathTex(
f'{400 * i["label"]:g}' + r"^{g}",
f"{400 * i['label']:g}" + r"^{g}",
font_size=self.azimuth_label_font_size,
).next_to(
i["point"],
Expand All @@ -3261,7 +3261,7 @@ def get_coordinate_labels(
elif self.azimuth_units is None:
a_tex = [
MathTex(
f'{i["label"]:g}',
f"{i['label']:g}",
font_size=self.azimuth_label_font_size,
).next_to(
i["point"],
Expand Down
7 changes: 4 additions & 3 deletions manim/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,9 @@ def animate(self) -> _AnimationBuilder | Self:

::

self.play(my_mobject.animate.shift(RIGHT), my_mobject.animate.rotate(PI))
self.play(
my_mobject.animate.shift(RIGHT), my_mobject.animate.rotate(PI)
)

make use of method chaining.

Expand Down Expand Up @@ -3070,8 +3072,7 @@ def __getattr__(self, method_name) -> types.MethodType:

if (self.is_chaining and has_overridden_animation) or self.overridden_animation:
raise NotImplementedError(
"Method chaining is currently not supported for "
"overridden animations",
"Method chaining is currently not supported for overridden animations",
)

def update_target(*method_args, **method_kwargs):
Expand Down
7 changes: 4 additions & 3 deletions manim/mobject/opengl/opengl_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ def animate(self) -> _AnimationBuilder | Self:

::

self.play(my_mobject.animate.shift(RIGHT), my_mobject.animate.rotate(PI))
self.play(
my_mobject.animate.shift(RIGHT), my_mobject.animate.rotate(PI)
)

make use of method chaining for ``animate``, meaning::

Expand Down Expand Up @@ -2957,8 +2959,7 @@ def __getattr__(self, method_name: str) -> Callable[..., Self]:

if (self.is_chaining and has_overridden_animation) or self.overridden_animation:
raise NotImplementedError(
"Method chaining is currently not supported for "
"overridden animations",
"Method chaining is currently not supported for overridden animations",
)

def update_target(*method_args, **method_kwargs):
Expand Down
4 changes: 2 additions & 2 deletions manim/mobject/text/text_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def _merge_settings(
default = default_args[arg]
if left != default and getattr(right_setting, arg) != default:
raise ValueError(
f"Ambiguous style for text '{self.text[right_setting.start:right_setting.end]}':"
f"Ambiguous style for text '{self.text[right_setting.start : right_setting.end]}':"
+ f"'{arg}' cannot be both '{left}' and '{right}'."
)
setattr(right_setting, arg, left if left != default else right)
Expand Down Expand Up @@ -1561,7 +1561,7 @@ def register_font(font_file: str | Path):
logger.debug("Found file at %s", file_path.absolute())
break
else:
error = f"Can't find {font_file}." f"Tried these : {possible_paths}"
error = f"Can't find {font_file}.Tried these : {possible_paths}"
raise FileNotFoundError(error)

try:
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/types/vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ def __init__(
self.add(*vmobjects)

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

def __str__(self) -> str:
return (
Expand Down
4 changes: 3 additions & 1 deletion manim/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ def baz(self):
from manim.utils.deprecation import deprecated


@deprecated(since="v0.2", until="v0.4", replacement="bar", message="It is cooler.")
@deprecated(
since="v0.2", until="v0.4", replacement="bar", message="It is cooler."
)
def foo():
pass

Expand Down
2 changes: 1 addition & 1 deletion manim/utils/docbuild/manim_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def run(self) -> list[nodes.Element]:
ref_block = "References: " + " ".join(ref_content) if ref_content else ""

if "quality" in self.options:
quality = f'{self.options["quality"]}_quality'
quality = f"{self.options['quality']}_quality"
else:
quality = "example_quality"
frame_rate = QUALITIES[quality]["frame_rate"]
Expand Down
6 changes: 3 additions & 3 deletions manim/utils/qhull.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ def initialize(self, points: PointND_Array) -> None:
self.neighbors.setdefault(sf, set()).add(f)

def classify(self, facet: Facet) -> None:
assert (
self.unclaimed is not None
), "Call .initialize() before using .classify()."
assert self.unclaimed is not None, (
"Call .initialize() before using .classify()."
)

if not self.unclaimed.size:
self.outside[facet] = (None, None)
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ select = [
]

ignore = [
# (sub)module shadows standard library module
"A005",
# mutable argument defaults (too many changes)
"B006",
# No function calls in defaults
Expand Down
6 changes: 3 additions & 3 deletions tests/interface/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def test_manim_checkhealth_subcommand():
result = runner.invoke(main, command)
output_lines = result.output.split("\n")
num_passed = len([line for line in output_lines if "PASSED" in line])
assert num_passed == len(
HEALTH_CHECKS
), f"Some checks failed! Full output:\n{result.output}"
assert num_passed == len(HEALTH_CHECKS), (
f"Some checks failed! Full output:\n{result.output}"
)
assert "No problems detected, your installation seems healthy!" in output_lines


Expand Down
6 changes: 3 additions & 3 deletions tests/module/mobject/graphing/test_number_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def test_add_labels():
dict(zip(list(range(-3, 3)), [Integer(m) for m in range(-1, 5)])),
)
actual_label_length = len(num_line.labels)
assert (
actual_label_length == expected_label_length
), f"Expected a VGroup with {expected_label_length} integers but got {actual_label_length}."
assert actual_label_length == expected_label_length, (
f"Expected a VGroup with {expected_label_length} integers but got {actual_label_length}."
)


def test_number_to_point():
Expand Down
4 changes: 3 additions & 1 deletion tests/module/mobject/text/test_markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def test_special_tags_markup():
success = True
except ValueError:
success = False
assert success, '\'<color col="RED">foo</color>\' and \'<gradient from="RED" to="YELLOW">foo</gradient>\' should not fail validation'
assert success, (
'\'<color col="RED">foo</color>\' and \'<gradient from="RED" to="YELLOW">foo</gradient>\' should not fail validation'
)


def test_unbalanced_tag_markup():
Expand Down
4 changes: 3 additions & 1 deletion tests/opengl/test_markup_opengl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def test_special_tags_markup(using_opengl_renderer):
success = True
except ValueError:
success = False
assert success, '\'<color col="RED">foo</color>\' and \'<gradient from="RED" to="YELLOW">foo</gradient>\' should not fail validation'
assert success, (
'\'<color col="RED">foo</color>\' and \'<gradient from="RED" to="YELLOW">foo</gradient>\' should not fail validation'
)


def test_unbalanced_tag_markup(using_opengl_renderer):
Expand Down
6 changes: 3 additions & 3 deletions tests/opengl/test_number_line_opengl.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,6 @@ def test_add_labels():
dict(zip(list(range(-3, 3)), [Integer(m) for m in range(-1, 5)])),
)
actual_label_length = len(num_line.labels)
assert (
actual_label_length == expected_label_length
), f"Expected a VGroup with {expected_label_length} integers but got {actual_label_length}."
assert actual_label_length == expected_label_length, (
f"Expected a VGroup with {expected_label_length} integers but got {actual_label_length}."
)
24 changes: 12 additions & 12 deletions tests/test_graphical_units/test_threed.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ def test_Cone_get_start_and_get_end():
cone = Cone().shift(RIGHT).rotate(PI / 4, about_point=ORIGIN, about_edge=OUT)
start = [0.70710678, 0.70710678, -1.0]
end = [0.70710678, 0.70710678, 0.0]
assert np.allclose(
cone.get_start(), start, atol=0.01
), "start points of Cone do not match"
assert np.allclose(
cone.get_end(), end, atol=0.01
), "end points of Cone do not match"
assert np.allclose(cone.get_start(), start, atol=0.01), (
"start points of Cone do not match"
)
assert np.allclose(cone.get_end(), end, atol=0.01), (
"end points of Cone do not match"
)


@frames_comparison(base_scene=ThreeDScene)
Expand Down Expand Up @@ -166,9 +166,9 @@ def param_surface(u, v):
def test_get_start_and_end_Arrow3d():
start, end = ORIGIN, np.array([2, 1, 0])
arrow = Arrow3D(start, end)
assert np.allclose(
arrow.get_start(), start, atol=0.01
), "start points of Arrow3D do not match"
assert np.allclose(
arrow.get_end(), end, atol=0.01
), "end points of Arrow3D do not match"
assert np.allclose(arrow.get_start(), start, atol=0.01), (
"start points of Arrow3D do not match"
)
assert np.allclose(arrow.get_end(), end, atol=0.01), (
"end points of Arrow3D do not match"
)
22 changes: 12 additions & 10 deletions tests/test_scene_rendering/opengl/test_cli_flags_opengl.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ def test_no_image_output_with_interactive_embed(
assert not exists, "running manim with static scene rendered a video"

is_empty = not any((tmp_path / "images" / "simple_scenes").iterdir())
assert (
is_empty
), "running manim static scene with interactive embed rendered an image"
assert is_empty, (
"running manim static scene with interactive embed rendered an image"
)


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

is_empty = not any((tmp_path / "images" / "simple_scenes").iterdir())
assert (
is_empty
), "running manim static scene with interactive embed rendered an image"
assert is_empty, (
"running manim static scene with interactive embed rendered an image"
)


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

three_is_not_empty = (
tmp_path / "videos" / "infallible_scenes" / "480p15" / "Wait3.mp4"
).is_file()
assert (
three_is_not_empty
), "running manim with -a flag did not render the second scene"
assert three_is_not_empty, (
"running manim with -a flag did not render the second scene"
)


@pytest.mark.slow
Expand Down
10 changes: 6 additions & 4 deletions tests/test_scene_rendering/test_cli_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,16 @@ def test_a_flag(tmp_path, manim_cfg_file, infallible_scenes_path):
two_is_not_empty = (
tmp_path / "images" / "infallible_scenes" / f"Wait2_ManimCE_v{__version__}.png"
).is_file()
assert two_is_not_empty, "running manim with -a flag did not render an image, possible leak of the config dictionary."
assert two_is_not_empty, (
"running manim with -a flag did not render an image, possible leak of the config dictionary."
)

three_is_not_empty = (
tmp_path / "videos" / "infallible_scenes" / "480p15" / "Wait3.mp4"
).is_file()
assert (
three_is_not_empty
), "running manim with -a flag did not render the second scene"
assert three_is_not_empty, (
"running manim with -a flag did not render the second scene"
)


@pytest.mark.slow
Expand Down
Loading