Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
hooks:
- id: pyupgrade
name: Update code to new python versions
args: [--py37-plus]
args: [--py39-plus]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand Down
3 changes: 2 additions & 1 deletion manim/_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

import logging
from contextlib import contextmanager
from typing import Any, Generator
from typing import Any
from collections.abc import Generator

from .cli_colors import parse_cli_ctx
from .logger_utils import make_logger
Expand Down
3 changes: 2 additions & 1 deletion manim/_config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import sys
from collections.abc import Mapping, MutableMapping
from pathlib import Path
from typing import TYPE_CHECKING, Any, ClassVar, Iterable, Iterator, NoReturn
from typing import TYPE_CHECKING, Any, ClassVar, NoReturn
from collections.abc import Iterable, Iterator

import numpy as np

Expand Down
3 changes: 2 additions & 1 deletion manim/animation/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@


from copy import deepcopy
from typing import TYPE_CHECKING, Callable, Iterable, Sequence
from typing import TYPE_CHECKING, Callable
from collections.abc import Iterable, Sequence

from typing_extensions import Self

Expand Down
3 changes: 2 additions & 1 deletion manim/animation/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from __future__ import annotations

import types
from typing import TYPE_CHECKING, Callable, Iterable, Sequence
from typing import TYPE_CHECKING, Callable
from collections.abc import Iterable, Sequence

import numpy as np

Expand Down
3 changes: 2 additions & 1 deletion manim/animation/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def construct(self):


import itertools as it
from typing import TYPE_CHECKING, Callable, Iterable, Sequence
from typing import TYPE_CHECKING, Callable
from collections.abc import Iterable, Sequence

import numpy as np

Expand Down
9 changes: 5 additions & 4 deletions manim/animation/indication.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def construct(self):
"Blink",
]

from typing import Callable, Iterable, Optional, Tuple, Type, Union
from typing import Callable, Optional, Tuple, Type, Union
from collections.abc import Iterable

import numpy as np

Expand Down Expand Up @@ -305,7 +306,7 @@ def __init__(self, mobject: "VMobject", time_width: float = 0.1, **kwargs) -> No
self.time_width = time_width
super().__init__(mobject, remover=True, introducer=True, **kwargs)

def _get_bounds(self, alpha: float) -> Tuple[float]:
def _get_bounds(self, alpha: float) -> tuple[float]:
tw = self.time_width
upper = interpolate(0, 1 + tw, alpha)
lower = upper - tw
Expand Down Expand Up @@ -459,7 +460,7 @@ def homotopy(
y: float,
z: float,
t: float,
) -> Tuple[float, float, float]:
) -> tuple[float, float, float]:
upper = interpolate(0, 1 + time_width, t)
lower = upper - time_width
relative_x = inverse_interpolate(x_min, x_max, x)
Expand Down Expand Up @@ -593,7 +594,7 @@ def construct(self):
def __init__(
self,
mobject: Mobject,
shape: Type = Rectangle,
shape: type = Rectangle,
fade_in=False,
fade_out=False,
time_width=0.3,
Expand Down
3 changes: 2 additions & 1 deletion manim/animation/rotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

__all__ = ["Rotating", "Rotate"]

from typing import TYPE_CHECKING, Callable, Sequence
from typing import TYPE_CHECKING, Callable
from collections.abc import Sequence

import numpy as np

Expand Down
3 changes: 2 additions & 1 deletion manim/animation/specialized.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

__all__ = ["Broadcast"]

from typing import Any, Sequence
from typing import Any
from collections.abc import Sequence

from manim.animation.transform import Restore

Expand Down
3 changes: 2 additions & 1 deletion manim/animation/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@

import inspect
import types
from typing import TYPE_CHECKING, Any, Callable, Iterable, Sequence
from typing import TYPE_CHECKING, Any, Callable
from collections.abc import Iterable, Sequence

import numpy as np

Expand Down
3 changes: 2 additions & 1 deletion manim/camera/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import operator as op
import pathlib
from functools import reduce
from typing import Any, Callable, Iterable
from typing import Any, Callable
from collections.abc import Iterable

import cairo
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

import itertools as it
from copy import copy
from typing import TYPE_CHECKING, Any, Hashable, Iterable, Literal, Protocol, cast
from typing import TYPE_CHECKING, Any, Literal, Protocol, cast
from collections.abc import Hashable, Iterable

import networkx as nx
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/graphing/coordinate_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

import fractions as fr
import numbers
from typing import TYPE_CHECKING, Any, Callable, Iterable, Sequence, TypeVar, overload
from typing import TYPE_CHECKING, Any, Callable, TypeVar, overload
from collections.abc import Iterable, Sequence

import numpy as np
from typing_extensions import Self
Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/graphing/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
__all__ = ["ParametricFunction", "FunctionGraph", "ImplicitFunction"]


from typing import TYPE_CHECKING, Callable, Iterable, Sequence
from typing import TYPE_CHECKING, Callable
from collections.abc import Iterable, Sequence

import numpy as np
from isosurfaces import plot_isoline
Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/graphing/number_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
__all__ = ["NumberLine", "UnitInterval"]


from typing import TYPE_CHECKING, Callable, Iterable, Sequence
from typing import TYPE_CHECKING, Callable
from collections.abc import Iterable, Sequence

if TYPE_CHECKING:
from manim.mobject.geometry.tips import ArrowTip
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/graphing/probability.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__all__ = ["SampleSpace", "BarChart"]


from typing import Iterable, MutableSequence, Sequence
from collections.abc import Iterable, MutableSequence, Sequence

import numpy as np

Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/graphing/scale.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

import math
from typing import TYPE_CHECKING, Any, Iterable
from typing import TYPE_CHECKING, Any
from collections.abc import Iterable

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def construct(self):


import itertools as it
from typing import Iterable, Sequence
from collections.abc import Iterable, Sequence

import numpy as np

Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import warnings
from functools import partialmethod, reduce
from pathlib import Path
from typing import TYPE_CHECKING, Callable, Iterable, Literal
from typing import TYPE_CHECKING, Callable, Literal
from collections.abc import Iterable

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/opengl/opengl_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
from functools import partialmethod, wraps
from math import ceil
from typing import Iterable, Sequence
from collections.abc import Iterable, Sequence

import moderngl
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/opengl/opengl_surface.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from pathlib import Path
from typing import Iterable
from collections.abc import Iterable

import moderngl
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/opengl/opengl_vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import itertools as it
import operator as op
from functools import reduce, wraps
from typing import Callable, Iterable, Sequence
from typing import Callable
from collections.abc import Iterable, Sequence

import moderngl
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/svg/brace.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__all__ = ["Brace", "BraceLabel", "ArcBrace", "BraceText", "BraceBetweenPoints"]

from typing import Sequence
from collections.abc import Sequence

import numpy as np
import svgelements as se
Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def construct(self):


import itertools as it
from typing import Callable, Iterable, Sequence
from typing import Callable
from collections.abc import Iterable, Sequence

from manim.mobject.geometry.line import Line
from manim.mobject.geometry.polygram import Polygon
Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/text/numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__all__ = ["DecimalNumber", "Integer", "Variable"]

from typing import Sequence
from collections.abc import Sequence

import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion manim/mobject/text/tex_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import re
from functools import reduce
from textwrap import dedent
from typing import Iterable
from collections.abc import Iterable

from manim import config, logger
from manim.constants import *
Expand Down
6 changes: 3 additions & 3 deletions manim/mobject/text/text_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def construct(self):
from contextlib import contextmanager
from itertools import chain
from pathlib import Path
from typing import Iterable, Sequence
from collections.abc import Iterable, Sequence

import manimpango
import numpy as np
Expand Down Expand Up @@ -412,7 +412,7 @@ def construct(self):
"""

@staticmethod
@functools.lru_cache(maxsize=None)
@functools.cache
def font_list() -> list[str]:
return manimpango.list_fonts()

Expand Down Expand Up @@ -1155,7 +1155,7 @@ def construct(self):
"""

@staticmethod
@functools.lru_cache(maxsize=None)
@functools.cache
def font_list() -> list[str]:
return manimpango.list_fonts()

Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/three_d/three_dimensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"Torus",
]

from typing import Any, Callable, Iterable, Sequence
from typing import Any, Callable
from collections.abc import Iterable, Sequence

import numpy as np
from typing_extensions import Self
Expand Down
6 changes: 1 addition & 5 deletions manim/mobject/types/vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
from typing import (
TYPE_CHECKING,
Callable,
Generator,
Hashable,
Iterable,
Literal,
Mapping,
Sequence,
)
from collections.abc import Generator, Hashable, Iterable, Mapping, Sequence

import numpy as np
from PIL.Image import Image
Expand Down
3 changes: 2 additions & 1 deletion manim/mobject/vector_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import itertools as it
import random
from math import ceil, floor
from typing import Callable, Iterable, Sequence
from typing import Callable
from collections.abc import Iterable, Sequence

import numpy as np
from PIL import Image
Expand Down
3 changes: 2 additions & 1 deletion manim/renderer/cairo_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@

if typing.TYPE_CHECKING:
import types
from typing import Any, Iterable
from typing import Any
from collections.abc import Iterable

from manim.animation.animation import Animation
from manim.scene.scene import Scene
Expand Down
5 changes: 1 addition & 4 deletions manim/renderer/opengl_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import time
from typing import Any

if sys.version_info < (3, 8):
from backports.cached_property import cached_property
else:
from functools import cached_property
from functools import cached_property

import moderngl
import numpy as np
Expand Down
3 changes: 2 additions & 1 deletion manim/scene/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
from ..utils.iterables import list_difference_update, list_update

if TYPE_CHECKING:
from typing import Callable, Iterable
from typing import Callable
from collections.abc import Iterable


class RerunSceneHandler(FileSystemEventHandler):
Expand Down
2 changes: 1 addition & 1 deletion manim/scene/three_d_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


import warnings
from typing import Iterable, Sequence
from collections.abc import Iterable, Sequence

import numpy as np

Expand Down
3 changes: 2 additions & 1 deletion manim/utils/bezier.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@


from functools import reduce
from typing import Any, Callable, Sequence, overload
from typing import Any, Callable, overload
from collections.abc import Sequence

import numpy as np
import numpy.typing as npt
Expand Down
2 changes: 1 addition & 1 deletion manim/utils/color/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
from .core import *
from .manim_colors import *

_all_color_dict: Dict[str, ManimColor] = {
_all_color_dict: dict[str, ManimColor] = {

Check notice

Code scanning / CodeQL

Unused global variable

The global variable '_all_color_dict' is not used.
k: v for k, v in globals().items() if isinstance(v, ManimColor)
}
Loading