From a9aa2c16fbb98605c699331f9b5bc18c8b7fc2cd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:17:05 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- manim/_config/logger_utils.py | 1 + manim/_config/utils.py | 1 + manim/animation/animation.py | 1 - manim/animation/composition.py | 1 - manim/animation/fading.py | 1 - manim/camera/camera.py | 1 - manim/cli/cfg/group.py | 1 + manim/cli/default_group.py | 1 + manim/cli/init/commands.py | 1 + manim/cli/plugins/commands.py | 1 + manim/cli/render/commands.py | 1 + manim/mobject/graphing/coordinate_systems.py | 21 +++++++-------- manim/scene/three_d_scene.py | 8 +++--- manim/utils/bezier.py | 27 +++++++------------- manim/utils/color/BS381.py | 1 + manim/utils/color/XKCD.py | 1 + manim/utils/color/core.py | 6 ++--- manim/utils/debug.py | 1 - manim/utils/deprecation.py | 5 ++-- manim/utils/docbuild/manim_directive.py | 2 ++ manim/utils/rate_functions.py | 7 +---- manim/utils/testing/frames_comparison.py | 12 +++++---- manim/utils/tex_templates.py | 1 + tests/helpers/graphical_units.py | 1 - tests/module/mobject/graphing/test_ticks.py | 8 +++--- tests/module/utils/test_deprecation.py | 8 +++--- 26 files changed, 58 insertions(+), 62 deletions(-) diff --git a/manim/_config/logger_utils.py b/manim/_config/logger_utils.py index e17bc44b8c..e861d3899c 100644 --- a/manim/_config/logger_utils.py +++ b/manim/_config/logger_utils.py @@ -9,6 +9,7 @@ format. """ + from __future__ import annotations import configparser diff --git a/manim/_config/utils.py b/manim/_config/utils.py index 814db08a3e..115f6ae812 100644 --- a/manim/_config/utils.py +++ b/manim/_config/utils.py @@ -9,6 +9,7 @@ See :doc:`/guides/configuration` for an introduction to Manim's configuration system. """ + from __future__ import annotations import argparse diff --git a/manim/animation/animation.py b/manim/animation/animation.py index 90290eee3e..106649d36b 100644 --- a/manim/animation/animation.py +++ b/manim/animation/animation.py @@ -1,6 +1,5 @@ """Animate mobjects.""" - from __future__ import annotations from manim.mobject.opengl.opengl_mobject import OpenGLMobject diff --git a/manim/animation/composition.py b/manim/animation/composition.py index ff219405f2..3fc2d5f716 100644 --- a/manim/animation/composition.py +++ b/manim/animation/composition.py @@ -1,6 +1,5 @@ """Tools for displaying multiple animations at once.""" - from __future__ import annotations import types diff --git a/manim/animation/fading.py b/manim/animation/fading.py index 33f38a5027..1e98b2c295 100644 --- a/manim/animation/fading.py +++ b/manim/animation/fading.py @@ -12,7 +12,6 @@ def construct(self): """ - from __future__ import annotations __all__ = [ diff --git a/manim/camera/camera.py b/manim/camera/camera.py index 1844b40869..fa36440a17 100644 --- a/manim/camera/camera.py +++ b/manim/camera/camera.py @@ -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"] diff --git a/manim/cli/cfg/group.py b/manim/cli/cfg/group.py index b35e5eb378..346205d89f 100644 --- a/manim/cli/cfg/group.py +++ b/manim/cli/cfg/group.py @@ -5,6 +5,7 @@ group. """ + from __future__ import annotations from ast import literal_eval diff --git a/manim/cli/default_group.py b/manim/cli/default_group.py index 3afb7cecb5..06f1c0520a 100644 --- a/manim/cli/default_group.py +++ b/manim/cli/default_group.py @@ -9,6 +9,7 @@ This library isn't used as a dependency as we need to inherit from ``cloup.Group`` instead of ``click.Group``. """ + import warnings import cloup diff --git a/manim/cli/init/commands.py b/manim/cli/init/commands.py index 33fac1b1d3..1ca5b9c05c 100644 --- a/manim/cli/init/commands.py +++ b/manim/cli/init/commands.py @@ -5,6 +5,7 @@ group. """ + from __future__ import annotations import configparser diff --git a/manim/cli/plugins/commands.py b/manim/cli/plugins/commands.py index 7926f01649..d47325cd03 100644 --- a/manim/cli/plugins/commands.py +++ b/manim/cli/plugins/commands.py @@ -5,6 +5,7 @@ group. """ + from __future__ import annotations import cloup diff --git a/manim/cli/render/commands.py b/manim/cli/render/commands.py index 3ad340ed5e..db11db2d46 100644 --- a/manim/cli/render/commands.py +++ b/manim/cli/render/commands.py @@ -5,6 +5,7 @@ can specify options, and arguments for the render command. """ + from __future__ import annotations import http.client diff --git a/manim/mobject/graphing/coordinate_systems.py b/manim/mobject/graphing/coordinate_systems.py index 9f773626c1..4acc1d9b99 100644 --- a/manim/mobject/graphing/coordinate_systems.py +++ b/manim/mobject/graphing/coordinate_systems.py @@ -1,6 +1,5 @@ """Mobjects that represent coordinate systems.""" - from __future__ import annotations __all__ = [ @@ -441,8 +440,7 @@ def get_line_from_axis_to_point( line_config: dict | None = ..., color: ParsableManimColor | None = ..., stroke_width: float = ..., - ) -> DashedLine: - ... + ) -> DashedLine: ... @overload def get_line_from_axis_to_point( @@ -453,8 +451,7 @@ def get_line_from_axis_to_point( 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 @@ def plot_surface( 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 @@ def construct(self): 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, diff --git a/manim/scene/three_d_scene.py b/manim/scene/three_d_scene.py index 6f9e7a651b..53eda6bd82 100644 --- a/manim/scene/three_d_scene.py +++ b/manim/scene/three_d_scene.py @@ -288,9 +288,11 @@ def move_camera( [phi, "phi"], [gamma, "gamma"], [ - config.frame_height / (zoom * cam.height) - if zoom is not None - else None, + ( + config.frame_height / (zoom * cam.height) + if zoom is not None + else None + ), "zoom", ], [frame_center, "frame_center"], diff --git a/manim/utils/bezier.py b/manim/utils/bezier.py index 938e7362b5..d97a2545e1 100644 --- a/manim/utils/bezier.py +++ b/manim/utils/bezier.py @@ -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( diff --git a/manim/utils/color/BS381.py b/manim/utils/color/BS381.py index 5d09a6f1b3..50ae95b96c 100644 --- a/manim/utils/color/BS381.py +++ b/manim/utils/color/BS381.py @@ -24,6 +24,7 @@ .. automanimcolormodule:: manim.utils.color.BS381 """ + from .core import ManimColor BS381_101 = ManimColor("#94BFAC") diff --git a/manim/utils/color/XKCD.py b/manim/utils/color/XKCD.py index d8ee93bac5..db9bccaed3 100644 --- a/manim/utils/color/XKCD.py +++ b/manim/utils/color/XKCD.py @@ -23,6 +23,7 @@ .. automanimcolormodule:: manim.utils.color.XKCD """ + from .core import ManimColor ACIDGREEN = ManimColor("#8FFE09") diff --git a/manim/utils/color/core.py b/manim/utils/color/core.py index f4c2e94593..7adc683d9f 100644 --- a/manim/utils/color/core.py +++ b/manim/utils/color/core.py @@ -628,8 +628,7 @@ def parse( cls, color: ParsableManimColor | None, alpha: float = ..., - ) -> Self: - ... + ) -> Self: ... @overload @classmethod @@ -637,8 +636,7 @@ def parse( cls, color: Sequence[ParsableManimColor], alpha: float = ..., - ) -> list[Self]: - ... + ) -> list[Self]: ... @classmethod def parse( diff --git a/manim/utils/debug.py b/manim/utils/debug.py index 3e066837e2..d161948147 100644 --- a/manim/utils/debug.py +++ b/manim/utils/debug.py @@ -1,6 +1,5 @@ """Debugging utilities.""" - from __future__ import annotations __all__ = ["print_family", "index_labels"] diff --git a/manim/utils/deprecation.py b/manim/utils/deprecation.py index b72ecc7508..68788a75e7 100644 --- a/manim/utils/deprecation.py +++ b/manim/utils/deprecation.py @@ -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. diff --git a/manim/utils/docbuild/manim_directive.py b/manim/utils/docbuild/manim_directive.py index 9ed5d0566c..1b9d01797c 100644 --- a/manim/utils/docbuild/manim_directive.py +++ b/manim/utils/docbuild/manim_directive.py @@ -77,6 +77,7 @@ def construct(self): 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 diff --git a/manim/utils/rate_functions.py b/manim/utils/rate_functions.py index dec8579692..3bd9437694 100644 --- a/manim/utils/rate_functions.py +++ b/manim/utils/rate_functions.py @@ -83,7 +83,6 @@ def construct(self): self.wait() """ - from __future__ import annotations __all__ = [ @@ -180,11 +179,7 @@ def smoothererstep(t: float) -> float: 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 + 0 if t <= 0 else 35 * t**4 - 84 * t**5 + 70 * t**6 - 20 * t**7 if t < 1 else 1 ) diff --git a/manim/utils/testing/frames_comparison.py b/manim/utils/testing/frames_comparison.py index ea067b64fe..e3814ea696 100644 --- a/manim/utils/testing/frames_comparison.py +++ b/manim/utils/testing/frames_comparison.py @@ -214,11 +214,13 @@ def real_test(): # 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) diff --git a/manim/utils/tex_templates.py b/manim/utils/tex_templates.py index 43153f933e..ed9db91c3f 100644 --- a/manim/utils/tex_templates.py +++ b/manim/utils/tex_templates.py @@ -1,4 +1,5 @@ """A library of LaTeX templates.""" + from __future__ import annotations __all__ = [ diff --git a/tests/helpers/graphical_units.py b/tests/helpers/graphical_units.py index b202217b05..75fb00343a 100644 --- a/tests/helpers/graphical_units.py +++ b/tests/helpers/graphical_units.py @@ -1,6 +1,5 @@ """Helpers functions for devs to set up new graphical-units data.""" - from __future__ import annotations import tempfile diff --git a/tests/module/mobject/graphing/test_ticks.py b/tests/module/mobject/graphing/test_ticks.py index 5bc5eb1604..e4bbcd3c67 100644 --- a/tests/module/mobject/graphing/test_ticks.py +++ b/tests/module/mobject/graphing/test_ticks.py @@ -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) ) diff --git a/tests/module/utils/test_deprecation.py b/tests/module/utils/test_deprecation.py index 8fb7b9675a..e498b8b196 100644 --- a/tests/module/utils/test_deprecation.py +++ b/tests/module/utils/test_deprecation.py @@ -232,9 +232,11 @@ def quux(self, **kwargs): @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):