From 1aee37bfb5f935fb627c2d4e8328b5ff64946d03 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 24 Apr 2024 13:11:03 +0200 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#3332) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [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 --- .codespell_ignorelines | 1 - .codespell_ignorewords | 5 ++++ .codespellrc | 6 ++--- .flake8 | 3 +++ .pre-commit-config.yaml | 19 +++++++------- docs/source/contributing/docs/docstrings.rst | 3 +-- docs/source/contributing/docs/typings.rst | 3 +-- docs/source/guides/add_voiceovers.rst | 1 + docs/source/tutorials/quickstart.rst | 2 +- example_scenes/opengl.py | 2 +- manim/_config/logger_utils.py | 1 + manim/_config/utils.py | 6 ++--- manim/animation/animation.py | 1 - manim/animation/composition.py | 1 - manim/animation/fading.py | 1 - manim/animation/indication.py | 2 +- 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/scene.py | 2 +- manim/scene/three_d_scene.py | 11 ++++---- manim/utils/bezier.py | 27 +++++++------------- manim/utils/color/BS381.py | 1 + manim/utils/color/XKCD.py | 1 + manim/utils/color/core.py | 16 +++++++----- manim/utils/debug.py | 1 - manim/utils/deprecation.py | 5 ++-- manim/utils/docbuild/manim_directive.py | 4 ++- manim/utils/rate_functions.py | 14 +++++----- 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 +++--- tests/test_config.py | 2 +- 39 files changed, 102 insertions(+), 96 deletions(-) delete mode 100644 .codespell_ignorelines create mode 100644 .codespell_ignorewords diff --git a/.codespell_ignorelines b/.codespell_ignorelines deleted file mode 100644 index ae00dfdf8e..0000000000 --- a/.codespell_ignorelines +++ /dev/null @@ -1 +0,0 @@ - diff --git a/.codespell_ignorewords b/.codespell_ignorewords new file mode 100644 index 0000000000..b03acdedca --- /dev/null +++ b/.codespell_ignorewords @@ -0,0 +1,5 @@ + nam + sherif + falsy + medias + strager diff --git a/.codespellrc b/.codespellrc index bbc928a1bb..ca31db7e0e 100644 --- a/.codespellrc +++ b/.codespellrc @@ -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 diff --git a/.flake8 b/.flake8 index b16c3bf625..b80d86a0fd 100644 --- a/.flake8 +++ b/.flake8 @@ -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, diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa134edea8..f0cb427122 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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)$ diff --git a/docs/source/contributing/docs/docstrings.rst b/docs/source/contributing/docs/docstrings.rst index 86ee68f81c..5851f5d1ff 100644 --- a/docs/source/contributing/docs/docstrings.rst +++ b/docs/source/contributing/docs/docstrings.rst @@ -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 diff --git a/docs/source/contributing/docs/typings.rst b/docs/source/contributing/docs/typings.rst index a522b38472..befd557a2b 100644 --- a/docs/source/contributing/docs/typings.rst +++ b/docs/source/contributing/docs/typings.rst @@ -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. diff --git a/docs/source/guides/add_voiceovers.rst b/docs/source/guides/add_voiceovers.rst index 90a6b30c36..5db74f0ea2 100644 --- a/docs/source/guides/add_voiceovers.rst +++ b/docs/source/guides/add_voiceovers.rst @@ -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): diff --git a/docs/source/tutorials/quickstart.rst b/docs/source/tutorials/quickstart.rst index bd681add5b..84df97b8af 100644 --- a/docs/source/tutorials/quickstart.rst +++ b/docs/source/tutorials/quickstart.rst @@ -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. diff --git a/example_scenes/opengl.py b/example_scenes/opengl.py index b30c5ace29..27f579a6e4 100644 --- a/example_scenes/opengl.py +++ b/example_scenes/opengl.py @@ -406,7 +406,7 @@ def construct(self): 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. 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..7ced9c1101 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 @@ -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 @@ def from_animation_number(self, value: int) -> None: @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 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/animation/indication.py b/manim/animation/indication.py index 01a0e619a5..bb3f712199 100644 --- a/manim/animation/indication.py +++ b/manim/animation/indication.py @@ -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. 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 37e8ffb6b6..5b23ba8fb7 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/scene.py b/manim/scene/scene.py index 2a3b37d76f..8f92d215c4 100644 --- a/manim/scene/scene.py +++ b/manim/scene/scene.py @@ -287,7 +287,7 @@ def construct(self): 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 diff --git a/manim/scene/three_d_scene.py b/manim/scene/three_d_scene.py index 6f9e7a651b..8f49393d03 100644 --- a/manim/scene/three_d_scene.py +++ b/manim/scene/three_d_scene.py @@ -283,16 +283,15 @@ def move_camera( 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: 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..767fdcf576 100644 --- a/manim/utils/color/core.py +++ b/manim/utils/color/core.py @@ -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 @@ def to_hex(self, with_alpha: bool = False) -> str: 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 @@ def parse( cls, color: ParsableManimColor | None, alpha: float = ..., - ) -> Self: - ... + ) -> Self: ... @overload @classmethod @@ -637,8 +640,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..111b40fa4d 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 @@ -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("") diff --git a/manim/utils/rate_functions.py b/manim/utils/rate_functions.py index dec8579692..d3cd79c355 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__ = [ @@ -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 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): diff --git a/tests/test_config.py b/tests/test_config.py index b543e8a5e6..ed2f4b59c0 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -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()