[pre-commit.ci] pre-commit autoupdate (#3332)

* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.6.0)
- [github.com/pycqa/isort: 5.12.0 → 5.13.2](https://github.com/pycqa/isort/compare/5.12.0...5.13.2)
- [github.com/asottile/pyupgrade: v3.10.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.15.2)
- [github.com/psf/black: 23.7.0 → 24.4.0](https://github.com/psf/black/compare/23.7.0...24.4.0)
- [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](https://github.com/asottile/blacken-docs/compare/1.15.0...1.16.0)
- [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0)
- [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.1...v1.9.0)
- [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* make smoothererstep readable again, avoid overlong line

* zoom_value more readable

* fix blacken-docs touching .github

* fix codespell setup, remove unnecessary file, fix some typos

* flake8: ignore E704, triggered by overload

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update docs/source/tutorials/quickstart.rst

* more flake fixes

* try to make blacken-docs happy

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
This commit is contained in:
pre-commit-ci[bot] 2024-04-24 13:11:03 +02:00 committed by GitHub
commit 1aee37bfb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 102 additions and 96 deletions

View file

@ -1 +0,0 @@
<path id="nd" d="m 464.7,68.6 -1.1,2.8 .8,1.4 -.3,5.1 -.5,1.1 2.7,9.1 1.3,2.5 .7,14 1,2.7 -.4,5.8 2.9,7.4 .3,5.8 -.1,2.1 -29.5,-.4 -46,-2.1 -39.2,-2.9 5.2,-66.7 44.5,3.4 55.3,1.6 z">

5
.codespell_ignorewords Normal file
View file

@ -0,0 +1,5 @@
nam
sherif
falsy
medias
strager

View file

@ -1,4 +1,4 @@
[codespell]
exclude-file=.codespell_ignorelines
check-hidden=True
ignore-words-list = nam,sherif,falsy
check-hidden = True
skip = .git,*.js,*.js.map,*.css,*.css.map,*.html,*.po,*.pot,poetry.lock,*.log,*.svg
ignore-words = .codespell_ignorewords

View file

@ -18,6 +18,9 @@ extend-ignore = E203, W503, D202, D212, D213, D404
# Misc
F401, F403, F405, F841, E501, E731, E402, F811, F821,
# multiple statements on one line (overload)
E704,
# Plug-in: flake8-builtins
A001, A002, A003,

View file

@ -3,7 +3,7 @@ fail_fast: false
exclude: ^(manim/grpc/gen/|docs/i18n/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-ast
name: Validate Python
@ -13,7 +13,7 @@ repos:
- id: check-toml
name: Validate Poetry
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
name: isort (python)
@ -24,7 +24,7 @@ repos:
name: isort (pyi)
types: [pyi]
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.2
hooks:
- id: pyupgrade
name: Update code to new python versions
@ -35,16 +35,17 @@ repos:
- id: python-check-blanket-noqa
name: Precision flake ignores
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.4.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.15.0
rev: 1.16.0
hooks:
- id: blacken-docs
additional_dependencies: [black==22.3.0]
additional_dependencies: [black==24.4.0]
exclude: ^\.github/
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8
additional_dependencies:
@ -58,7 +59,7 @@ repos:
flake8-simplify==0.14.1,
]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies:
@ -72,7 +73,7 @@ repos:
files: ^manim/
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
files: ^.*\.(py|md|rst)$

View file

@ -77,8 +77,7 @@ Example:
The mobject linked to this instance.
"""
def __init__(name: str, id: int, singleton: MyClass, mobj: Mobject = None):
...
def __init__(name: str, id: int, singleton: MyClass, mobj: Mobject = None): ...
2. The usage of ``Parameters`` on functions to specify how
every parameter works and what it does. This should be excluded if

View file

@ -84,8 +84,7 @@ Typing guidelines
T = TypeVar("T")
def copy(self: T) -> T:
...
def copy(self: T) -> T: ...
* Use ``typing.Iterable`` whenever the function works with *any* iterable, not a specific type.

View file

@ -38,6 +38,7 @@ and then record it during rendering:
from manim_voiceover import VoiceoverScene
from manim_voiceover.services.recorder import RecorderService
# Simply inherit from VoiceoverScene instead of Scene to get all the
# voiceover functionality.
class RecorderExample(VoiceoverScene):

View file

@ -113,7 +113,7 @@ Now let's look at the next two lines:
class CreateCircle(Scene):
def construct(self):
...
[...]
Most of the time, the code for scripting an animation is entirely contained within
the :meth:`~.Scene.construct` method of a :class:`.Scene` class.

View file

@ -406,7 +406,7 @@ class InteractiveDevelopment(Scene):
self.play(Create(square))
self.wait()
# This opens an iPython termnial where you can keep writing
# This opens an iPython terminal where you can keep writing
# lines as if they were part of this construct method.
# In particular, 'square', 'circle' and 'self' will all be
# part of the local namespace in that terminal.

View file

@ -9,6 +9,7 @@ Both ``logger`` and ``console`` use the ``rich`` library to produce rich text
format.
"""
from __future__ import annotations
import configparser

View file

@ -9,6 +9,7 @@ movie vs writing a single frame).
See :doc:`/guides/configuration` for an introduction to Manim's configuration system.
"""
from __future__ import annotations
import argparse
@ -245,8 +246,7 @@ class ManimConfig(MutableMapping):
config.background_color = RED
class MyScene(Scene):
...
class MyScene(Scene): ...
the background color will be set to RED, regardless of the contents of
``manim.cfg`` or the CLI arguments used when invoking manim.
@ -1200,7 +1200,7 @@ class ManimConfig(MutableMapping):
@property
def upto_animation_number(self) -> int:
"""Stop rendering animations at this nmber. Use -1 to avoid skipping (-n)."""
"""Stop rendering animations at this number. Use -1 to avoid skipping (-n)."""
return self._d["upto_animation_number"]
@upto_animation_number.setter

View file

@ -1,6 +1,5 @@
"""Animate mobjects."""
from __future__ import annotations
from manim.mobject.opengl.opengl_mobject import OpenGLMobject

View file

@ -1,6 +1,5 @@
"""Tools for displaying multiple animations at once."""
from __future__ import annotations
import types

View file

@ -12,7 +12,6 @@
"""
from __future__ import annotations
__all__ = [

View file

@ -556,7 +556,7 @@ class Circumscribe(Succession):
mobject
The mobject to be circumscribed.
shape
The shape with which to surrond the given mobject. Should be either
The shape with which to surround the given mobject. Should be either
:class:`~.Rectangle` or :class:`~.Circle`
fade_in
Whether to make the surrounding shape to fade in. It will be drawn otherwise.

View file

@ -1,6 +1,5 @@
"""A camera converts the mobjects contained in a Scene into an array of pixels."""
from __future__ import annotations
__all__ = ["Camera", "BackgroundColoredVMobjectDisplayer"]

View file

@ -5,6 +5,7 @@ cfg``. Here you can specify options, subcommands, and subgroups for the cfg
group.
"""
from __future__ import annotations
from ast import literal_eval

View file

@ -9,6 +9,7 @@ In particular, this class is what allows ``manim`` to act as ``manim render``.
This library isn't used as a dependency as we need to inherit from ``cloup.Group`` instead
of ``click.Group``.
"""
import warnings
import cloup

View file

@ -5,6 +5,7 @@ init``. Here you can specify options, subcommands, and subgroups for the init
group.
"""
from __future__ import annotations
import configparser

View file

@ -5,6 +5,7 @@ plugin``. Here you can specify options, subcommands, and subgroups for the plugi
group.
"""
from __future__ import annotations
import cloup

View file

@ -5,6 +5,7 @@ Manim's render subcommand is accessed in the command-line interface via
can specify options, and arguments for the render command.
"""
from __future__ import annotations
import http.client

View file

@ -1,6 +1,5 @@
"""Mobjects that represent coordinate systems."""
from __future__ import annotations
__all__ = [
@ -441,8 +440,7 @@ class CoordinateSystem:
line_config: dict | None = ...,
color: ParsableManimColor | None = ...,
stroke_width: float = ...,
) -> DashedLine:
...
) -> DashedLine: ...
@overload
def get_line_from_axis_to_point(
@ -453,8 +451,7 @@ class CoordinateSystem:
line_config: dict | None = ...,
color: ParsableManimColor | None = ...,
stroke_width: float = ...,
) -> LineType:
...
) -> LineType: ...
def get_line_from_axis_to_point( # type: ignore[no-untyped-def]
self,
@ -855,9 +852,11 @@ class CoordinateSystem:
function: Callable[[float], float],
u_range: Sequence[float] | None = None,
v_range: Sequence[float] | None = None,
colorscale: Sequence[ParsableManimColor]
| Sequence[tuple[ParsableManimColor, float]]
| None = None,
colorscale: (
Sequence[ParsableManimColor]
| Sequence[tuple[ParsableManimColor, float]]
| None
) = None,
colorscale_axis: int = 2,
**kwargs: Any,
) -> Surface | OpenGLSurface:
@ -2653,14 +2652,12 @@ class NumberPlane(Axes):
def __init__(
self,
x_range: Sequence[float]
| None = (
x_range: Sequence[float] | None = (
-config["frame_x_radius"],
config["frame_x_radius"],
1,
),
y_range: Sequence[float]
| None = (
y_range: Sequence[float] | None = (
-config["frame_y_radius"],
config["frame_y_radius"],
1,

View file

@ -287,7 +287,7 @@ class Scene:
Examples
--------
A typical manim script includes a class derived from :class:`Scene` with an
overridden :meth:`Scene.contruct` method:
overridden :meth:`Scene.construct` method:
.. code-block:: python

View file

@ -283,16 +283,15 @@ class ThreeDScene(Scene):
frame_center = frame_center.get_center()
frame_center = list(frame_center)
zoom_value = None
if zoom is not None:
zoom_value = config.frame_height / (zoom * cam.height)
for value, method in [
[theta, "theta"],
[phi, "phi"],
[gamma, "gamma"],
[
config.frame_height / (zoom * cam.height)
if zoom is not None
else None,
"zoom",
],
[zoom_value, "zoom"],
[frame_center, "frame_center"],
]:
if value is not None:

View file

@ -261,13 +261,11 @@ def quadratic_bezier_remap(
@overload
def interpolate(start: float, end: float, alpha: float) -> float:
...
def interpolate(start: float, end: float, alpha: float) -> float: ...
@overload
def interpolate(start: Point3D, end: Point3D, alpha: float) -> Point3D:
...
def interpolate(start: Point3D, end: Point3D, alpha: float) -> Point3D: ...
def interpolate(
@ -321,13 +319,11 @@ def integer_interpolate(
@overload
def mid(start: float, end: float) -> float:
...
def mid(start: float, end: float) -> float: ...
@overload
def mid(start: Point3D, end: Point3D) -> Point3D:
...
def mid(start: Point3D, end: Point3D) -> Point3D: ...
def mid(start: float | Point3D, end: float | Point3D) -> float | Point3D:
@ -348,18 +344,15 @@ def mid(start: float | Point3D, end: float | Point3D) -> float | Point3D:
@overload
def inverse_interpolate(start: float, end: float, value: float) -> float:
...
def inverse_interpolate(start: float, end: float, value: float) -> float: ...
@overload
def inverse_interpolate(start: float, end: float, value: Point3D) -> Point3D:
...
def inverse_interpolate(start: float, end: float, value: Point3D) -> Point3D: ...
@overload
def inverse_interpolate(start: Point3D, end: Point3D, value: Point3D) -> Point3D:
...
def inverse_interpolate(start: Point3D, end: Point3D, value: Point3D) -> Point3D: ...
def inverse_interpolate(
@ -408,8 +401,7 @@ def match_interpolate(
old_start: float,
old_end: float,
old_value: float,
) -> float:
...
) -> float: ...
@overload
@ -419,8 +411,7 @@ def match_interpolate(
old_start: float,
old_end: float,
old_value: Point3D,
) -> Point3D:
...
) -> Point3D: ...
def match_interpolate(

View file

@ -24,6 +24,7 @@ in the standard:
.. automanimcolormodule:: manim.utils.color.BS381
"""
from .core import ManimColor
BS381_101 = ManimColor("#94BFAC")

View file

@ -23,6 +23,7 @@ taken from https://www.w3schools.com/colors/colors_xkcd.asp.
.. automanimcolormodule:: manim.utils.color.XKCD
"""
from .core import ManimColor
ACIDGREEN = ManimColor("#8FFE09")

View file

@ -62,7 +62,7 @@ class ManimColor:
It's internal representation is a 4 element array of floats corresponding
to a [r,g,b,a] value where r,g,b,a can be between 0 to 1.
This is done in order to reduce the amount of color inconsitencies by constantly
This is done in order to reduce the amount of color inconsistencies by constantly
casting between integers and floats which introduces errors.
The class can accept any value of type :class:`ParsableManimColor` i.e.
@ -473,9 +473,13 @@ class ManimColor:
str
A hex string starting with a # with either 6 or 8 nibbles depending on your input, by default 6 i.e #XXXXXX
"""
tmp = f"#{int(self._internal_value[0]*255):02X}{int(self._internal_value[1]*255):02X}{int(self._internal_value[2]*255):02X}"
tmp = (
f"#{int(self._internal_value[0] * 255):02X}"
f"{int(self._internal_value[1] * 255):02X}"
f"{int(self._internal_value[2] * 255):02X}"
)
if with_alpha:
tmp += f"{int(self._internal_value[3]*255):02X}"
tmp += f"{int(self._internal_value[3] * 255):02X}"
return tmp
def to_hsv(self) -> HSV_Array_Float:
@ -628,8 +632,7 @@ class ManimColor:
cls,
color: ParsableManimColor | None,
alpha: float = ...,
) -> Self:
...
) -> Self: ...
@overload
@classmethod
@ -637,8 +640,7 @@ class ManimColor:
cls,
color: Sequence[ParsableManimColor],
alpha: float = ...,
) -> list[Self]:
...
) -> list[Self]: ...
@classmethod
def parse(

View file

@ -1,6 +1,5 @@
"""Debugging utilities."""
from __future__ import annotations
__all__ = ["print_family", "index_labels"]

View file

@ -233,8 +233,9 @@ def deprecated_params(
since: str | None = None,
until: str | None = None,
message: str | None = "",
redirections: None
| (Iterable[tuple[str, str] | Callable[..., dict[str, Any]]]) = None,
redirections: None | (
Iterable[tuple[str, str] | Callable[..., dict[str, Any]]]
) = None,
) -> Callable:
"""Decorator to mark parameters of a callable as deprecated.

View file

@ -77,6 +77,7 @@ directive:
that is rendered in a reference block after the source code.
"""
from __future__ import annotations
import csv
@ -150,6 +151,7 @@ class ManimDirective(Directive):
See the module docstring for documentation.
"""
has_content = True
required_arguments = 1
optional_arguments = 0
@ -384,7 +386,7 @@ def _log_rendering_times(*args: tuple[Any]) -> None:
f"{key}{f'{time_sum:.3f}'.rjust(7, '.')}s => {len(group)} EXAMPLES",
)
for row in group:
print(f"{' '*(max_file_length)} {row[2].rjust(7)}s {row[1]}")
print(f"{' ' * max_file_length} {row[2].rjust(7)}s {row[1]}")
print("")

View file

@ -83,7 +83,6 @@ There are primarily 3 kinds of standard easing functions:
self.wait()
"""
from __future__ import annotations
__all__ = [
@ -179,13 +178,12 @@ def smoothererstep(t: float) -> float:
The 1st, 2nd and 3rd derivatives (speed, acceleration and jerk) are zero at the endpoints.
https://en.wikipedia.org/wiki/Smoothstep
"""
return (
0
if t <= 0
else 35 * t**4 - 84 * t**5 + 70 * t**6 - 20 * t**7
if t < 1
else 1
)
alpha = 0
if 0 < t < 1:
alpha = 35 * t**4 - 84 * t**5 + 70 * t**6 - 20 * t**7
elif t >= 1:
alpha = 1
return alpha
@unit_interval

View file

@ -214,11 +214,13 @@ def _make_test_comparing_frames(
# If you pass a custom renderer to the Scene, the Camera class given as an argument in the Scene
# is not passed to the renderer. See __init__ of Scene.
# This potentially prevents OpenGL testing.
test_renderer=testRenderer(file_writer_class=file_writer_class)
if base_scene is not ThreeDScene
else testRenderer(
file_writer_class=file_writer_class,
camera_class=ThreeDCamera,
test_renderer=(
testRenderer(file_writer_class=file_writer_class)
if base_scene is not ThreeDScene
else testRenderer(
file_writer_class=file_writer_class,
camera_class=ThreeDCamera,
)
), # testRenderer(file_writer_class=file_writer_class),
)
scene_tested = sceneTested(skip_animations=True)

View file

@ -1,4 +1,5 @@
"""A library of LaTeX templates."""
from __future__ import annotations
__all__ = [

View file

@ -1,6 +1,5 @@
"""Helpers functions for devs to set up new graphical-units data."""
from __future__ import annotations
import tempfile

View file

@ -27,9 +27,11 @@ def test_elongated_ticks_float_equality():
default_tick_height, elongated_tick_height = min(tick_heights), max(tick_heights)
assert all(
tick.height == elongated_tick_height
if ind in [2, 7]
else tick.height == default_tick_height
(
tick.height == elongated_tick_height
if ind in [2, 7]
else tick.height == default_tick_height
)
for ind, tick in enumerate(nline.ticks)
)

View file

@ -232,9 +232,11 @@ class Top:
@deprecated_params(
redirections=[
lambda point2D=1: {"x": point2D[0], "y": point2D[1]}
if isinstance(point2D, tuple)
else {"x": point2D, "y": point2D},
lambda point2D=1: (
{"x": point2D[0], "y": point2D[1]}
if isinstance(point2D, tuple)
else {"x": point2D, "y": point2D}
),
],
)
def quuz(self, **kwargs):

View file

@ -221,7 +221,7 @@ def test_tex_template_file(tmp_path):
tmp_cfg.write(
f"""
[CLI]
tex_template_file = { tex_file }
tex_template_file = {tex_file}
""",
)
tmp_cfg.close()