Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 25, 2024
1 parent 5254e59 commit a9aa2c1
Show file tree
Hide file tree
Showing 26 changed files with 58 additions and 62 deletions.
1 change: 1 addition & 0 deletions manim/_config/logger_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
format.
"""

from __future__ import annotations

import configparser
Expand Down
1 change: 1 addition & 0 deletions manim/_config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
See :doc:`/guides/configuration` for an introduction to Manim's configuration system.
"""

from __future__ import annotations

import argparse
Expand Down
1 change: 0 additions & 1 deletion manim/animation/animation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Animate mobjects."""


from __future__ import annotations

from manim.mobject.opengl.opengl_mobject import OpenGLMobject
Expand Down
1 change: 0 additions & 1 deletion manim/animation/composition.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Tools for displaying multiple animations at once."""


from __future__ import annotations

import types
Expand Down
1 change: 0 additions & 1 deletion manim/animation/fading.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def construct(self):
"""


from __future__ import annotations

__all__ = [
Expand Down
1 change: 0 additions & 1 deletion manim/camera/camera.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
1 change: 1 addition & 0 deletions manim/cli/cfg/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
group.
"""

from __future__ import annotations

from ast import literal_eval
Expand Down
1 change: 1 addition & 0 deletions manim/cli/default_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions manim/cli/init/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
group.
"""

from __future__ import annotations

import configparser
Expand Down
1 change: 1 addition & 0 deletions manim/cli/plugins/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
group.
"""

from __future__ import annotations

import cloup
Expand Down
1 change: 1 addition & 0 deletions manim/cli/render/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
can specify options, and arguments for the render command.
"""

from __future__ import annotations

import http.client
Expand Down
21 changes: 9 additions & 12 deletions manim/mobject/graphing/coordinate_systems.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Mobjects that represent coordinate systems."""


from __future__ import annotations

__all__ = [
Expand Down Expand Up @@ -441,8 +440,7 @@ def get_line_from_axis_to_point(
line_config: dict | None = ...,
color: ParsableManimColor | None = ...,
stroke_width: float = ...,
) -> DashedLine:
...
) -> DashedLine: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@overload
def get_line_from_axis_to_point(
Expand All @@ -453,8 +451,7 @@ def get_line_from_axis_to_point(
line_config: dict | None = ...,
color: ParsableManimColor | None = ...,
stroke_width: float = ...,
) -> LineType:
...
) -> LineType: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

def get_line_from_axis_to_point( # type: ignore[no-untyped-def]
self,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions manim/scene/three_d_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
27 changes: 9 additions & 18 deletions manim/utils/bezier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


@overload
def interpolate(start: Point3D, end: Point3D, alpha: float) -> Point3D:
...
def interpolate(start: Point3D, end: Point3D, alpha: float) -> Point3D: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


def interpolate(
Expand Down Expand Up @@ -321,13 +319,11 @@ def integer_interpolate(


@overload
def mid(start: float, end: float) -> float:
...
def mid(start: float, end: float) -> float: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


@overload
def mid(start: Point3D, end: Point3D) -> Point3D:
...
def mid(start: Point3D, end: Point3D) -> Point3D: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


def mid(start: float | Point3D, end: float | Point3D) -> float | Point3D:
Expand All @@ -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: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


@overload
def inverse_interpolate(start: float, end: float, value: Point3D) -> Point3D:
...
def inverse_interpolate(start: float, end: float, value: Point3D) -> Point3D: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


@overload
def inverse_interpolate(start: Point3D, end: Point3D, value: Point3D) -> Point3D:
...
def inverse_interpolate(start: Point3D, end: Point3D, value: Point3D) -> Point3D: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


def inverse_interpolate(
Expand Down Expand Up @@ -408,8 +401,7 @@ def match_interpolate(
old_start: float,
old_end: float,
old_value: float,
) -> float:
...
) -> float: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


@overload
Expand All @@ -419,8 +411,7 @@ def match_interpolate(
old_start: float,
old_end: float,
old_value: Point3D,
) -> Point3D:
...
) -> Point3D: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.


def match_interpolate(
Expand Down
1 change: 1 addition & 0 deletions manim/utils/color/BS381.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
.. automanimcolormodule:: manim.utils.color.BS381
"""

from .core import ManimColor

BS381_101 = ManimColor("#94BFAC")
Expand Down
1 change: 1 addition & 0 deletions manim/utils/color/XKCD.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
.. automanimcolormodule:: manim.utils.color.XKCD
"""

from .core import ManimColor

ACIDGREEN = ManimColor("#8FFE09")
Expand Down
6 changes: 2 additions & 4 deletions manim/utils/color/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,17 +628,15 @@ def parse(
cls,
color: ParsableManimColor | None,
alpha: float = ...,
) -> Self:
...
) -> Self: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@overload
@classmethod
def parse(
cls,
color: Sequence[ParsableManimColor],
alpha: float = ...,
) -> list[Self]:
...
) -> list[Self]: ...

Check notice

Code scanning / CodeQL

Statement has no effect Note

This statement has no effect.

@classmethod
def parse(
Expand Down
1 change: 0 additions & 1 deletion manim/utils/debug.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Debugging utilities."""


from __future__ import annotations

__all__ = ["print_family", "index_labels"]
Expand Down
5 changes: 3 additions & 2 deletions manim/utils/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions manim/utils/docbuild/manim_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def construct(self):
that is rendered in a reference block after the source code.
"""

from __future__ import annotations

import csv
Expand Down Expand Up @@ -150,6 +151,7 @@ class ManimDirective(Directive):
See the module docstring for documentation.
"""

has_content = True
required_arguments = 1
optional_arguments = 0
Expand Down
7 changes: 1 addition & 6 deletions manim/utils/rate_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def construct(self):
self.wait()
"""


from __future__ import annotations

__all__ = [
Expand Down Expand Up @@ -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
)


Expand Down
12 changes: 7 additions & 5 deletions manim/utils/testing/frames_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions manim/utils/tex_templates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A library of LaTeX templates."""

from __future__ import annotations

__all__ = [
Expand Down
1 change: 0 additions & 1 deletion tests/helpers/graphical_units.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Helpers functions for devs to set up new graphical-units data."""


from __future__ import annotations

import tempfile
Expand Down
8 changes: 5 additions & 3 deletions tests/module/mobject/graphing/test_ticks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)

Expand Down
8 changes: 5 additions & 3 deletions tests/module/utils/test_deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit a9aa2c1

Please sign in to comment.