Skip to content

Commit 890b91f

Browse files
chore: use ruff + linting errors
1 parent 7399585 commit 890b91f

File tree

130 files changed

+954
-1036
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+954
-1036
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,52 +12,20 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: check-toml
1414
name: Validate Poetry
15-
- repo: https://github.com/pycqa/isort
16-
rev: 5.13.2
17-
hooks:
18-
- id: isort
19-
name: isort (python)
20-
- id: isort
21-
name: isort (cython)
22-
types: [cython]
23-
- id: isort
24-
name: isort (pyi)
25-
types: [pyi]
26-
- repo: https://github.com/asottile/pyupgrade
27-
rev: v3.15.2
28-
hooks:
29-
- id: pyupgrade
30-
name: Update code to new python versions
31-
args: [--py39-plus]
3215
- repo: https://github.com/pre-commit/pygrep-hooks
3316
rev: v1.10.0
3417
hooks:
3518
- id: python-check-blanket-noqa
3619
name: Precision flake ignores
37-
- repo: https://github.com/psf/black
38-
rev: 24.4.2
39-
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/
47-
- repo: https://github.com/PyCQA/flake8
48-
rev: 7.0.0
49-
hooks:
50-
- id: flake8
51-
additional_dependencies:
52-
[
53-
flake8-bugbear==21.4.3,
54-
flake8-builtins==1.5.3,
55-
flake8-comprehensions>=3.6.1,
56-
flake8-docstrings==1.6.0,
57-
flake8-pytest-style==1.5.0,
58-
flake8-rst-docstrings==0.2.3,
59-
flake8-simplify==0.14.1,
60-
]
20+
- repo: https://github.com/astral-sh/ruff-pre-commit
21+
rev: v0.3.5
22+
hooks:
23+
- id: ruff
24+
args: [ "--fix", "--exit-non-zero-on-fix"]
25+
name: ruff lint
26+
types: [python]
27+
- id: ruff-format
28+
types: [python]
6129
- repo: https://github.com/pre-commit/mirrors-mypy
6230
rev: v1.10.0
6331
hooks:
@@ -77,4 +45,6 @@ repos:
7745
hooks:
7846
- id: codespell
7947
files: ^.*\.(py|md|rst)$
80-
args: ["-L", "medias,nam"]
48+
# for pyproject configuration (remove python>=3.11)
49+
additional_dependencies:
50+
- tomli

conftest.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55

66
from __future__ import annotations
77

8-
try:
9-
# https://github.com/moderngl/moderngl/issues/517
10-
import readline # required to prevent a segfault on Python 3.10
11-
except ModuleNotFoundError: # windows
12-
pass
8+
import contextlib
9+
10+
with contextlib.suppress(ModuleNotFoundError):
11+
import readline # noqa: F401
1312

1413
import cairo
1514
import moderngl

docs/rtd-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
jupyterlab
22
sphinxcontrib-programoutput
3+
pytest

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# -- Project information -----------------------------------------------------
2727

2828
project = "Manim"
29-
copyright = f"2020-{datetime.now().year}, The Manim Community Dev Team"
29+
copyright = f"2020-{datetime.now().year}, The Manim Community Dev Team" # noqa: A001
3030
author = "The Manim Community Dev Team"
3131

3232

@@ -63,7 +63,7 @@
6363
alias_name: f"~manim.{module}.{alias_name}"
6464
for module, module_dict in ALIAS_DOCS_DICT.items()
6565
for category_dict in module_dict.values()
66-
for alias_name in category_dict.keys()
66+
for alias_name in category_dict
6767
}
6868
autoclass_content = "both"
6969

example_scenes/advanced_tex_fonts.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from manim import *
24

35
# French Cursive LaTeX font example from http://jf.burnol.free.fr/showcase.html

example_scenes/basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
2+
from __future__ import annotations
33

44
from manim import *
55

@@ -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))

example_scenes/customtex.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import annotations
2+
13
from manim import *
24

35

example_scenes/opengl.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
from __future__ import annotations
2+
13
from pathlib import Path
24

3-
import manim.utils.opengl as opengl
45
from manim import *
5-
from manim.opengl import * # type: ignore
6+
from manim.opengl import *
7+
from manim.utils import opengl
68

79
# Copied from https://3b1b.github.io/manim/getting_started/example_scenes.html#surfaceexample.
810
# Lines that do not yet work with the Community Version are commented.

manim/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
__version__ = version(__name__)
77

88

9+
# ruff: noqa: F401
910
# isort: off
1011

1112
# Importing the config module should be the first thing we do, since other

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

0 commit comments

Comments
 (0)