Skip to content

Commit 24025b6

Browse files
pre-commit change to ruff (#3779)
* pre-commit change to ruff * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixes * astral-sh ruff bump --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 21eb0b7 commit 24025b6

File tree

22 files changed

+113
-88
lines changed

22 files changed

+113
-88
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,11 @@ repos:
3434
hooks:
3535
- id: python-check-blanket-noqa
3636
name: Precision flake ignores
37-
- repo: https://github.com/psf/black
38-
rev: 24.4.2
37+
- repo: https://github.com/astral-sh/ruff-pre-commit
38+
rev: v0.4.4
3939
hooks:
40-
- id: black
41-
- repo: https://github.com/asottile/blacken-docs
42-
rev: 1.16.0
43-
hooks:
44-
- id: blacken-docs
45-
additional_dependencies: [black==24.4.0]
46-
exclude: ^\.github/
40+
- id: ruff-format
41+
types: [python]
4742
- repo: https://github.com/PyCQA/flake8
4843
rev: 7.0.0
4944
hooks:

example_scenes/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def construct(self):
153153
],
154154
color=PURPLE_B,
155155
fill_opacity=1,
156-
stroke_width=0
156+
stroke_width=0,
157157
).shift(UP + 2 * RIGHT)
158158
shapes = VGroup(triangle, square, circle, pentagon, pi)
159159
self.play(SpiralIn(shapes, fade_in_fraction=0.9))

manim/_config/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def tempconfig(temp: ManimConfig | dict[str, Any]) -> Generator[None, None, None
6868
8.0
6969
>>> with tempconfig({"frame_height": 100.0}):
7070
... print(config["frame_height"])
71-
...
7271
100.0
7372
>>> config["frame_height"]
7473
8.0

manim/_config/cli_colors.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ def parse_cli_ctx(parser: configparser.SectionProxy) -> Context:
3535
theme = parser["theme"] if parser["theme"] else None
3636
if theme is None:
3737
formatter = HelpFormatter.settings(
38-
theme=HelpTheme(**theme_settings), **formatter_settings # type: ignore[arg-type]
38+
theme=HelpTheme(**theme_settings),
39+
**formatter_settings, # type: ignore[arg-type]
3940
)
4041
elif theme.lower() == "dark":
4142
formatter = HelpFormatter.settings(
42-
theme=HelpTheme.dark().with_(**theme_settings), **formatter_settings # type: ignore[arg-type]
43+
theme=HelpTheme.dark().with_(**theme_settings),
44+
**formatter_settings, # type: ignore[arg-type]
4345
)
4446
elif theme.lower() == "light":
4547
formatter = HelpFormatter.settings(
46-
theme=HelpTheme.light().with_(**theme_settings), **formatter_settings # type: ignore[arg-type]
48+
theme=HelpTheme.light().with_(**theme_settings),
49+
**formatter_settings, # type: ignore[arg-type]
4750
)
4851

4952
return Context.settings(

manim/mobject/geometry/tips.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,9 @@ class ArrowTip(VMobject, metaclass=ConvertToOpenGL):
6060
... RegularPolygon.__init__(self, n=5, **kwargs)
6161
... self.width = length
6262
... self.stretch_to_fit_height(length)
63-
>>> arr = Arrow(np.array([-2, -2, 0]), np.array([2, 2, 0]),
64-
... tip_shape=MyCustomArrowTip)
63+
>>> arr = Arrow(
64+
... np.array([-2, -2, 0]), np.array([2, 2, 0]), tip_shape=MyCustomArrowTip
65+
... )
6566
>>> isinstance(arr.tip, RegularPolygon)
6667
True
6768
>>> from manim import Scene, Create

manim/mobject/graph.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,8 @@ def expand_vertex(self, g, vertex_id: str, depth: int):
15131513
*new_edges,
15141514
vertex_config=self.VERTEX_CONF,
15151515
positions={
1516-
k: g.vertices[vertex_id].get_center() + 0.1 * DOWN for k in new_vertices
1516+
k: g.vertices[vertex_id].get_center() + 0.1 * DOWN
1517+
for k in new_vertices
15171518
},
15181519
)
15191520
if depth < self.DEPTH:

manim/mobject/graphing/coordinate_systems.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,9 @@ def add_coordinates(
394394
ax = ThreeDAxes()
395395
x_labels = range(-4, 5)
396396
z_labels = range(-4, 4, 2)
397-
ax.add_coordinates(x_labels, None, z_labels) # default y labels, custom x & z labels
397+
ax.add_coordinates(
398+
x_labels, None, z_labels
399+
) # default y labels, custom x & z labels
398400
ax.add_coordinates(x_labels) # only x labels
399401
400402
You can also specifically control the position and value of the labels using a dict.
@@ -405,7 +407,15 @@ def add_coordinates(
405407
x_pos = [x for x in range(1, 8)]
406408
407409
# strings are automatically converted into a Tex mobject.
408-
x_vals = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
410+
x_vals = [
411+
"Monday",
412+
"Tuesday",
413+
"Wednesday",
414+
"Thursday",
415+
"Friday",
416+
"Saturday",
417+
"Sunday",
418+
]
409419
x_dict = dict(zip(x_pos, x_vals))
410420
ax.add_coordinates(x_dict)
411421
"""

manim/mobject/graphing/number_line.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ def number_to_point(self, number: float | np.ndarray) -> np.ndarray:
364364
array([0., 0., 0.])
365365
>>> number_line.number_to_point(1)
366366
array([1., 0., 0.])
367-
>>> number_line.number_to_point([1,2,3])
367+
>>> number_line.number_to_point([1, 2, 3])
368368
array([[1., 0., 0.],
369369
[2., 0., 0.],
370370
[3., 0., 0.]])
@@ -396,11 +396,11 @@ def point_to_number(self, point: Sequence[float]) -> float:
396396
397397
>>> from manim import NumberLine
398398
>>> number_line = NumberLine()
399-
>>> number_line.point_to_number((0,0,0))
399+
>>> number_line.point_to_number((0, 0, 0))
400400
0.0
401-
>>> number_line.point_to_number((1,0,0))
401+
>>> number_line.point_to_number((1, 0, 0))
402402
1.0
403-
>>> number_line.point_to_number([[0.5,0,0],[1,0,0],[1.5,0,0]])
403+
>>> number_line.point_to_number([[0.5, 0, 0], [1, 0, 0], [1.5, 0, 0]])
404404
array([0.5, 1. , 1.5])
405405
406406
"""

manim/mobject/mobject.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ def get_critical_point(self, direction: Vector3D) -> Point3D:
20642064
20652065
::
20662066
2067-
sample = Arc(start_angle=PI/7, angle = PI/5)
2067+
sample = Arc(start_angle=PI / 7, angle=PI / 5)
20682068
20692069
# These are all equivalent
20702070
max_y_1 = sample.get_top()[1]

manim/mobject/text/text_mobject.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,17 @@ class Paragraph(VGroup):
135135
--------
136136
Normal usage::
137137
138-
paragraph = Paragraph('this is a awesome', 'paragraph',
139-
'With \nNewlines', '\tWith Tabs',
140-
' With Spaces', 'With Alignments',
141-
'center', 'left', 'right')
138+
paragraph = Paragraph(
139+
"this is a awesome",
140+
"paragraph",
141+
"With \nNewlines",
142+
"\tWith Tabs",
143+
" With Spaces",
144+
"With Alignments",
145+
"center",
146+
"left",
147+
"right",
148+
)
142149
143150
Remove unwanted invisible characters::
144151
@@ -1305,15 +1312,13 @@ def add_line_to(end):
13051312
self.set_color_by_gradient(*self.gradient)
13061313
for col in colormap:
13071314
self.chars[
1308-
col["start"]
1309-
- col["start_offset"] : col["end"]
1315+
col["start"] - col["start_offset"] : col["end"]
13101316
- col["start_offset"]
13111317
- col["end_offset"]
13121318
].set_color(self._parse_color(col["color"]))
13131319
for grad in gradientmap:
13141320
self.chars[
1315-
grad["start"]
1316-
- grad["start_offset"] : grad["end"]
1321+
grad["start"] - grad["start_offset"] : grad["end"]
13171322
- grad["start_offset"]
13181323
- grad["end_offset"]
13191324
].set_color_by_gradient(

0 commit comments

Comments
 (0)