A community-maintained Python framework for creating mathematical animations.
Upgraded typehints (#2429)
GameDungeondaf23c9d1031
diff --git a/conftest.py b/conftest.pyindex faebe648d..842ab76dd 100644--- a/conftest.py+++ b/conftest.py@@ -3,11 +3,12 @@# run on difference temporary directories and avoiding# errors.+from __future__ import annotations+# If it is running Doctest the current directory# is changed because it also tests the config module# itself. If it's a normal test then it uses the# tempconfig to change directories.-import pytestfrom _pytest.doctest import DoctestItemdiff --git a/docs/source/conf.py b/docs/source/conf.pyindex 7342756d6..a7a160358 100644--- a/docs/source/conf.py+++ b/docs/source/conf.py@@ -4,11 +4,7 @@# list see the documentation:# https://www.sphinx-doc.org/en/master/usage/configuration.html-# -- Path setup ----------------------------------------------------------------# If extensions (or modules to document with autodoc) are in another directory,-# add these directories to sys.path here. If the directory is relative to the-# documentation root, use os.path.abspath to make it absolute, like shown here.+from __future__ import annotationsimport osimport sys@@ -17,6 +13,12 @@ from pathlib import Pathimport manim+# -- Path setup --------------------------------------------------------------+# If extensions (or modules to document with autodoc) are in another directory,+# add these directories to sys.path here. If the directory is relative to the+# documentation root, use os.path.abspath to make it absolute, like shown here.++sys.path.insert(0, os.path.abspath("."))diff --git a/example_scenes/basic.py b/example_scenes/basic.pyindex 7a46808c1..57ea69fc2 100644--- a/example_scenes/basic.py+++ b/example_scenes/basic.py@@ -1,5 +1,6 @@#!/usr/bin/env python+from manim import *# To watch one of these scenes, run the following:diff --git a/manim/__init__.py b/manim/__init__.pyindex 33d9d24cb..de272aa69 100644--- a/manim/__init__.py+++ b/manim/__init__.py@@ -1,6 +1,8 @@#!/usr/bin/env python+from __future__ import annotations+import pkg_resources__version__: str = pkg_resources.get_distribution(__name__).versiondiff --git a/manim/__main__.py b/manim/__main__.pyindex bac5a5ece..9905185c0 100644--- a/manim/__main__.py+++ b/manim/__main__.py@@ -1,3 +1,5 @@+from __future__ import annotations+import sysimport clickdiff --git a/manim/_config/__init__.py b/manim/_config/__init__.pyindex abfde58ea..beb838e96 100644--- a/manim/_config/__init__.py+++ b/manim/_config/__init__.py@@ -1,5 +1,7 @@"""Set the global config and logger."""+from __future__ import annotations+import loggingfrom contextlib import _GeneratorContextManager, contextmanagerfrom typing import Union@@ -37,7 +39,7 @@ frame = ManimFrame(config)# This has to go here because it needs access to this module's config@contextmanager-def tempconfig(temp: Union[ManimConfig, dict]) -> _GeneratorContextManager:+def tempconfig(temp: ManimConfig | dict) -> _GeneratorContextManager:"""Context manager that temporarily modifies the global ``config`` object.Inside the ``with`` statement, the modified config will be used. Afterdiff --git a/manim/_config/logger_utils.py b/manim/_config/logger_utils.pyindex 6301017df..4a9058e07 100644--- a/manim/_config/logger_utils.py+++ b/manim/_config/logger_utils.py@@ -9,6 +9,8 @@ Both ``logger`` and ``console`` use the ``rich`` library to produce rich textformat."""+from __future__ import annotations+import configparserimport copyimport json@@ -51,7 +53,7 @@ Loading the default color configuration.[/logging.level.error]def make_logger(parser: configparser.ConfigParser,verbosity: str,-) -> typing.Tuple[logging.Logger, Console]:+) -> tuple[logging.Logger, Console]:"""Make the manim logger and console.Parameters@@ -141,7 +143,7 @@ def parse_theme(parser: configparser.ConfigParser) -> Theme:return custom_theme-def set_file_logger(config: "ManimConfig", verbosity: str) -> None:+def set_file_logger(config: ManimConfig, verbosity: str) -> None:"""Add a file handler to manim logger.The path to the file is built using ``config.log_dir``.diff --git a/manim/_config/utils.py b/manim/_config/utils.pyindex 3823a58cc..a284d8b4b 100644--- a/manim/_config/utils.py+++ b/manim/_config/utils.py@@ -9,6 +9,8 @@ movie vs writing a single frame).See :doc:`/tutorials/configuration` for an introduction to Manim's configuration system."""+from __future__ import annotations+import argparseimport configparserimport copy@@ -30,7 +32,7 @@ from ..utils.tex_templates import TexTemplateLibraryfrom .logger_utils import set_file_logger-def config_file_paths() -> typing.List[Path]:+def config_file_paths() -> list[Path]:"""The paths where ``.cfg`` files will be searched for.When manim is first imported, it processes any ``.cfg`` files it finds. This@@ -320,7 +322,7 @@ class ManimConfig(MutableMapping):def __setitem__(self, key: str, val: typing.Any) -> None:getattr(ManimConfig, key).fset(self, val) # fset is the property's setter- def update(self, obj: typing.Union["ManimConfig", dict]) -> None:+ def update(self, obj: ManimConfig | dict) -> None:"""Digest the options found in another :class:`ManimConfig` or in a dict.Similar to :meth:`dict.update`, replaces the values of this object with@@ -369,7 +371,7 @@ class ManimConfig(MutableMapping):raise AttributeError("'ManimConfig' object does not support item deletion")# copy functions- def copy(self) -> "ManimConfig":+ def copy(self) -> ManimConfig:"""Deepcopy the contents of this ManimConfig.Returns@@ -388,11 +390,11 @@ class ManimConfig(MutableMapping):"""return copy.deepcopy(self)- def __copy__(self) -> "ManimConfig":+ def __copy__(self) -> ManimConfig:"""See ManimConfig.copy()."""return copy.deepcopy(self)- def __deepcopy__(self, memo: typing.Dict[str, typing.Any]) -> "ManimConfig":+ def __deepcopy__(self, memo: dict[str, typing.Any]) -> ManimConfig:"""See ManimConfig.copy()."""c = ManimConfig()# Deepcopying the underlying dict is enough because all properties@@ -409,7 +411,7 @@ class ManimConfig(MutableMapping):else:raise ValueError(f"attempted to set {key} to {val}; must be in {values}")- def _set_boolean(self, key: typing.Union[str, int], val: typing.Any) -> None:+ def _set_boolean(self, key: str | int, val: typing.Any) -> None:"""Set ``key`` to ``val`` if ``val`` is Boolean."""if val in [True, False]:self._d[key] = val@@ -465,7 +467,7 @@ class ManimConfig(MutableMapping):return rep# builders- def digest_parser(self, parser: configparser.ConfigParser) -> "ManimConfig":+ def digest_parser(self, parser: configparser.ConfigParser) -> ManimConfig:"""Process the config options present in a :class:`ConfigParser` object.This method processes arbitrary parsers, not only those read from a@@ -635,7 +637,7 @@ class ManimConfig(MutableMapping):return self- def digest_args(self, args: argparse.Namespace) -> "ManimConfig":+ def digest_args(self, args: argparse.Namespace) -> ManimConfig:"""Process the config options present in CLI arguments.Parameters@@ -788,7 +790,7 @@ class ManimConfig(MutableMapping):return self- def digest_file(self, filename: str) -> "ManimConfig":+ def digest_file(self, filename: str) -> ManimConfig:"""Process the config options present in a ``.cfg`` file.This method processes a single ``.cfg`` file, whereas@@ -1459,7 +1461,7 @@ class ManimConfig(MutableMapping):) from excreturn Path(path) if path else None- def _set_dir(self, key: str, val: typing.Union[str, Path]):+ def _set_dir(self, key: str, val: str | Path):if isinstance(val, Path):self._d.__setitem__(key, str(val))else:@@ -1549,7 +1551,7 @@ class ManimConfig(MutableMapping):return self._tex_template@tex_template.setter- def tex_template(self, val: typing.Union[TexTemplateFromFile, TexTemplate]) -> None:+ def tex_template(self, val: TexTemplateFromFile | TexTemplate) -> None:if isinstance(val, (TexTemplateFromFile, TexTemplate)):self._tex_template = val@@ -1583,7 +1585,7 @@ class ManimConfig(MutableMapping):class ManimFrame(Mapping):- _OPTS: typing.Set[str] = {+ _OPTS: set[str] = {"pixel_width","pixel_height","aspect_ratio",@@ -1596,7 +1598,7 @@ class ManimFrame(Mapping):"left_side","right_side",}- _CONSTANTS: typing.Dict[str, np.ndarray] = {+ _CONSTANTS: dict[str, np.ndarray] = {"UP": np.array((0.0, 1.0, 0.0)),"DOWN": np.array((0.0, -1.0, 0.0)),"RIGHT": np.array((1.0, 0.0, 0.0)),@@ -1621,7 +1623,7 @@ class ManimFrame(Mapping):self.__dict__["_c"] = c# there are required by parent class Mapping to behave like a dict- def __getitem__(self, key: typing.Union[str, int]) -> typing.Any:+ def __getitem__(self, key: str | int) -> typing.Any:if key in self._OPTS:return self._c[key]elif key in self._CONSTANTS:diff --git a/manim/animation/animation.py b/manim/animation/animation.pyindex e7da5833d..3f2c4d35f 100644--- a/manim/animation/animation.py+++ b/manim/animation/animation.py@@ -1,6 +1,8 @@"""Animate mobjects."""+from __future__ import annotations+from .. import config, loggerfrom ..mobject import mobject, opengl_mobjectfrom ..mobject.mobject import Mobject@@ -125,7 +127,7 @@ class Animation:def __init__(self,- mobject: Optional[Mobject],+ mobject: Mobject | None,lag_ratio: float = DEFAULT_ANIMATION_LAG_RATIO,run_time: float = DEFAULT_ANIMATION_RUN_TIME,rate_func: Callable[[float], float] = smooth,@@ -137,7 +139,7 @@ class Animation:self._typecheck_input(mobject)self.run_time: float = run_timeself.rate_func: Callable[[float], float] = rate_func- self.name: Optional[str] = name+ self.name: str | None = nameself.remover: bool = removerself.suspend_mobject_updating: bool = suspend_mobject_updatingself.lag_ratio: float = lag_ratio@@ -160,7 +162,7 @@ class Animation:),)- def _typecheck_input(self, mobject: Union[Mobject, None]) -> None:+ def _typecheck_input(self, mobject: Mobject | None) -> None:if mobject is None:logger.debug("Animation with empty mobject")elif not isinstance(mobject, (Mobject, OpenGLMobject)):@@ -206,7 +208,7 @@ class Animation:if self.suspend_mobject_updating and self.mobject is not None:self.mobject.resume_updating()- def clean_up_from_scene(self, scene: "Scene") -> None:+ def clean_up_from_scene(self, scene: Scene) -> None:"""Clean up the :class:`~.Scene` after finishing the animation.This includes to :meth:`~.Scene.remove` the Animation's@@ -236,7 +238,7 @@ class Animation:"""return self.mobject, self.starting_mobject- def get_all_families_zipped(self) -> Iterable[Tuple]:+ def get_all_families_zipped(self) -> Iterable[tuple]:if config["renderer"] == "opengl":return zip(*(mob.get_family() for mob in self.get_all_mobjects()))return zip(@@ -254,7 +256,7 @@ class Animation:for mob in self.get_all_mobjects_to_update():mob.update(dt)- def get_all_mobjects_to_update(self) -> List[Mobject]:+ def get_all_mobjects_to_update(self) -> list[Mobject]:"""Get all mobjects to be updated during the animation.Returns@@ -267,7 +269,7 @@ class Animation:# most cases its updating is suspended anywayreturn list(filter(lambda m: m is not self.mobject, self.get_all_mobjects()))- def copy(self) -> "Animation":+ def copy(self) -> Animation:"""Create a copy of the animation.Returns@@ -314,7 +316,7 @@ class Animation:starting_submobject: Mobject,# target_copy: Mobject, #Todo: fix - signature of interpolate_submobject differs in Transform().alpha: float,- ) -> "Animation":+ ) -> Animation:# Typically implemented by subclasspass@@ -345,7 +347,7 @@ class Animation:return self.rate_func(value - lower)# Getters and setters- def set_run_time(self, run_time: float) -> "Animation":+ def set_run_time(self, run_time: float) -> Animation:"""Set the run time of the animation.Parameters@@ -379,7 +381,7 @@ class Animation:def set_rate_func(self,rate_func: Callable[[float], float],- ) -> "Animation":+ ) -> Animation:"""Set the rate function of the animation.Parameters@@ -408,7 +410,7 @@ class Animation:"""return self.rate_func- def set_name(self, name: str) -> "Animation":+ def set_name(self, name: str) -> Animation:"""Set the name of the animation.Parameters@@ -436,8 +438,8 @@ class Animation:def prepare_animation(- anim: Union["Animation", "mobject._AnimationBuilder"],-) -> "Animation":+ anim: Animation | mobject._AnimationBuilder,+) -> Animation:r"""Returns either an unchanged animation, or the animation builtfrom a passed animation factory.@@ -493,7 +495,7 @@ class Wait(Animation):def finish(self) -> None:pass- def clean_up_from_scene(self, scene: "Scene") -> None:+ def clean_up_from_scene(self, scene: Scene) -> None:passdef update_mobjects(self, dt: float) -> None:@@ -504,7 +506,7 @@ class Wait(Animation):def override_animation(- animation_class: Type["Animation"],+ animation_class: type[Animation],) -> Callable[[Callable], Callable]:"""Decorator used to mark methods as overrides for specific :class:`~.Animation` types.diff --git a/manim/animation/composition.py b/manim/animation/composition.pyindex 632e0c72c..d68b0e6ce 100644--- a/manim/animation/composition.py+++ b/manim/animation/composition.py@@ -1,6 +1,8 @@"""Tools for displaying multiple animations at once."""+from __future__ import annotations+from typing import TYPE_CHECKING, Callable, Optional, Sequence, Unionimport numpy as np@@ -27,8 +29,8 @@ class AnimationGroup(Animation):def __init__(self,*animations: Animation,- group: Union[Group, "VGroup", OpenGLGroup, "OpenGLVGroup"] = None,- run_time: Optional[float] = None,+ group: Group | VGroup | OpenGLGroup | OpenGLVGroup = None,+ run_time: float | None = None,rate_func: Callable[[float], float] = linear,lag_ratio: float = 0,**kwargs@@ -128,9 +130,9 @@ class Succession(AnimationGroup):def update_active_animation(self, index: int) -> None:self.active_index = indexif index >= len(self.animations):- self.active_animation: Optional[Animation] = None- self.active_start_time: Optional[float] = None- self.active_end_time: Optional[float] = None+ self.active_animation: Animation | None = None+ self.active_start_time: float | None = None+ self.active_end_time: float | None = Noneelse:self.active_animation = self.animations[index]self.active_animation.begin()diff --git a/manim/animation/creation.py b/manim/animation/creation.pyindex 4a8a2115c..61d21f277 100644--- a/manim/animation/creation.py+++ b/manim/animation/creation.py@@ -1,3 +1,5 @@+from __future__ import annotations+r"""Animate the display or removal of a mobject from a scene... manim:: CreationModule@@ -113,7 +115,7 @@ class ShowPartial(Animation):"""def __init__(- self, mobject: Union[VMobject, OpenGLVMobject, OpenGLSurface, None], **kwargs+ self, mobject: VMobject | OpenGLVMobject | OpenGLSurface | None, **kwargs):pointwise = getattr(mobject, "pointwise_become_partial", None)if not callable(pointwise):@@ -163,13 +165,13 @@ class Create(ShowPartial):def __init__(self,- mobject: Union[VMobject, OpenGLVMobject, OpenGLSurface],+ mobject: VMobject | OpenGLVMobject | OpenGLSurface,lag_ratio: float = 1.0,**kwargs,) -> None:super().__init__(mobject, lag_ratio=lag_ratio, **kwargs)- def _get_bounds(self, alpha: float) -> Tuple[int, float]:+ def _get_bounds(self, alpha: float) -> tuple[int, float]:return (0, alpha)@@ -192,7 +194,7 @@ class Uncreate(Create):def __init__(self,- mobject: Union[VMobject, OpenGLVMobject],+ mobject: VMobject | OpenGLVMobject,rate_func: Callable[[float], float] = lambda t: smooth(1 - t),remover: bool = True,**kwargs,@@ -214,13 +216,13 @@ class DrawBorderThenFill(Animation):def __init__(self,- vmobject: Union[VMobject, OpenGLVMobject],+ vmobject: VMobject | OpenGLVMobject,run_time: float = 2,rate_func: Callable[[float], float] = double_smooth,stroke_width: float = 2,stroke_color: str = None,- draw_border_animation_config: Dict = {}, # what does this dict accept?- fill_animation_config: Dict = {},+ draw_border_animation_config: dict = {}, # what does this dict accept?+ fill_animation_config: dict = {},**kwargs,) -> None:self._typecheck_input(vmobject)@@ -231,7 +233,7 @@ class DrawBorderThenFill(Animation):self.fill_animation_config = fill_animation_configself.outline = self.get_outline()- def _typecheck_input(self, vmobject: Union[VMobject, OpenGLVMobject]) -> None:+ def _typecheck_input(self, vmobject: VMobject | OpenGLVMobject) -> None:if not isinstance(vmobject, (VMobject, OpenGLVMobject)):raise TypeError("DrawBorderThenFill only works for vectorized Mobjects")@@ -246,7 +248,7 @@ class DrawBorderThenFill(Animation):sm.set_stroke(color=self.get_stroke_color(sm), width=self.stroke_width)return outline- def get_stroke_color(self, vmobject: Union[VMobject, OpenGLVMobject]) -> Color:+ def get_stroke_color(self, vmobject: VMobject | OpenGLVMobject) -> Color:if self.stroke_color:return self.stroke_colorelif vmobject.get_stroke_width() > 0:@@ -293,13 +295,13 @@ class Write(DrawBorderThenFill):def __init__(self,- vmobject: Union[VMobject, OpenGLVMobject],+ vmobject: VMobject | OpenGLVMobject,rate_func: Callable[[float], float] = linear,reverse: bool = False,**kwargs,) -> None:- run_time: Optional[float] = kwargs.pop("run_time", None)- lag_ratio: Optional[float] = kwargs.pop("lag_ratio", None)+ run_time: float | None = kwargs.pop("run_time", None)+ lag_ratio: float | None = kwargs.pop("lag_ratio", None)run_time, lag_ratio = self._set_default_config_from_length(vmobject,run_time,@@ -316,10 +318,10 @@ class Write(DrawBorderThenFill):def _set_default_config_from_length(self,- vmobject: Union[VMobject, OpenGLVMobject],- run_time: Optional[float],- lag_ratio: Optional[float],- ) -> Tuple[float, float]:+ vmobject: VMobject | OpenGLVMobject,+ run_time: float | None,+ lag_ratio: float | None,+ ) -> tuple[float, float]:length = len(vmobject.family_members_with_points())if run_time is None:if length < 15:@@ -380,8 +382,8 @@ class Unwrite(Write):**kwargs,) -> None:- run_time: Optional[float] = kwargs.pop("run_time", None)- lag_ratio: Optional[float] = kwargs.pop("lag_ratio", None)+ run_time: float | None = kwargs.pop("run_time", None)+ lag_ratio: float | None = kwargs.pop("lag_ratio", None)run_time, lag_ratio = self._set_default_config_from_length(vmobject,run_time,@@ -454,12 +456,12 @@ class AddTextLetterByLetter(ShowIncreasingSubsets):def __init__(self,- text: "Text",+ text: Text,suspend_mobject_updating: bool = False,int_func: Callable[[np.ndarray], np.ndarray] = np.ceil,rate_func: Callable[[float], float] = linear,time_per_char: float = 0.1,- run_time: Optional[float] = None,+ run_time: float | None = None,**kwargs,) -> None:# time_per_char must be above 0.06, or the animation won't finish@@ -503,7 +505,7 @@ class AddTextWordByWord(Succession):def __init__(self,- text_mobject: "Text",+ text_mobject: Text,run_time: float = None,time_per_char: float = 0.06,**kwargs,diff --git a/manim/animation/fading.py b/manim/animation/fading.pyindex b5125a745..8ee3d551b 100644--- a/manim/animation/fading.py+++ b/manim/animation/fading.py@@ -13,6 +13,8 @@"""+from __future__ import annotations+__all__ = ["FadeOut","FadeIn",@@ -51,8 +53,8 @@ class _Fade(Transform):def __init__(self,*mobjects: Mobject,- shift: Optional[np.ndarray] = None,- target_position: Optional[Union[np.ndarray, Mobject]] = None,+ shift: np.ndarray | None = None,+ target_position: np.ndarray | Mobject | None = None,scale: float = 1,**kwargs) -> None:diff --git a/manim/animation/growing.py b/manim/animation/growing.pyindex f99b72470..137d0c21b 100644--- a/manim/animation/growing.py+++ b/manim/animation/growing.py@@ -21,6 +21,8 @@"""+from __future__ import annotations+__all__ = ["GrowFromPoint","GrowFromCenter",@@ -73,16 +75,16 @@ class GrowFromPoint(Transform):"""def __init__(- self, mobject: "Mobject", point: np.ndarray, point_color: str = None, **kwargs+ self, mobject: Mobject, point: np.ndarray, point_color: str = None, **kwargs) -> None:self.point = pointself.point_color = point_colorsuper().__init__(mobject, **kwargs)- def create_target(self) -> "Mobject":+ def create_target(self) -> Mobject:return self.mobject- def create_starting_mobject(self) -> "Mobject":+ def create_starting_mobject(self) -> Mobject:start = super().create_starting_mobject()start.scale(0)start.move_to(self.point)@@ -115,7 +117,7 @@ class GrowFromCenter(GrowFromPoint):"""- def __init__(self, mobject: "Mobject", point_color: str = None, **kwargs) -> None:+ def __init__(self, mobject: Mobject, point_color: str = None, **kwargs) -> None:point = mobject.get_center()super().__init__(mobject, point, point_color=point_color, **kwargs)@@ -150,7 +152,7 @@ class GrowFromEdge(GrowFromPoint):"""def __init__(- self, mobject: "Mobject", edge: np.ndarray, point_color: str = None, **kwargs+ self, mobject: Mobject, edge: np.ndarray, point_color: str = None, **kwargs) -> None:point = mobject.get_critical_point(edge)super().__init__(mobject, point, point_color=point_color, **kwargs)@@ -180,11 +182,11 @@ class GrowArrow(GrowFromPoint):"""- def __init__(self, arrow: "Arrow", point_color: str = None, **kwargs) -> None:+ def __init__(self, arrow: Arrow, point_color: str = None, **kwargs) -> None:point = arrow.get_start()super().__init__(arrow, point, point_color=point_color, **kwargs)- def create_starting_mobject(self) -> "Mobject":+ def create_starting_mobject(self) -> Mobject:start_arrow = self.mobject.copy()start_arrow.scale(0, scale_tips=True, about_point=self.point)if self.point_color:@@ -221,11 +223,7 @@ class SpinInFromNothing(GrowFromCenter):"""def __init__(- self,- mobject: "Mobject",- angle: float = PI / 2,- point_color: str = None,- **kwargs+ self, mobject: Mobject, angle: float = PI / 2, point_color: str = None, **kwargs) -> None:self.angle = anglesuper().__init__(diff --git a/manim/animation/movement.py b/manim/animation/movement.pyindex 409dab85a..e3ecb110a 100644--- a/manim/animation/movement.py+++ b/manim/animation/movement.py@@ -1,5 +1,7 @@"""Animations related to movement."""+from __future__ import annotations+__all__ = ["Homotopy","SmoothedVectorizedHomotopy",@@ -22,10 +24,10 @@ if TYPE_CHECKING:class Homotopy(Animation):def __init__(self,- homotopy: Callable[[float, float, float, float], Tuple[float, float, float]],- mobject: "Mobject",+ homotopy: Callable[[float, float, float, float], tuple[float, float, float]],+ mobject: Mobject,run_time: float = 3,- apply_function_kwargs: Optional[Dict[str, Any]] = None,+ apply_function_kwargs: dict[str, Any] | None = None,**kwargs) -> None:"""@@ -38,13 +40,13 @@ class Homotopy(Animation):)super().__init__(mobject, run_time=run_time, **kwargs)- def function_at_time_t(self, t: float) -> Tuple[float, float, float]:+ def function_at_time_t(self, t: float) -> tuple[float, float, float]:return lambda p: self.homotopy(*p, t)def interpolate_submobject(self,- submobject: "Mobject",- starting_submobject: "Mobject",+ submobject: Mobject,+ starting_submobject: Mobject,alpha: float,) -> None:submobject.points = starting_submobject.points@@ -56,8 +58,8 @@ class Homotopy(Animation):class SmoothedVectorizedHomotopy(Homotopy):def interpolate_submobject(self,- submobject: "Mobject",- starting_submobject: "Mobject",+ submobject: Mobject,+ starting_submobject: Mobject,alpha: float,) -> None:super().interpolate_submobject(submobject, starting_submobject, alpha)@@ -66,7 +68,7 @@ class SmoothedVectorizedHomotopy(Homotopy):class ComplexHomotopy(Homotopy):def __init__(- self, complex_homotopy: Callable[[complex], float], mobject: "Mobject", **kwargs+ self, complex_homotopy: Callable[[complex], float], mobject: Mobject, **kwargs) -> None:"""Complex Homotopy a function Cx[0, 1] to C@@ -77,7 +79,7 @@ class ComplexHomotopy(Homotopy):y: float,z: float,t: float,- ) -> Tuple[float, float, float]:+ ) -> tuple[float, float, float]:c = complex_homotopy(complex(x, y), t)return (c.real, c.imag, z)@@ -88,7 +90,7 @@ class PhaseFlow(Animation):def __init__(self,function: Callable[[np.ndarray], np.ndarray],- mobject: "Mobject",+ mobject: Mobject,virtual_time: float = 1,suspend_mobject_updating: bool = False,rate_func: Callable[[float], float] = linear,@@ -130,9 +132,9 @@ class MoveAlongPath(Animation):def __init__(self,- mobject: "Mobject",- path: "VMobject",- suspend_mobject_updating: Optional[bool] = False,+ mobject: Mobject,+ path: VMobject,+ suspend_mobject_updating: bool | None = False,**kwargs) -> None:self.path = pathdiff --git a/manim/animation/numbers.py b/manim/animation/numbers.pyindex 57b388617..814319613 100644--- a/manim/animation/numbers.py+++ b/manim/animation/numbers.py@@ -1,5 +1,7 @@"""Animations for changing numbers."""+from __future__ import annotations+__all__ = ["ChangingDecimal", "ChangeDecimalToValue"]@@ -15,7 +17,7 @@ class ChangingDecimal(Animation):self,decimal_mob: DecimalNumber,number_update_func: typing.Callable[[float], float],- suspend_mobject_updating: typing.Optional[bool] = False,+ suspend_mobject_updating: bool | None = False,**kwargs,) -> None:self.check_validity_of_input(decimal_mob)diff --git a/manim/animation/rotation.py b/manim/animation/rotation.pyindex d8d308dfa..6dfd970f0 100644--- a/manim/animation/rotation.py+++ b/manim/animation/rotation.py@@ -1,5 +1,7 @@"""Animations related to rotation."""+from __future__ import annotations+__all__ = ["Rotating", "Rotate"]import typing@@ -19,11 +21,11 @@ if typing.TYPE_CHECKING:class Rotating(Animation):def __init__(self,- mobject: "Mobject",+ mobject: Mobject,axis: np.ndarray = OUT,radians: np.ndarray = TAU,- about_point: Optional[np.ndarray] = None,- about_edge: Optional[np.ndarray] = None,+ about_point: np.ndarray | None = None,+ about_edge: np.ndarray | None = None,run_time: float = 5,rate_func: Callable[[float], float] = linear,**kwargs@@ -47,11 +49,11 @@ class Rotating(Animation):class Rotate(Transform):def __init__(self,- mobject: "Mobject",+ mobject: Mobject,angle: np.ndarray = PI,axis: np.ndarray = OUT,- about_point: Optional[Sequence[float]] = None,- about_edge: Optional[Sequence[float]] = None,+ about_point: Sequence[float] | None = None,+ about_edge: Sequence[float] | None = None,**kwargs) -> None:if "path_arc" not in kwargs:@@ -66,7 +68,7 @@ class Rotate(Transform):self.about_point = mobject.get_center()super().__init__(mobject, path_arc_centers=self.about_point, **kwargs)- def create_target(self) -> "Mobject":+ def create_target(self) -> Mobject:target = self.mobject.copy()target.rotate(self.angle,diff --git a/manim/animation/specialized.py b/manim/animation/specialized.pyindex 8d184e269..7f8ce5973 100644--- a/manim/animation/specialized.py+++ b/manim/animation/specialized.py@@ -1,3 +1,5 @@+from __future__ import annotations+__all__ = ["Broadcast"]from typing import Any, Sequencediff --git a/manim/animation/transform.py b/manim/animation/transform.pyindex 1c92f07fc..ec2791942 100644--- a/manim/animation/transform.py+++ b/manim/animation/transform.py@@ -1,5 +1,7 @@"""Animations transforming one mobject into another."""+from __future__ import annotations+__all__ = ["Transform","ReplacementTransform",@@ -45,9 +47,9 @@ if TYPE_CHECKING:class Transform(Animation):def __init__(self,- mobject: Optional[Mobject],- target_mobject: Optional[Mobject] = None,- path_func: Optional[Callable] = None,+ mobject: Mobject | None,+ target_mobject: Mobject | None = None,+ path_func: Callable | None = None,path_arc: float = 0,path_arc_axis: np.ndarray = OUT,path_arc_centers: np.ndarray = None,@@ -65,7 +67,7 @@ class Transform(Animation):self.path_arc_axis,)- self.path_func: Optional[Callable] = path_func+ self.path_func: Callable | None = path_funcself.replace_mobject_with_target_in_scene: bool = (replace_mobject_with_target_in_scene)@@ -125,7 +127,7 @@ class Transform(Animation):# in subclassesreturn self.target_mobject- def clean_up_from_scene(self, scene: "Scene") -> None:+ def clean_up_from_scene(self, scene: Scene) -> None:super().clean_up_from_scene(scene)if self.replace_mobject_with_target_in_scene:scene.remove(self.mobject)@@ -155,7 +157,7 @@ class Transform(Animation):starting_submobject: Mobject,target_copy: Mobject,alpha: float,- ) -> "Transform":+ ) -> Transform:submobject.interpolate(starting_submobject, target_copy, alpha, self.path_func)return selfdiff --git a/manim/animation/transform_matching_parts.py b/manim/animation/transform_matching_parts.pyindex b352990b5..f447a7ac5 100644--- a/manim/animation/transform_matching_parts.py+++ b/manim/animation/transform_matching_parts.py@@ -1,5 +1,7 @@"""Animations that try to transform Mobjects while keeping track of identical parts."""+from __future__ import annotations+__all__ = ["TransformMatchingShapes", "TransformMatchingTex"]from typing import TYPE_CHECKING, List, Optional@@ -65,11 +67,11 @@ class TransformMatchingAbstractBase(AnimationGroup):def __init__(self,- mobject: "Mobject",- target_mobject: "Mobject",+ mobject: Mobject,+ target_mobject: Mobject,transform_mismatches: bool = False,fade_transform_mismatches: bool = False,- key_map: Optional[dict] = None,+ key_map: dict | None = None,**kwargs):@@ -137,7 +139,7 @@ class TransformMatchingAbstractBase(AnimationGroup):self.to_remove = mobjectself.to_add = target_mobject- def get_shape_map(self, mobject: "Mobject") -> dict:+ def get_shape_map(self, mobject: Mobject) -> dict:shape_map = {}for sm in self.get_mobject_parts(mobject):key = self.get_mobject_key(sm)@@ -149,7 +151,7 @@ class TransformMatchingAbstractBase(AnimationGroup):shape_map[key].add(sm)return shape_map- def clean_up_from_scene(self, scene: "Scene") -> None:+ def clean_up_from_scene(self, scene: Scene) -> None:for anim in self.animations:anim.interpolate(0)scene.remove(self.mobject)@@ -157,11 +159,11 @@ class TransformMatchingAbstractBase(AnimationGroup):scene.add(self.to_add)@staticmethod- def get_mobject_parts(mobject: "Mobject"):+ def get_mobject_parts(mobject: Mobject):raise NotImplementedError("To be implemented in subclass.")@staticmethod- def get_mobject_key(mobject: "Mobject"):+ def get_mobject_key(mobject: Mobject):raise NotImplementedError("To be implemented in subclass.")@@ -196,11 +198,11 @@ class TransformMatchingShapes(TransformMatchingAbstractBase):def __init__(self,- mobject: "Mobject",- target_mobject: "Mobject",+ mobject: Mobject,+ target_mobject: Mobject,transform_mismatches: bool = False,fade_transform_mismatches: bool = False,- key_map: Optional[dict] = None,+ key_map: dict | None = None,**kwargs):super().__init__(@@ -213,11 +215,11 @@ class TransformMatchingShapes(TransformMatchingAbstractBase):)@staticmethod- def get_mobject_parts(mobject: "Mobject") -> List["Mobject"]:+ def get_mobject_parts(mobject: Mobject) -> list[Mobject]:return mobject.family_members_with_points()@staticmethod- def get_mobject_key(mobject: "Mobject") -> int:+ def get_mobject_key(mobject: Mobject) -> int:mobject.save_state()mobject.center()mobject.set_height(1)@@ -253,11 +255,11 @@ class TransformMatchingTex(TransformMatchingAbstractBase):def __init__(self,- mobject: "Mobject",- target_mobject: "Mobject",+ mobject: Mobject,+ target_mobject: Mobject,transform_mismatches: bool = False,fade_transform_mismatches: bool = False,- key_map: Optional[dict] = None,+ key_map: dict | None = None,**kwargs):assert hasattr(mobject, "tex_string")@@ -272,9 +274,9 @@ class TransformMatchingTex(TransformMatchingAbstractBase):)@staticmethod- def get_mobject_parts(mobject: "Mobject") -> List["Mobject"]:+ def get_mobject_parts(mobject: Mobject) -> list[Mobject]:return mobject.submobjects@staticmethod- def get_mobject_key(mobject: "Mobject") -> str:+ def get_mobject_key(mobject: Mobject) -> str:return mobject.tex_stringdiff --git a/manim/animation/update.py b/manim/animation/update.pyindex d1b57c9c5..11d6dc3c3 100644--- a/manim/animation/update.py+++ b/manim/animation/update.py@@ -1,5 +1,7 @@"""Animations that update mobjects."""+from __future__ import annotations+__all__ = ["UpdateFromFunc", "UpdateFromAlphaFunc", "MaintainPositionRelativeTo"]@@ -21,8 +23,8 @@ class UpdateFromFunc(Animation):def __init__(self,- mobject: "Mobject",- update_function: typing.Callable[["Mobject"], typing.Any],+ mobject: Mobject,+ update_function: typing.Callable[[Mobject], typing.Any],suspend_mobject_updating: bool = False,**kwargs) -> None:@@ -41,9 +43,7 @@ class UpdateFromAlphaFunc(UpdateFromFunc):class MaintainPositionRelativeTo(Animation):- def __init__(- self, mobject: "Mobject", tracked_mobject: "Mobject", **kwargs- ) -> None:+ def __init__(self, mobject: Mobject, tracked_mobject: Mobject, **kwargs) -> None:self.tracked_mobject = tracked_mobjectself.diff = op.sub(mobject.get_center(),diff --git a/manim/camera/camera.py b/manim/camera/camera.pyindex 90b22932e..1ff039e8c 100644--- a/manim/camera/camera.py+++ b/manim/camera/camera.py@@ -1,6 +1,8 @@"""A camera converts the mobjects contained in a Scene into an array of pixels."""+from __future__ import annotations+__all__ = ["Camera", "BackgroundColoredVMobjectDisplayer"]import copy@@ -1246,7 +1248,7 @@ class BackgroundColoredVMobjectDisplayer:mode = "RGBA" if pixel_array.shape[2] == 4 else "RGB"return self.resize_background_array(background_array, width, height, mode)- def get_background_array(self, image: Union[Image.Image, pathlib.Path, str]):+ def get_background_array(self, image: Image.Image | pathlib.Path | str):"""Gets the background array that has the passed file_name.Parametersdiff --git a/manim/camera/mapping_camera.py b/manim/camera/mapping_camera.pyindex e08b86b8a..86bf835cb 100644--- a/manim/camera/mapping_camera.py+++ b/manim/camera/mapping_camera.py@@ -1,5 +1,7 @@"""A camera that allows mapping between objects."""+from __future__ import annotations+__all__ = ["MappingCamera", "OldMultiCamera", "SplitScreenCamera"]import mathdiff --git a/manim/camera/moving_camera.py b/manim/camera/moving_camera.pyindex 98bb7755e..2df9f31fc 100644--- a/manim/camera/moving_camera.py+++ b/manim/camera/moving_camera.py@@ -6,6 +6,8 @@"""+from __future__ import annotations+__all__ = ["CameraFrame", "MovingCamera"]from .. import configdiff --git a/manim/camera/multi_camera.py b/manim/camera/multi_camera.pyindex 81e832888..87b747296 100644--- a/manim/camera/multi_camera.py+++ b/manim/camera/multi_camera.py@@ -1,5 +1,7 @@"""A camera supporting multiple perspectives."""+from __future__ import annotations+__all__ = ["MultiCamera"]diff --git a/manim/camera/three_d_camera.py b/manim/camera/three_d_camera.pyindex f3835e27d..5a60c1a5a 100644--- a/manim/camera/three_d_camera.py+++ b/manim/camera/three_d_camera.py@@ -1,5 +1,7 @@"""A camera that can be positioned and oriented in three-dimensional space."""+from __future__ import annotations+__all__ = ["ThreeDCamera"]diff --git a/manim/camera/webgl_camera.py b/manim/camera/webgl_camera.pyindex fdcc0a123..adf4203d2 100644--- a/manim/camera/webgl_camera.py+++ b/manim/camera/webgl_camera.py@@ -1,3 +1,5 @@+from __future__ import annotations+import copyfrom .camera import Cameradiff --git a/manim/cli/cfg/group.py b/manim/cli/cfg/group.pyindex 4e6c1c4ec..2da13e029 100644--- a/manim/cli/cfg/group.py+++ b/manim/cli/cfg/group.py@@ -5,6 +5,8 @@ cfg``. Here you can specify options, subcommands, and subgroups for the cfggroup."""+from __future__ import annotations+import osfrom ast import literal_evalfrom typing import Union@@ -26,7 +28,7 @@ If left empty, the default colour will be used.[/red]RICH_NON_STYLE_ENTRIES: str = ["log.width", "log.height", "log.timestamps"]-def value_from_string(value: str) -> Union[str, int, bool]:+def value_from_string(value: str) -> str | int | bool:"""Extracts the literal of proper datatype from a string.Parameters----------diff --git a/manim/cli/init/commands.py b/manim/cli/init/commands.pyindex c118c056a..d619730de 100644--- a/manim/cli/init/commands.py+++ b/manim/cli/init/commands.py@@ -5,6 +5,8 @@ init``. Here you can specify options, subcommands, and subgroups for the initgroup."""+from __future__ import annotations+from pathlib import Pathimport clickdiff --git a/manim/cli/new/group.py b/manim/cli/new/group.pyindex 07ffba2b0..d53bcf469 100644--- a/manim/cli/new/group.py+++ b/manim/cli/new/group.py@@ -1,3 +1,5 @@+from __future__ import annotations+import configparserfrom pathlib import Pathdiff --git a/manim/cli/plugins/commands.py b/manim/cli/plugins/commands.pyindex b9a70959a..06c4c42e5 100644--- a/manim/cli/plugins/commands.py+++ b/manim/cli/plugins/commands.py@@ -5,6 +5,8 @@ plugin``. Here you can specify options, subcommands, and subgroups for the plugigroup."""+from __future__ import annotations+import clickfrom ...constants import CONTEXT_SETTINGS, EPILOGdiff --git a/manim/cli/render/commands.py b/manim/cli/render/commands.pyindex a5f3fc2cd..f06344dbe 100644--- a/manim/cli/render/commands.py+++ b/manim/cli/render/commands.py@@ -5,6 +5,8 @@ Manim's render subcommand is accessed in the command-line interface viacan specify options, and arguments for the render command."""+from __future__ import annotations+import jsonimport sysfrom pathlib import Pathdiff --git a/manim/cli/render/ease_of_access_options.py b/manim/cli/render/ease_of_access_options.pyindex bd3b858ac..15cee6f55 100644--- a/manim/cli/render/ease_of_access_options.py+++ b/manim/cli/render/ease_of_access_options.py@@ -1,3 +1,5 @@+from __future__ import annotations+import clickfrom cloup import option, option_groupdiff --git a/manim/cli/render/global_options.py b/manim/cli/render/global_options.pyindex 5d1d59848..422a57c11 100644--- a/manim/cli/render/global_options.py+++ b/manim/cli/render/global_options.py@@ -1,3 +1,5 @@+from __future__ import annotations+import reimport clickdiff --git a/manim/cli/render/output_options.py b/manim/cli/render/output_options.pyindex 69ed56d89..994bc9c4e 100644--- a/manim/cli/render/output_options.py+++ b/manim/cli/render/output_options.py@@ -1,3 +1,5 @@+from __future__ import annotations+import clickfrom cloup import option, option_groupdiff --git a/manim/cli/render/render_options.py b/manim/cli/render/render_options.pyindex ca05386fa..4bc67f833 100644--- a/manim/cli/render/render_options.py+++ b/manim/cli/render/render_options.py@@ -1,3 +1,5 @@+from __future__ import annotations+import reimport clickdiff --git a/manim/communitycolors.py b/manim/communitycolors.pyindex f03bfee11..c68d16e5e 100644--- a/manim/communitycolors.py+++ b/manim/communitycolors.py@@ -1,5 +1,7 @@"""The colormap of manim community"""+from __future__ import annotations+LOGO_WHITE = "#ece6e2"LOGO_GREEN = "#87c2a5"LOGO_BLUE = "#525893"diff --git a/manim/constants.py b/manim/constants.pyindex 8200ffdca..ee11d553d 100644--- a/manim/constants.py+++ b/manim/constants.py@@ -2,6 +2,8 @@Constant definitions."""+from __future__ import annotations+import typingimport numpy as np@@ -208,7 +210,7 @@ FFMPEG_BIN: str = "ffmpeg"# gif stuffGIF_FILE_EXTENSION: str = ".gif"-FFMPEG_VERBOSITY_MAP: typing.Dict[str, str] = {+FFMPEG_VERBOSITY_MAP: dict[str, str] = {"DEBUG": "error","INFO": "error","WARNING": "error",@@ -224,7 +226,7 @@ WEBGL_RENDERER_INFO: str = ()# Video qualities-QUALITIES: typing.Dict[str, typing.Dict[str, typing.Union[str, int, None]]] = {+QUALITIES: dict[str, dict[str, str | int | None]] = {"fourk_quality": {"flag": "k","pixel_height": 2160,diff --git a/manim/grpc/gen/__init__.py b/manim/grpc/gen/__init__.pyindex 2118145a3..9eeae2a7f 100644--- a/manim/grpc/gen/__init__.py+++ b/manim/grpc/gen/__init__.py@@ -1,5 +1,7 @@# https://github.com/protocolbuffers/protobuf/issues/1491#issuecomment-547504972+from __future__ import annotations+import sysfrom pathlib import Pathdiff --git a/manim/grpc/gen/frameserver_pb2.py b/manim/grpc/gen/frameserver_pb2.pyindex c226411e5..571eba345 100644--- a/manim/grpc/gen/frameserver_pb2.py+++ b/manim/grpc/gen/frameserver_pb2.py@@ -1,6 +1,8 @@# Generated by the protocol buffer compiler. DO NOT EDIT!# source: frameserver.proto"""Generated protocol buffer code."""+from __future__ import annotations+from google.protobuf import descriptor as _descriptorfrom google.protobuf import message as _messagefrom google.protobuf import reflection as _reflectiondiff --git a/manim/grpc/gen/frameserver_pb2_grpc.py b/manim/grpc/gen/frameserver_pb2_grpc.pyindex cdfe6234d..b21b7c427 100644--- a/manim/grpc/gen/frameserver_pb2_grpc.py+++ b/manim/grpc/gen/frameserver_pb2_grpc.py@@ -1,5 +1,7 @@# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!"""Client and server classes corresponding to protobuf-defined services."""+from __future__ import annotations+import frameserver_pb2 as frameserver__pb2import grpcdiff --git a/manim/grpc/gen/renderserver_pb2.py b/manim/grpc/gen/renderserver_pb2.pyindex aad9d3b11..051be04c8 100644--- a/manim/grpc/gen/renderserver_pb2.py+++ b/manim/grpc/gen/renderserver_pb2.py@@ -1,6 +1,8 @@# Generated by the protocol buffer compiler. DO NOT EDIT!# source: renderserver.proto"""Generated protocol buffer code."""+from __future__ import annotations+from google.protobuf import descriptor as _descriptorfrom google.protobuf import message as _messagefrom google.protobuf import reflection as _reflectiondiff --git a/manim/grpc/gen/renderserver_pb2_grpc.py b/manim/grpc/gen/renderserver_pb2_grpc.pyindex 0c031b8da..a195961f5 100644--- a/manim/grpc/gen/renderserver_pb2_grpc.py+++ b/manim/grpc/gen/renderserver_pb2_grpc.py@@ -1,5 +1,7 @@# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!"""Client and server classes corresponding to protobuf-defined services."""+from __future__ import annotations+import grpcimport renderserver_pb2 as renderserver__pb2diff --git a/manim/grpc/impl/frame_server_impl.py b/manim/grpc/impl/frame_server_impl.pyindex b3e4b24eb..7acef3571 100644--- a/manim/grpc/impl/frame_server_impl.py+++ b/manim/grpc/impl/frame_server_impl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import copyimport subprocess as spimport tracebackdiff --git a/manim/gui/gui.py b/manim/gui/gui.pyindex aebc1ef87..032a9183d 100644--- a/manim/gui/gui.py+++ b/manim/gui/gui.py@@ -1,3 +1,5 @@+from __future__ import annotations+from pathlib import Pathtry:diff --git a/manim/mobject/boolean_ops.py b/manim/mobject/boolean_ops.pyindex fe14a8778..56b669016 100644--- a/manim/mobject/boolean_ops.py+++ b/manim/mobject/boolean_ops.py@@ -1,3 +1,5 @@+from __future__ import annotations+import typingimport numpy as np@@ -24,7 +26,7 @@ class _BooleanOps(VMobject, metaclass=ConvertToOpenGL):self,points: typing.Iterable,z_dim: float = 0.0,- ) -> typing.List[np.ndarray]:+ ) -> list[np.ndarray]:"""Converts an iterable with coordinates in 2d to 3d by adding:attr:`z_dim` as the z coordinate.diff --git a/manim/mobject/changing.py b/manim/mobject/changing.pyindex f8f30f2fa..3e03170af 100644--- a/manim/mobject/changing.py+++ b/manim/mobject/changing.py@@ -1,5 +1,7 @@"""Animation of a mobject boundary and tracing of points."""+from __future__ import annotations+__all__ = ["AnimatedBoundary", "TracedPath"]from typing import Callable, Optional@@ -140,7 +142,7 @@ class TracedPath(VMobject, metaclass=ConvertToOpenGL):traced_point_func: Callable,stroke_width: float = 2,stroke_color: Color = WHITE,- dissipating_time: Optional[float] = None,+ dissipating_time: float | None = None,**kwargs):super().__init__(stroke_color=stroke_color, stroke_width=stroke_width, **kwargs)diff --git a/manim/mobject/coordinate_systems.py b/manim/mobject/coordinate_systems.pyindex 57c2cb6ee..0a402f269 100644--- a/manim/mobject/coordinate_systems.py+++ b/manim/mobject/coordinate_systems.py@@ -1,6 +1,8 @@"""Mobjects that represent coordinate systems."""+from __future__ import annotations+__all__ = ["CoordinateSystem","Axes",@@ -184,7 +186,7 @@ class CoordinateSystem:"""return self.coords_to_point(radius * np.cos(azimuth), radius * np.sin(azimuth))- def point_to_polar(self, point: np.ndarray) -> Tuple[float, float]:+ def point_to_polar(self, point: np.ndarray) -> tuple[float, float]:r"""Gets polar coordinates from a point.Parameters@@ -212,7 +214,7 @@ class CoordinateSystem:"""Abbreviation for :meth:`polar_to_point`"""return self.polar_to_point(radius, azimuth)- def pt2pr(self, point: np.ndarray) -> Tuple[float, float]:+ def pt2pr(self, point: np.ndarray) -> tuple[float, float]:"""Abbreviation for :meth:`point_to_polar`"""return self.point_to_polar(point)@@ -249,12 +251,12 @@ class CoordinateSystem:def get_x_axis_label(self,- label: Union[float, str, "Mobject"],+ label: float | str | Mobject,edge: Sequence[float] = UR,direction: Sequence[float] = UR,buff: float = SMALL_BUFF,**kwargs,- ) -> "Mobject":+ ) -> Mobject:"""Generate an x-axis label.Examples@@ -293,7 +295,7 @@ class CoordinateSystem:def get_y_axis_label(self,- label: Union[float, str, "Mobject"],+ label: float | str | Mobject,edge: Sequence[float] = UR,direction: Sequence[float] = UP * 0.5 + RIGHT,buff: float = SMALL_BUFF,@@ -341,12 +343,12 @@ class CoordinateSystem:def _get_axis_label(self,- label: Union[float, str, "Mobject"],- axis: "Mobject",+ label: float | str | Mobject,+ axis: Mobject,edge: Sequence[float],direction: Sequence[float],buff: float = SMALL_BUFF,- ) -> "Mobject":+ ) -> Mobject:"""Gets the label for an axis.Parameters@@ -375,8 +377,8 @@ class CoordinateSystem:def get_axis_labels(self,- x_label: Union[float, str, "Mobject"] = "x",- y_label: Union[float, str, "Mobject"] = "y",+ x_label: float | str | Mobject = "x",+ y_label: float | str | Mobject = "y",) -> VGroup:"""Defines labels for the x_axis and y_axis of the graph. For increased control over the position of the labels,use :meth:`get_x_axis_label` and :meth:`get_y_axis_label`.@@ -421,10 +423,7 @@ class CoordinateSystem:def add_coordinates(self,- *axes_numbers: Union[- Optional[Iterable[float]],- Union[Dict[float, Union[str, float, "Mobject"]]],- ],+ *axes_numbers: (Iterable[float] | None | dict[float, str | float | Mobject]),**kwargs,):"""Adds labels to the axes. Use ``Axes.coordinate_labels`` to@@ -487,10 +486,10 @@ class CoordinateSystem:index: int,point: Sequence[float],line_func: Line = DashedLine,- line_config: Optional[Dict] = None,+ line_config: dict | None = None,color: Color = LIGHT_GREY,stroke_width: float = 2,- ) -> "Line":+ ) -> Line:"""Returns a straight line from a given axis to a point in the scene.Parameters@@ -525,7 +524,7 @@ class CoordinateSystem:line = line_func(axis.get_projection(point), point, **line_config)return line- def get_vertical_line(self, point: Sequence[float], **kwargs) -> "Line":+ def get_vertical_line(self, point: Sequence[float], **kwargs) -> Line:"""A vertical line from the x-axis to a given point in the scene.Examples@@ -559,7 +558,7 @@ class CoordinateSystem:"""return self.get_line_from_axis_to_point(0, point, **kwargs)- def get_horizontal_line(self, point: Sequence[float], **kwargs) -> "Line":+ def get_horizontal_line(self, point: Sequence[float], **kwargs) -> Line:"""A horizontal line from the y-axis to a given point in the scene.Examples@@ -640,7 +639,7 @@ class CoordinateSystem:def plot(self,function: Callable[[float], float],- x_range: Optional[Sequence[float]] = None,+ x_range: Sequence[float] | None = None,**kwargs,):"""Generates a curve based on a function.@@ -831,7 +830,7 @@ class CoordinateSystem:def input_to_graph_point(self,x: float,- graph: Union["ParametricFunction", VMobject],+ graph: ParametricFunction | VMobject,) -> np.ndarray:"""Returns the coordinates of the point on a ``graph`` corresponding to an ``x`` value.@@ -888,7 +887,7 @@ class CoordinateSystem:f"x={x} not located in the range of the graph ([{self.p2c(graph.get_start())[0]}, {self.p2c(graph.get_end())[0]}])",)- def input_to_graph_coords(self, x: float, graph: "ParametricFunction") -> Tuple:+ def input_to_graph_coords(self, x: float, graph: ParametricFunction) -> tuple:"""Returns a tuple of the axis relative coordinates of the pointon the graph based on the x-value given.@@ -906,13 +905,13 @@ class CoordinateSystem:"""return x, graph.underlying_function(x)- def i2gc(self, x: float, graph: "ParametricFunction") -> Tuple:+ def i2gc(self, x: float, graph: ParametricFunction) -> tuple:"""Alias for :meth:`input_to_graph_coords`."""return self.input_to_graph_coords(x, graph)- def i2gp(self, x: float, graph: "ParametricFunction") -> np.ndarray:+ def i2gp(self, x: float, graph: ParametricFunction) -> np.ndarray:"""Alias for :meth:`input_to_graph_point`."""@@ -920,14 +919,14 @@ class CoordinateSystem:def get_graph_label(self,- graph: "ParametricFunction",- label: Union[float, str, "Mobject"] = "f(x)",- x_val: Optional[float] = None,+ graph: ParametricFunction,+ label: float | str | Mobject = "f(x)",+ x_val: float | None = None,direction: Sequence[float] = RIGHT,buff: float = MED_SMALL_BUFF,- color: Optional[Color] = None,+ color: Color | None = None,dot: bool = False,- dot_config: Optional[dict] = None,+ dot_config: dict | None = None,) -> Mobject:"""Creates a properly positioned label for the passed graph, with an optional dot.@@ -1004,16 +1003,16 @@ class CoordinateSystem:def get_riemann_rectangles(self,- graph: "ParametricFunction",- x_range: Optional[Sequence[float]] = None,- dx: Optional[float] = 0.1,+ graph: ParametricFunction,+ x_range: Sequence[float] | None = None,+ dx: float | None = 0.1,input_sample_type: str = "left",stroke_width: float = 1,stroke_color: Color = BLACK,fill_opacity: float = 1,- color: Union[Iterable[Color], Color] = np.array((BLUE, GREEN)),+ color: Iterable[Color] | Color = np.array((BLUE, GREEN)),show_signed_area: bool = True,- bounded_graph: "ParametricFunction" = None,+ bounded_graph: ParametricFunction = None,blend: bool = False,width_scale_factor: float = 1.001,) -> VGroup:@@ -1179,11 +1178,11 @@ class CoordinateSystem:def get_area(self,- graph: "ParametricFunction",- x_range: Optional[Tuple[float, float]] = None,- color: Union[Color, Iterable[Color]] = [BLUE, GREEN],+ graph: ParametricFunction,+ x_range: tuple[float, float] | None = None,+ color: Color | Iterable[Color] = [BLUE, GREEN],opacity: float = 0.3,- bounded_graph: "ParametricFunction" = None,+ bounded_graph: ParametricFunction = None,**kwargs,):"""Returns a :class:`~.Polygon` representing the area under the graph passed.@@ -1268,7 +1267,7 @@ class CoordinateSystem:def angle_of_tangent(self,x: float,- graph: "ParametricFunction",+ graph: ParametricFunction,dx: float = 1e-8,) -> float:"""Returns the angle to the x-axis of the tangent@@ -1304,9 +1303,7 @@ class CoordinateSystem:p1 = np.array([*self.input_to_graph_coords(x + dx, graph)])return angle_of_vector(p1 - p0)- def slope_of_tangent(- self, x: float, graph: "ParametricFunction", **kwargs- ) -> float:+ def slope_of_tangent(self, x: float, graph: ParametricFunction, **kwargs) -> float:"""Returns the slope of the tangent to the plotted curveat a particular x-value.@@ -1336,7 +1333,7 @@ class CoordinateSystem:return np.tan(self.angle_of_tangent(x, graph, **kwargs))def plot_derivative_graph(- self, graph: "ParametricFunction", color: Color = GREEN, **kwargs+ self, graph: ParametricFunction, color: Color = GREEN, **kwargs) -> ParametricFunction:"""Returns the curve of the derivative of the passed graph.@@ -1440,11 +1437,11 @@ class CoordinateSystem:self,x: float,graph: ParametricFunction,- dx: Optional[float] = None,+ dx: float | None = None,dx_line_color: Color = YELLOW,- dy_line_color: Optional[Color] = None,- dx_label: Optional[Union[float, str]] = None,- dy_label: Optional[Union[float, str]] = None,+ dy_line_color: Color | None = None,+ dx_label: float | str | None = None,+ dy_label: float | str | None = None,include_secant_line: bool = True,secant_line_color: Color = GREEN,secant_line_length: float = 10,@@ -1574,7 +1571,7 @@ class CoordinateSystem:def get_vertical_lines_to_graph(self,graph: ParametricFunction,- x_range: Optional[Sequence[float]] = None,+ x_range: Sequence[float] | None = None,num_lines: int = 20,**kwargs,) -> VGroup:@@ -1631,12 +1628,12 @@ class CoordinateSystem:def get_T_label(self,x_val: float,- graph: "ParametricFunction",- label: Optional[Union[float, str, "Mobject"]] = None,+ graph: ParametricFunction,+ label: float | str | Mobject | None = None,label_color: Color = WHITE,triangle_size: float = MED_SMALL_BUFF,triangle_color: Color = WHITE,- line_func: "Line" = Line,+ line_func: Line = Line,line_color: Color = YELLOW,) -> VGroup:"""Creates a labelled triangle marker with a vertical line from the x-axis@@ -1753,13 +1750,13 @@ class Axes(VGroup, CoordinateSystem, metaclass=ConvertToOpenGL):def __init__(self,- x_range: Optional[Sequence[float]] = None,- y_range: Optional[Sequence[float]] = None,- x_length: Optional[float] = round(config.frame_width) - 2,- y_length: Optional[float] = round(config.frame_height) - 2,- axis_config: Optional[dict] = None,- x_axis_config: Optional[dict] = None,- y_axis_config: Optional[dict] = None,+ x_range: Sequence[float] | None = None,+ y_range: Sequence[float] | None = None,+ x_length: float | None = round(config.frame_width) - 2,+ y_length: float | None = round(config.frame_height) - 2,+ axis_config: dict | None = None,+ x_axis_config: dict | None = None,+ y_axis_config: dict | None = None,tips: bool = True,**kwargs,):@@ -1828,7 +1825,7 @@ class Axes(VGroup, CoordinateSystem, metaclass=ConvertToOpenGL):@staticmethoddef _update_default_configs(- default_configs: Tuple[Dict[Any, Any]], passed_configs: Tuple[Dict[Any, Any]]+ default_configs: tuple[dict[Any, Any]], passed_configs: tuple[dict[Any, Any]]):"""Takes in two tuples of dicts and return modifies the first such that values from``passed_configs`` overwrite values in ``default_configs``. If a key does not exist@@ -1931,7 +1928,7 @@ class Axes(VGroup, CoordinateSystem, metaclass=ConvertToOpenGL):result += axis.number_to_point(coord) - originreturn result- def point_to_coords(self, point: Sequence[float]) -> Tuple[float]:+ def point_to_coords(self, point: Sequence[float]) -> tuple[float]:"""Accepts a point from the scene and returns its coordinates with respect to the axes.Examples@@ -1980,11 +1977,11 @@ class Axes(VGroup, CoordinateSystem, metaclass=ConvertToOpenGL):self,x_values: Iterable[float],y_values: Iterable[float],- z_values: Optional[Iterable[float]] = None,+ z_values: Iterable[float] | None = None,line_color: Color = YELLOW,add_vertex_dots: bool = True,vertex_dot_radius: float = DEFAULT_DOT_RADIUS,- vertex_dot_style: Optional[dict] = None,+ vertex_dot_style: dict | None = None,**kwargs,) -> VDict:"""Draws a line graph.@@ -2122,13 +2119,13 @@ class ThreeDAxes(Axes):def __init__(self,- x_range: Optional[Sequence[float]] = (-6, 6, 1),- y_range: Optional[Sequence[float]] = (-5, 5, 1),- z_range: Optional[Sequence[float]] = (-4, 4, 1),- x_length: Optional[float] = config.frame_height + 2.5,- y_length: Optional[float] = config.frame_height + 2.5,- z_length: Optional[float] = config.frame_height - 1.5,- z_axis_config: Optional[dict] = None,+ x_range: Sequence[float] | None = (-6, 6, 1),+ y_range: Sequence[float] | None = (-5, 5, 1),+ z_range: Sequence[float] | None = (-4, 4, 1),+ x_length: float | None = config.frame_height + 2.5,+ y_length: float | None = config.frame_height + 2.5,+ z_length: float | None = config.frame_height - 1.5,+ z_axis_config: dict | None = None,z_normal: Sequence[float] = DOWN,num_axis_pieces: int = 20,light_source: Sequence[float] = 9 * DOWN + 7 * LEFT + 10 * OUT,@@ -2216,14 +2213,14 @@ class ThreeDAxes(Axes):def get_z_axis_label(self,- label: Union[float, str, "Mobject"],+ label: float | str | Mobject,edge: Sequence[float] = OUT,direction: Sequence[float] = RIGHT,buff: float = SMALL_BUFF,rotation=PI / 2,rotation_axis=RIGHT,**kwargs,- ) -> "Mobject":+ ) -> Mobject:"""Generate a z-axis label.Examples@@ -2318,20 +2315,22 @@ class NumberPlane(Axes):def __init__(self,- x_range: Optional[Sequence[float]] = (+ x_range: Sequence[float]+ | None = (-config["frame_x_radius"],config["frame_x_radius"],1,),- y_range: Optional[Sequence[float]] = (+ y_range: Sequence[float]+ | None = (-config["frame_y_radius"],config["frame_y_radius"],1,),- x_length: Optional[float] = None,- y_length: Optional[float] = None,- background_line_style: Optional[dict] = None,- faded_line_style: Optional[dict] = None,+ x_length: float | None = None,+ y_length: float | None = None,+ background_line_style: dict | None = None,+ faded_line_style: dict | None = None,faded_line_ratio: int = 1,make_smooth_after_applying_functions: bool = True,**kwargs,@@ -2405,7 +2404,7 @@ class NumberPlane(Axes):self.background_lines,)- def _get_lines(self) -> Tuple[VGroup, VGroup]:+ def _get_lines(self) -> tuple[VGroup, VGroup]:"""Generate all the lines, faded and not faded.Two sets of lines are generated: one parallel to the X-axis, and parallel to the Y-axis.@@ -2446,7 +2445,7 @@ class NumberPlane(Axes):axis_perpendicular_to: NumberLine,freq: float,ratio_faded_lines: int,- ) -> Tuple[VGroup, VGroup]:+ ) -> tuple[VGroup, VGroup]:"""Generate a set of lines parallel to an axis.Parameters@@ -2596,18 +2595,18 @@ class PolarPlane(Axes):def __init__(self,radius_max: float = config["frame_y_radius"],- size: Optional[float] = None,+ size: float | None = None,radius_step: float = 1,- azimuth_step: Optional[float] = None,- azimuth_units: Optional[str] = "PI radians",+ azimuth_step: float | None = None,+ azimuth_units: str | None = "PI radians",azimuth_compact_fraction: bool = True,azimuth_offset: float = 0,azimuth_direction: str = "CCW",azimuth_label_buff: float = SMALL_BUFF,azimuth_label_font_size: float = 24,- radius_config: Optional[dict] = None,- background_line_style: Optional[dict] = None,- faded_line_style: Optional[dict] = None,+ radius_config: dict | None = None,+ background_line_style: dict | None = None,+ faded_line_style: dict | None = None,faded_line_ratio: int = 1,make_smooth_after_applying_functions: bool = True,**kwargs,@@ -2706,7 +2705,7 @@ class PolarPlane(Axes):self.background_lines,)- def _get_lines(self) -> Tuple[VGroup, VGroup]:+ def _get_lines(self) -> tuple[VGroup, VGroup]:"""Generate all the lines and circles, faded and not faded.Returns@@ -2777,8 +2776,8 @@ class PolarPlane(Axes):def get_coordinate_labels(self,- r_values: Optional[Iterable[float]] = None,- a_values: Optional[Iterable[float]] = None,+ r_values: Iterable[float] | None = None,+ a_values: Iterable[float] | None = None,**kwargs,) -> VDict:"""Gets labels for the coordinates@@ -2877,8 +2876,8 @@ class PolarPlane(Axes):def add_coordinates(self,- r_values: Optional[Iterable[float]] = None,- a_values: Optional[Iterable[float]] = None,+ r_values: Iterable[float] | None = None,+ a_values: Iterable[float] | None = None,):"""Adds the coordinates.Parameters@@ -2966,7 +2965,7 @@ class ComplexPlane(NumberPlane):**kwargs,)- def number_to_point(self, number: Union[float, complex]) -> np.ndarray:+ def number_to_point(self, number: float | complex) -> np.ndarray:"""Accepts a float/complex number and returns the equivalent point on the plane.Parameters@@ -2983,7 +2982,7 @@ class ComplexPlane(NumberPlane):number = complex(number)return self.coords_to_point(number.real, number.imag)- def n2p(self, number: Union[float, complex]) -> np.ndarray:+ def n2p(self, number: float | complex) -> np.ndarray:"""Abbreviation for :meth:`number_to_point`."""return self.number_to_point(number)@@ -3008,7 +3007,7 @@ class ComplexPlane(NumberPlane):"""Abbreviation for :meth:`point_to_number`."""return self.point_to_number(point)- def _get_default_coordinate_values(self) -> List[Union[float, complex]]:+ def _get_default_coordinate_values(self) -> list[float | complex]:"""Generate a list containing the numerical values of the plane's labels.Returns@@ -3022,7 +3021,7 @@ class ComplexPlane(NumberPlane):return [*x_numbers, *y_numbers]def get_coordinate_labels(- self, *numbers: Iterable[Union[float, complex]], **kwargs+ self, *numbers: Iterable[float | complex], **kwargs) -> VGroup:"""Generates the :class:`~.DecimalNumber` mobjects for the coordinates of the plane.@@ -3057,7 +3056,7 @@ class ComplexPlane(NumberPlane):self.coordinate_labels.add(number_mob)return self.coordinate_labels- def add_coordinates(self, *numbers: Iterable[Union[float, complex]], **kwargs):+ def add_coordinates(self, *numbers: Iterable[float | complex], **kwargs):"""Adds the labels produced from :meth:`~.NumberPlane.get_coordinate_labels` to the plane.Parametersdiff --git a/manim/mobject/frame.py b/manim/mobject/frame.pyindex bdc794bbe..126431a1f 100644--- a/manim/mobject/frame.py+++ b/manim/mobject/frame.py@@ -1,5 +1,7 @@"""Special rectangles."""+from __future__ import annotations+__all__ = ["ScreenRectangle","FullScreenRectangle",diff --git a/manim/mobject/functions.py b/manim/mobject/functions.pyindex 8e20a320d..e0a20fbea 100644--- a/manim/mobject/functions.py+++ b/manim/mobject/functions.py@@ -1,5 +1,7 @@"""Mobjects representing function graphs."""+from __future__ import annotations+__all__ = ["ParametricFunction", "FunctionGraph", "ImplicitFunction"]@@ -93,10 +95,10 @@ class ParametricFunction(VMobject, metaclass=ConvertToOpenGL):def __init__(self,function: Callable[[float, float], float],- t_range: Optional[Sequence[float]] = None,+ t_range: Sequence[float] | None = None,scaling: _ScaleBase = LinearBase(),dt: float = 1e-8,- discontinuities: Optional[Iterable[float]] = None,+ discontinuities: Iterable[float] | None = None,use_smoothing: bool = True,**kwargs):@@ -205,8 +207,8 @@ class ImplicitFunction(VMobject, metaclass=ConvertToOpenGL):def __init__(self,func: Callable[[float, float], float],- x_range: Optional[Sequence[float]] = None,- y_range: Optional[Sequence[float]] = None,+ x_range: Sequence[float] | None = None,+ y_range: Sequence[float] | None = None,min_depth: int = 5,max_quads: int = 1500,use_smoothing: bool = True,diff --git a/manim/mobject/geometry.py b/manim/mobject/geometry.pyindex 80004dd2a..7e094439c 100644--- a/manim/mobject/geometry.py+++ b/manim/mobject/geometry.py@@ -1,3 +1,5 @@+from __future__ import annotations+r"""Mobjects that are simple geometric shapes.Examples@@ -924,8 +926,8 @@ class Annulus(Circle):def __init__(self,- inner_radius: Optional[float] = 1,- outer_radius: Optional[float] = 2,+ inner_radius: float | None = 1,+ outer_radius: float | None = 2,fill_opacity=1,stroke_width=0,color=WHITE,@@ -1007,8 +1009,8 @@ class Line(TipableVMobject):def _pointify(self,- mob_or_point: Union["Mobject", Sequence[float]],- direction: Optional[Sequence[float]] = None,+ mob_or_point: Mobject | Sequence[float],+ direction: Sequence[float] | None = None,) -> np.ndarray:"""Transforms a mobject into its corresponding point. Does nothing if a point is passed.@@ -1565,7 +1567,7 @@ class Vector(Arrow):self,integer_labels: bool = True,n_dim: int = 2,- color: Optional[Color] = None,+ color: Color | None = None,**kwargs,):"""Creates a label based on the coordinates of the vector.@@ -1966,7 +1968,7 @@ class RegularPolygram(Polygram):*,density: int = 2,radius: float = 1,- start_angle: Optional[float] = None,+ start_angle: float | None = None,**kwargs,):# Regular polygrams can be expressed by the number of their vertices@@ -2113,9 +2115,9 @@ class Star(Polygon):n: int = 5,*,outer_radius: float = 1,- inner_radius: Optional[float] = None,+ inner_radius: float | None = None,density: int = 2,- start_angle: Optional[float] = TAU / 4,+ start_angle: float | None = TAU / 4,**kwargs,):inner_angle = TAU / (2 * n)@@ -2461,8 +2463,8 @@ class Rectangle(Polygon):color: Color = WHITE,height: float = 2.0,width: float = 4.0,- grid_xstep: Optional[float] = None,- grid_ystep: Optional[float] = None,+ grid_xstep: float | None = None,+ grid_ystep: float | None = None,mark_paths_closed=True,close_new_points=True,**kwargs,diff --git a/manim/mobject/graph.py b/manim/mobject/graph.pyindex d997aff7a..a9f803b86 100644--- a/manim/mobject/graph.py+++ b/manim/mobject/graph.py@@ -1,5 +1,7 @@"""Mobjects used to represent mathematical graphs (think graph theory, not plotting)."""+from __future__ import annotations+__all__ = ["Graph",]@@ -24,11 +26,11 @@ from .types.vectorized_mobject import VMobjectdef _determine_graph_layout(nx_graph: nx.classes.graph.Graph,- layout: Union[str, dict] = "spring",+ layout: str | dict = "spring",layout_scale: float = 2,- layout_config: Union[dict, None] = None,- partitions: Union[List[List[Hashable]], None] = None,- root_vertex: Union[Hashable, None] = None,+ layout_config: dict | None = None,+ partitions: list[list[Hashable]] | None = None,+ root_vertex: Hashable | None = None,) -> dict:automatic_layouts = {"circular": nx.layout.circular_layout,@@ -99,8 +101,8 @@ def _determine_graph_layout(def _tree_layout(T: nx.classes.graph.Graph,- root_vertex: Union[Hashable, None],- scale: Union[float, tuple] = 2,+ root_vertex: Hashable | None,+ scale: float | tuple = 2,orientation: str = "down",):children = {root_vertex: list(T.neighbors(root_vertex))}@@ -385,20 +387,20 @@ class Graph(VMobject, metaclass=ConvertToOpenGL):def __init__(self,- vertices: List[Hashable],- edges: List[Tuple[Hashable, Hashable]],- labels: Union[bool, dict] = False,+ vertices: list[Hashable],+ edges: list[tuple[Hashable, Hashable]],+ labels: bool | dict = False,label_fill_color: str = BLACK,- layout: Union[str, dict] = "spring",- layout_scale: Union[float, tuple] = 2,- layout_config: Union[dict, None] = None,- vertex_type: Type["Mobject"] = Dot,- vertex_config: Union[dict, None] = None,- vertex_mobjects: Optional[dict] = None,- edge_type: Type["Mobject"] = Line,- partitions: Union[List[List[Hashable]], None] = None,- root_vertex: Union[Hashable, None] = None,- edge_config: Union[dict, None] = None,+ layout: str | dict = "spring",+ layout_scale: float | tuple = 2,+ layout_config: dict | None = None,+ vertex_type: type[Mobject] = Dot,+ vertex_config: dict | None = None,+ vertex_mobjects: dict | None = None,+ edge_type: type[Mobject] = Line,+ partitions: list[list[Hashable]] | None = None,+ root_vertex: Hashable | None = None,+ edge_config: dict | None = None,) -> None:super().__init__()@@ -491,22 +493,22 @@ class Graph(VMobject, metaclass=ConvertToOpenGL):self.add_updater(update_edges)- def __getitem__(self: "Graph", v: Hashable) -> "Mobject":+ def __getitem__(self: Graph, v: Hashable) -> Mobject:return self.vertices[v]- def __repr__(self: "Graph") -> str:+ def __repr__(self: Graph) -> str:return f"Graph on {len(self.vertices)} vertices and {len(self.edges)} edges"def _add_vertex(self,vertex: Hashable,- position: Optional[np.ndarray] = None,+ position: np.ndarray | None = None,label: bool = False,label_fill_color: str = BLACK,- vertex_type: Type["Mobject"] = Dot,- vertex_config: Optional[dict] = None,- vertex_mobject: Optional[dict] = None,- ) -> "Mobject":+ vertex_type: type[Mobject] = Dot,+ vertex_config: dict | None = None,+ vertex_mobject: dict | None = None,+ ) -> Mobject:"""Add a vertex to the graph.Parameters@@ -575,14 +577,14 @@ class Graph(VMobject, metaclass=ConvertToOpenGL):return self.vertices[vertex]def add_vertices(- self: "Graph",+ self: Graph,*vertices: Hashable,- positions: Optional[dict] = None,+ positions: dict | None = None,labels: bool = False,label_fill_color: str = BLACK,- vertex_type: Type["Mobject"] = Dot,- vertex_config: Optional[dict] = None,- vertex_mobjects: Optional[dict] = None,+ vertex_type: type[Mobject] = Dot,+ vertex_config: dict | None = None,+ vertex_mobjects: dict | None = None,):"""Add a list of vertices to the graph.@@ -743,9 +745,9 @@ class Graph(VMobject, metaclass=ConvertToOpenGL):def _add_edge(self,- edge: Tuple[Hashable, Hashable],- edge_type: Type["Mobject"] = Line,- edge_config: Optional[dict] = None,+ edge: tuple[Hashable, Hashable],+ edge_type: type[Mobject] = Line,+ edge_config: dict | None = None,):"""Add a new edge to the graph.@@ -794,9 +796,9 @@ class Graph(VMobject, metaclass=ConvertToOpenGL):def add_edges(self,- *edges: Tuple[Hashable, Hashable],- edge_type: Type["Mobject"] = Line,- edge_config: Optional[dict] = None,+ *edges: tuple[Hashable, Hashable],+ edge_type: type[Mobject] = Line,+ edge_config: dict | None = None,):"""Add new edges to the graph.@@ -856,7 +858,7 @@ class Graph(VMobject, metaclass=ConvertToOpenGL):*(animation(mobj, **anim_args) for mobj in mobjects), group=self)- def _remove_edge(self, edge: Tuple[Hashable]):+ def _remove_edge(self, edge: tuple[Hashable]):"""Remove an edge from the graph.Parameters@@ -885,7 +887,7 @@ class Graph(VMobject, metaclass=ConvertToOpenGL):self.remove(edge_mobject)return edge_mobject- def remove_edges(self, *edges: Tuple[Hashable]):+ def remove_edges(self, *edges: tuple[Hashable]):"""Remove several edges from the graph.Parameters@@ -915,7 +917,7 @@ class Graph(VMobject, metaclass=ConvertToOpenGL):)@staticmethod- def from_networkx(nxgraph: nx.classes.graph.Graph, **kwargs) -> "Graph":+ def from_networkx(nxgraph: nx.classes.graph.Graph, **kwargs) -> Graph:"""Build a :class:`~.Graph` from a given ``networkx`` graph.Parameters@@ -949,12 +951,12 @@ class Graph(VMobject, metaclass=ConvertToOpenGL):def change_layout(self,- layout: Union[str, dict] = "spring",+ layout: str | dict = "spring",layout_scale: float = 2,- layout_config: Union[dict, None] = None,- partitions: Union[List[List[Hashable]], None] = None,- root_vertex: Union[Hashable, None] = None,- ) -> "Graph":+ layout_config: dict | None = None,+ partitions: list[list[Hashable]] | None = None,+ root_vertex: Hashable | None = None,+ ) -> Graph:"""Change the layout of this graph.See the documentation of :class:`~.Graph` for details about thediff --git a/manim/mobject/logo.py b/manim/mobject/logo.pyindex ff3414efb..a76627bd1 100644--- a/manim/mobject/logo.py+++ b/manim/mobject/logo.py@@ -1,5 +1,7 @@"""Utilities for Manim's logo and banner."""+from __future__ import annotations+__all__ = ["ManimBanner"]from ..animation.animation import override_animation@@ -90,7 +92,7 @@ class ManimBanner(VGroup):# and thus not yet added to the submobjects of self.self.anim = anim- def scale(self, scale_factor: float, **kwargs) -> "ManimBanner":+ def scale(self, scale_factor: float, **kwargs) -> ManimBanner:"""Scale the banner by the specified scale factor.Parametersdiff --git a/manim/mobject/matrix.py b/manim/mobject/matrix.pyindex e5c7b8f57..998ad7519 100644--- a/manim/mobject/matrix.py+++ b/manim/mobject/matrix.py@@ -1,3 +1,5 @@+from __future__ import annotations+r"""Mobjects representing matrices.Examples@@ -134,7 +136,7 @@ class Matrix(VMobject, metaclass=ConvertToOpenGL):bracket_v_buff: float = MED_SMALL_BUFF,add_background_rectangles_to_entries: bool = False,include_background_rectangle: bool = False,- element_to_mobject: Type[MathTex] = MathTex,+ element_to_mobject: type[MathTex] = MathTex,element_to_mobject_config: dict = {},element_alignment_corner: Sequence[float] = DR,left_bracket: str = "[",diff --git a/manim/mobject/mobject_update_utils.py b/manim/mobject/mobject_update_utils.pyindex 90658b53a..099a112f9 100644--- a/manim/mobject/mobject_update_utils.py+++ b/manim/mobject/mobject_update_utils.py@@ -1,5 +1,7 @@"""Utility functions for continuous animation of mobjects."""+from __future__ import annotations+__all__ = ["assert_is_mobject_method","always",diff --git a/manim/mobject/number_line.py b/manim/mobject/number_line.pyindex e68112fb8..752951a3f 100644--- a/manim/mobject/number_line.py+++ b/manim/mobject/number_line.py@@ -1,5 +1,7 @@"""Mobject representing a number line."""+from __future__ import annotations+__all__ = ["NumberLine", "UnitInterval"]from typing import Dict, Iterable, Optional, Sequence, Union@@ -122,13 +124,13 @@ class NumberLine(Line):def __init__(self,- x_range: Optional[Sequence[float]] = None, # must be first- length: Optional[float] = None,+ x_range: Sequence[float] | None = None, # must be first+ length: float | None = None,unit_size: float = 1,# ticksinclude_ticks: bool = True,tick_size: float = 0.1,- numbers_with_elongated_ticks: Optional[Iterable[float]] = None,+ numbers_with_elongated_ticks: Iterable[float] | None = None,longer_tick_multiple: int = 2,exclude_origin_tick: bool = False,# visuals@@ -145,9 +147,9 @@ class NumberLine(Line):label_constructor: VMobject = MathTex,scaling: _ScaleBase = LinearBase(),line_to_number_buff: float = MED_SMALL_BUFF,- decimal_number_config: Optional[Dict] = None,- numbers_to_exclude: Optional[Iterable[float]] = None,- numbers_to_include: Optional[Iterable[float]] = None,+ decimal_number_config: dict | None = None,+ numbers_to_exclude: Iterable[float] | None = None,+ numbers_to_include: Iterable[float] | None = None,**kwargs,):# avoid mutable arguments in defaults@@ -268,7 +270,7 @@ class NumberLine(Line):self.add(ticks)self.ticks = ticks- def get_tick(self, x: float, size: Optional[float] = None) -> Line:+ def get_tick(self, x: float, size: float | None = None) -> Line:"""Generates a tick and positions it along the number line.Parameters@@ -378,10 +380,10 @@ class NumberLine(Line):def get_number_mobject(self,x: float,- direction: Optional[Sequence[float]] = None,- buff: Optional[float] = None,- font_size: Optional[float] = None,- label_constructor: Optional[VMobject] = None,+ direction: Sequence[float] | None = None,+ buff: float | None = None,+ font_size: float | None = None,+ label_constructor: VMobject | None = None,**number_config,) -> VMobject:"""Generates a positioned :class:`~.DecimalNumber` mobject@@ -440,10 +442,10 @@ class NumberLine(Line):def add_numbers(self,- x_values: Optional[Iterable[float]] = None,- excluding: Optional[Iterable[float]] = None,- font_size: Optional[float] = None,- label_constructor: Optional[VMobject] = None,+ x_values: Iterable[float] | None = None,+ excluding: Iterable[float] | None = None,+ font_size: float | None = None,+ label_constructor: VMobject | None = None,**kwargs,):"""Adds :class:`~.DecimalNumber` mobjects representing their position@@ -496,11 +498,11 @@ class NumberLine(Line):def add_labels(self,- dict_values: Dict[float, Union[str, float, VMobject]],+ dict_values: dict[float, str | float | VMobject],direction: Sequence[float] = None,- buff: Optional[float] = None,- font_size: Optional[float] = None,- label_constructor: Optional[VMobject] = None,+ buff: float | None = None,+ font_size: float | None = None,+ label_constructor: VMobject | None = None,):"""Adds specifically positioned labels to the :class:`~.NumberLine` using a ``dict``.The labels can be accessed after creation via ``self.labels``.@@ -557,7 +559,7 @@ class NumberLine(Line):self.add(labels)return self- def _create_label_tex(self, label_tex: Union[str, float, VMobject]) -> VMobject:+ def _create_label_tex(self, label_tex: str | float | VMobject) -> VMobject:"""Checks if the label is a :class:`~.VMobject`, otherwise, creates alabel according to the ``label_constructor``.diff --git a/manim/mobject/numbers.py b/manim/mobject/numbers.pyindex 1c94a8621..3b5728aef 100644--- a/manim/mobject/numbers.py+++ b/manim/mobject/numbers.py@@ -1,5 +1,7 @@"""Mobjects representing numbers."""+from __future__ import annotations+__all__ = ["DecimalNumber", "Integer", "Variable"]from typing import Optional, Sequence@@ -55,7 +57,7 @@ class DecimalNumber(VMobject, metaclass=ConvertToOpenGL):group_with_commas: bool = True,digit_buff_per_font_unit: float = 0.001,show_ellipsis: bool = False,- unit: Optional[str] = None, # Aligned to bottom unless it starts with "^"+ unit: str | None = None, # Aligned to bottom unless it starts with "^"include_background_rectangle: bool = False,edge_to_fix: Sequence[float] = LEFT,font_size: float = DEFAULT_FONT_SIZE,@@ -170,9 +172,8 @@ class DecimalNumber(VMobject, metaclass=ConvertToOpenGL):return num_string- def _string_to_mob(- self, string: str, mob_class: Optional[VMobject] = None, **kwargs- ):+ def _string_to_mob(self, string: str, mob_class: VMobject | None = None, **kwargs):+if mob_class is None:mob_class = self.mob_classdiff --git a/manim/mobject/opengl_compatibility.py b/manim/mobject/opengl_compatibility.pyindex 96ffc071d..23bb6f719 100644--- a/manim/mobject/opengl_compatibility.py+++ b/manim/mobject/opengl_compatibility.py@@ -1,3 +1,5 @@+from __future__ import annotations+from abc import ABCMetafrom .. import configdiff --git a/manim/mobject/opengl_geometry.py b/manim/mobject/opengl_geometry.pyindex 67d40a91b..88973c002 100644--- a/manim/mobject/opengl_geometry.py+++ b/manim/mobject/opengl_geometry.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom .. import loggerdiff --git a/manim/mobject/opengl_mobject.py b/manim/mobject/opengl_mobject.pyindex 44a346d23..51fab13e8 100644--- a/manim/mobject/opengl_mobject.py+++ b/manim/mobject/opengl_mobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+import copyimport itertools as itimport random@@ -228,7 +230,7 @@ class OpenGLMobject:# Typically implemented in subclass, unless purposefully left blankpass- def set(self, **kwargs) -> "OpenGLMobject":+ def set(self, **kwargs) -> OpenGLMobject:"""Sets attributes.Mainly to be used along with :attr:`animate` to@@ -653,8 +655,8 @@ class OpenGLMobject:return [m for m in self.get_family() if m.has_points()]def add(- self, *mobjects: "OpenGLMobject", update_parent: bool = False- ) -> "OpenGLMobject":+ self, *mobjects: OpenGLMobject, update_parent: bool = False+ ) -> OpenGLMobject:"""Add mobjects as submobjects.The mobjects are added to :attr:`submobjects`.@@ -730,8 +732,8 @@ class OpenGLMobject:return selfdef remove(- self, *mobjects: "OpenGLMobject", update_parent: bool = False- ) -> "OpenGLMobject":+ self, *mobjects: OpenGLMobject, update_parent: bool = False+ ) -> OpenGLMobject:"""Remove :attr:`submobjects`.The mobjects are removed from :attr:`submobjects`, if they exist.@@ -765,7 +767,7 @@ class OpenGLMobject:self.assemble_family()return self- def add_to_back(self, *mobjects: "OpenGLMobject") -> "OpenGLMobject":+ def add_to_back(self, *mobjects: OpenGLMobject) -> OpenGLMobject:# NOTE: is the note true OpenGLMobjects?"""Add all passed mobjects to the back of the submobjects.@@ -876,17 +878,17 @@ class OpenGLMobject:def arrange_in_grid(self,- rows: Optional[int] = None,- cols: Optional[int] = None,- buff: Union[float, Tuple[float, float]] = MED_SMALL_BUFF,+ rows: int | None = None,+ cols: int | None = None,+ buff: float | tuple[float, float] = MED_SMALL_BUFF,cell_alignment: np.ndarray = ORIGIN,- row_alignments: Optional[str] = None, # "ucd"- col_alignments: Optional[str] = None, # "lcr"- row_heights: Optional[Iterable[Optional[float]]] = None,- col_widths: Optional[Iterable[Optional[float]]] = None,+ row_alignments: str | None = None, # "ucd"+ col_alignments: str | None = None, # "lcr"+ row_heights: Iterable[float | None] | None = None,+ col_widths: Iterable[float | None] | None = None,flow_order: str = "rd",**kwargs,- ) -> "OpenGLMobject":+ ) -> OpenGLMobject:"""Arrange submobjects in a grid.Parameters@@ -1388,10 +1390,10 @@ class OpenGLMobject:def scale(self,scale_factor: float,- about_point: Optional[Sequence[float]] = None,+ about_point: Sequence[float] | None = None,about_edge: Sequence[float] = ORIGIN,**kwargs,- ) -> "OpenGLMobject":+ ) -> OpenGLMobject:r"""Scale the size by a factor.Default behavior is to scale about the center of the mobject.@@ -1462,7 +1464,7 @@ class OpenGLMobject:self,angle,axis=OUT,- about_point: Optional[Sequence[float]] = None,+ about_point: Sequence[float] | None = None,**kwargs,):"""Rotates the :class:`~.OpenGLMobject` about a certain point."""@@ -1828,7 +1830,7 @@ class OpenGLMobject:def surround(self,- mobject: "OpenGLMobject",+ mobject: OpenGLMobject,dim_to_match: int = 0,stretch: bool = False,buff: float = MED_SMALL_BUFF,@@ -1971,7 +1973,7 @@ class OpenGLMobject:# Background rectangledef add_background_rectangle(- self, color: Optional[Colors] = None, opacity: float = 0.75, **kwargs+ self, color: Colors | None = None, opacity: float = 0.75, **kwargs):# TODO, this does not behave well when the mobject has points,# since it gets displayed on top@@ -2161,27 +2163,27 @@ class OpenGLMobject:# Match other mobject properties- def match_color(self, mobject: "OpenGLMobject"):+ def match_color(self, mobject: OpenGLMobject):"""Match the color with the color of another :class:`~.OpenGLMobject`."""return self.set_color(mobject.get_color())- def match_dim_size(self, mobject: "OpenGLMobject", dim, **kwargs):+ def match_dim_size(self, mobject: OpenGLMobject, dim, **kwargs):"""Match the specified dimension with the dimension of another :class:`~.OpenGLMobject`."""return self.rescale_to_fit(mobject.length_over_dim(dim), dim, **kwargs)- def match_width(self, mobject: "OpenGLMobject", **kwargs):+ def match_width(self, mobject: OpenGLMobject, **kwargs):"""Match the width with the width of another :class:`~.OpenGLMobject`."""return self.match_dim_size(mobject, 0, **kwargs)- def match_height(self, mobject: "OpenGLMobject", **kwargs):+ def match_height(self, mobject: OpenGLMobject, **kwargs):"""Match the height with the height of another :class:`~.OpenGLMobject`."""return self.match_dim_size(mobject, 1, **kwargs)- def match_depth(self, mobject: "OpenGLMobject", **kwargs):+ def match_depth(self, mobject: OpenGLMobject, **kwargs):"""Match the depth with the depth of another :class:`~.OpenGLMobject`."""return self.match_dim_size(mobject, 2, **kwargs)- def match_coord(self, mobject: "OpenGLMobject", dim, direction=ORIGIN):+ def match_coord(self, mobject: OpenGLMobject, dim, direction=ORIGIN):"""Match the coordinates with the coordinates of another :class:`~.OpenGLMobject`."""return self.set_coord(mobject.get_coord(dim, direction),@@ -2203,7 +2205,7 @@ class OpenGLMobject:def align_to(self,- mobject_or_point: Union["OpenGLMobject", Sequence[float]],+ mobject_or_point: OpenGLMobject | Sequence[float],direction=ORIGIN,):"""@@ -2360,7 +2362,7 @@ class OpenGLMobject:def become(self,- mobject: "OpenGLMobject",+ mobject: OpenGLMobject,match_height: bool = False,match_width: bool = False,match_depth: bool = False,diff --git a/manim/mobject/opengl_three_dimensions.py b/manim/mobject/opengl_three_dimensions.pyindex dd72878e1..20568c349 100644--- a/manim/mobject/opengl_three_dimensions.py+++ b/manim/mobject/opengl_three_dimensions.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom ..constants import *diff --git a/manim/mobject/polyhedra.py b/manim/mobject/polyhedra.pyindex 6ad06a87c..f32617e32 100644--- a/manim/mobject/polyhedra.py+++ b/manim/mobject/polyhedra.py@@ -1,5 +1,7 @@"""General polyhedral class and platonic solids."""+from __future__ import annotations+from typing import TYPE_CHECKING, Dict, List, Tuple, Unionimport numpy as np@@ -85,10 +87,10 @@ class Polyhedron(VGroup):def __init__(self,- vertex_coords: List[Union[List[float], np.ndarray]],- faces_list: List[List[int]],- faces_config: Dict[str, Union[str, int, float, bool]] = {},- graph_config: Dict[str, Union[str, int, float, bool]] = {},+ vertex_coords: list[list[float] | np.ndarray],+ faces_list: list[list[int]],+ faces_config: dict[str, str | int | float | bool] = {},+ graph_config: dict[str, str | int | float | bool] = {},):super().__init__()self.faces_config = dict(@@ -116,7 +118,7 @@ class Polyhedron(VGroup):self.add(self.faces, self.graph)self.add_updater(self.update_faces)- def get_edges(self, faces_list: List[List[int]]) -> List[Tuple[int, int]]:+ def get_edges(self, faces_list: list[list[int]]) -> list[tuple[int, int]]:"""Creates list of cyclic pairwise tuples."""edges = []for face in faces_list:@@ -125,20 +127,20 @@ class Polyhedron(VGroup):def create_faces(self,- face_coords: List[List[Union[List, np.ndarray]]],- ) -> "VGroup":+ face_coords: list[list[list | np.ndarray]],+ ) -> VGroup:"""Creates VGroup of faces from a list of face coordinates."""face_group = VGroup()for face in face_coords:face_group.add(Polygon(*face, **self.faces_config))return face_group- def update_faces(self, m: "Mobject"):+ def update_faces(self, m: Mobject):face_coords = self.extract_face_coords()new_faces = self.create_faces(face_coords)self.faces.match_points(new_faces)- def extract_face_coords(self) -> List[List[Union[np.ndarray]]]:+ def extract_face_coords(self) -> list[list[np.ndarray]]:"""Extracts the coordinates of the vertices in the graph.Used for updating faces."""diff --git a/manim/mobject/probability.py b/manim/mobject/probability.pyindex 1b0d74dde..d798cccad 100644--- a/manim/mobject/probability.py+++ b/manim/mobject/probability.py@@ -1,5 +1,7 @@"""Mobjects representing objects from probability theory and statistics."""+from __future__ import annotations+__all__ = ["SampleSpace", "BarChart"]@@ -237,11 +239,13 @@ class BarChart(Axes):def __init__(self,values: Iterable[float],- bar_names: Optional[Iterable[str]] = None,- y_range: Optional[Sequence[float]] = None,- x_length: Optional[float] = None,- y_length: Optional[float] = config.frame_height - 4,- bar_colors: Optional[Union[str, Iterable[str]]] = [+ bar_names: Iterable[str] | None = None,+ y_range: Sequence[float] | None = None,+ x_length: float | None = None,+ y_length: float | None = config.frame_height - 4,+ bar_colors: str+ | Iterable[str]+ | None = ["#003f5c","#58508d","#bc5090",@@ -361,10 +365,10 @@ class BarChart(Axes):def get_bar_labels(self,- color: Optional[Color] = None,+ color: Color | None = None,font_size: float = 24,buff: float = MED_SMALL_BUFF,- label_constructor: "VMobject" = Tex,+ label_constructor: VMobject = Tex,):"""Annotates each bar with its corresponding value. Use ``self.bar_labels`` to access thelabels after creation.diff --git a/manim/mobject/shape_matchers.py b/manim/mobject/shape_matchers.pyindex a32050243..c17f2b978 100644--- a/manim/mobject/shape_matchers.py+++ b/manim/mobject/shape_matchers.py@@ -1,5 +1,7 @@"""Mobjects used to mark and annotate other mobjects."""+from __future__ import annotations+__all__ = ["SurroundingRectangle", "BackgroundRectangle", "Cross", "Underline"]from typing import Optional@@ -83,7 +85,7 @@ class BackgroundRectangle(SurroundingRectangle):def __init__(self,mobject,- color: Optional[Colors] = None,+ color: Colors | None = None,stroke_width: float = 0,stroke_opacity: float = 0,fill_opacity: float = 0.75,@@ -156,7 +158,7 @@ class Cross(VGroup):def __init__(self,- mobject: Optional["Mobject"] = None,+ mobject: Mobject | None = None,stroke_color: Color = RED,stroke_width: float = 6,scale_factor: float = 1,diff --git a/manim/mobject/svg/brace.py b/manim/mobject/svg/brace.pyindex a68dd909a..e277589ed 100644--- a/manim/mobject/svg/brace.py+++ b/manim/mobject/svg/brace.py@@ -1,5 +1,7 @@"""Mobject representing curly braces."""+from __future__ import annotations+__all__ = ["Brace", "BraceLabel", "ArcBrace", "BraceText", "BraceBetweenPoints"]from typing import Optional, Sequence@@ -58,7 +60,7 @@ class Brace(SVGPathMobject):def __init__(self,mobject,- direction: Optional[Sequence[float]] = DOWN,+ direction: Sequence[float] | None = DOWN,buff=0.2,sharpness=2,stroke_width=0,@@ -236,9 +238,9 @@ class BraceBetweenPoints(Brace):def __init__(self,- point_1: Optional[Sequence[float]],- point_2: Optional[Sequence[float]],- direction: Optional[Sequence[float]] = ORIGIN,+ point_1: Sequence[float] | None,+ point_2: Sequence[float] | None,+ direction: Sequence[float] | None = ORIGIN,**kwargs):if all(direction == ORIGIN):diff --git a/manim/mobject/svg/code_mobject.py b/manim/mobject/svg/code_mobject.pyindex 2b20a23f9..54d32b054 100644--- a/manim/mobject/svg/code_mobject.py+++ b/manim/mobject/svg/code_mobject.py@@ -1,5 +1,7 @@"""Mobject representing highlighted source code listings."""+from __future__ import annotations+__all__ = ["Code",]diff --git a/manim/mobject/svg/style_utils.py b/manim/mobject/svg/style_utils.pyindex 4647e0018..9ac0d8d15 100644--- a/manim/mobject/svg/style_utils.py+++ b/manim/mobject/svg/style_utils.py@@ -1,6 +1,8 @@"""Utility functions for parsing SVG styles."""+from __future__ import annotations+__all__ = ["cascade_element_style", "parse_style", "parse_color_string"]from typing import Dict, List@@ -10,7 +12,7 @@ from colour import web2hexfrom ...utils.color import rgb_to_hex-CASCADING_STYLING_ATTRIBUTES: List[str] = [+CASCADING_STYLING_ATTRIBUTES: list[str] = ["fill","stroke","fill-opacity",@@ -21,7 +23,7 @@ CASCADING_STYLING_ATTRIBUTES: List[str] = [# The default styling specifications for SVG images,# according to https://www.w3.org/TR/SVG/painting.html# (ctrl-F for "initial")-SVG_DEFAULT_ATTRIBUTES: Dict[str, str] = {+SVG_DEFAULT_ATTRIBUTES: dict[str, str] = {"fill": "black","fill-opacity": "1","stroke": "none",@@ -31,8 +33,8 @@ SVG_DEFAULT_ATTRIBUTES: Dict[str, str] = {def cascade_element_style(element: MinidomElement,- inherited: Dict[str, str],-) -> Dict[str, str]:+ inherited: dict[str, str],+) -> dict[str, str]:"""Collect the element's style attributes based upon both its inheritance and its own attributes.SVG uses cascading element styles. A closer ancestor's style takes precedence over a more distant ancestor's@@ -121,7 +123,7 @@ def parse_color_string(color_spec: str) -> str:return hex_color-def fill_default_values(svg_style: Dict) -> None:+def fill_default_values(svg_style: dict) -> None:"""Fill in the default values for properties of SVG elements,if they are not currently set in the style dictionary.@@ -141,7 +143,7 @@ def fill_default_values(svg_style: Dict) -> None:svg_style[key] = SVG_DEFAULT_ATTRIBUTES[key]-def parse_style(svg_style: Dict[str, str]) -> Dict:+def parse_style(svg_style: dict[str, str]) -> dict:"""Convert a dictionary of SVG attributes to Manim VMobject keyword arguments.Parametersdiff --git a/manim/mobject/svg/svg_mobject.py b/manim/mobject/svg/svg_mobject.pyindex 5cc7d2551..256b2e90c 100644--- a/manim/mobject/svg/svg_mobject.py+++ b/manim/mobject/svg/svg_mobject.py@@ -1,9 +1,9 @@"""Mobjects generated from an SVG file."""+from __future__ import annotations__all__ = ["SVGMobject"]-import itertools as itimport osimport re@@ -146,9 +146,9 @@ class SVGMobject(VMobject, metaclass=ConvertToOpenGL):def _get_mobjects_from(self,element: MinidomElement,- inherited_style: Dict[str, str],+ inherited_style: dict[str, str],within_defs: bool = False,- ) -> List[VMobject]:+ ) -> list[VMobject]:"""Parses a given SVG element into a Mobject.Parameters@@ -282,8 +282,8 @@ class SVGMobject(VMobject, metaclass=ConvertToOpenGL):def _use_to_mobjects(self,use_element: MinidomElement,- local_style: Dict,- ) -> List[VMobject]:+ local_style: dict,+ ) -> list[VMobject]:"""Converts a SVG <use> element to a collection of VMobjects.Parametersdiff --git a/manim/mobject/svg/svg_path.py b/manim/mobject/svg/svg_path.pyindex 0e150df1e..7024bc0bf 100644--- a/manim/mobject/svg/svg_path.py+++ b/manim/mobject/svg/svg_path.py@@ -1,6 +1,8 @@"""Mobjects generated from an SVG pathstring."""+from __future__ import annotations+__all__ = ["SVGPathMobject", "string_to_numbers"]@@ -190,7 +192,7 @@ def elliptical_arc_to_cubic_bezier(x1, y1, rx, ry, phi, fA, fS, x2, y2):return bezier_points-def string_to_numbers(num_string: str) -> List[float]:+def string_to_numbers(num_string: str) -> list[float]:"""Parse the SVG string representing a sequence of numbers into an array of floats.Parametersdiff --git a/manim/mobject/svg/tex_mobject.py b/manim/mobject/svg/tex_mobject.pyindex e9fd3e2b1..a8c238152 100644--- a/manim/mobject/svg/tex_mobject.py+++ b/manim/mobject/svg/tex_mobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+r"""Mobjects representing text rendered using LaTeX... important::diff --git a/manim/mobject/svg/text_mobject.py b/manim/mobject/svg/text_mobject.pyindex f5e478939..9b0767e1d 100644--- a/manim/mobject/svg/text_mobject.py+++ b/manim/mobject/svg/text_mobject.py@@ -47,6 +47,8 @@ Examples"""+from __future__ import annotations+__all__ = ["Text", "Paragraph", "MarkupText", "register_font"]@@ -410,11 +412,11 @@ class Text(SVGMobject):font: str = "",slant: str = NORMAL,weight: str = NORMAL,- t2c: Dict[str, str] = None,- t2f: Dict[str, str] = None,- t2g: Dict[str, tuple] = None,- t2s: Dict[str, str] = None,- t2w: Dict[str, str] = None,+ t2c: dict[str, str] = None,+ t2f: dict[str, str] = None,+ t2g: dict[str, tuple] = None,+ t2s: dict[str, str] = None,+ t2w: dict[str, str] = None,gradient: tuple = None,tab_width: int = 4,# Mobject@@ -629,7 +631,7 @@ class Text(SVGMobject):return new_settingdef _get_settings_from_t2xs(- self, t2xs: Sequence[Tuple[Dict[str, str], str]]+ self, t2xs: Sequence[tuple[dict[str, str], str]]) -> Sequence[TextSetting]:settings = []t2xwords = set(chain(*([*t2x.keys()] for t2x, _ in t2xs)))@@ -644,7 +646,7 @@ class Text(SVGMobject):return settingsdef _get_settings_from_gradient(- self, setting_args: Dict[str, Iterable[str]]+ self, setting_args: dict[str, Iterable[str]]) -> Sequence[TextSetting]:settings = []args = copy.copy(setting_args)@@ -1354,7 +1356,7 @@ class MarkupText(SVGMobject):@contextmanager-def register_font(font_file: Union[str, Path]):+def register_font(font_file: str | Path):"""Temporarily add a font file to Pango's search path.This searches for the font_file at various places. The order it searches it described below.diff --git a/manim/mobject/table.py b/manim/mobject/table.pyindex bdece1da1..3322299c0 100644--- a/manim/mobject/table.py+++ b/manim/mobject/table.py@@ -1,3 +1,5 @@+from __future__ import annotations+r"""Mobjects representing tables.Examples@@ -146,10 +148,10 @@ class Table(VGroup):def __init__(self,- table: Iterable[Iterable[Union[float, str, VMobject]]],- row_labels: Optional[Iterable[VMobject]] = None,- col_labels: Optional[Iterable[VMobject]] = None,- top_left_entry: Optional[VMobject] = None,+ table: Iterable[Iterable[float | str | VMobject]],+ row_labels: Iterable[VMobject] | None = None,+ col_labels: Iterable[VMobject] | None = None,+ top_left_entry: VMobject | None = None,v_buff: float = 0.8,h_buff: float = 1.3,include_outer_lines: bool = False,@@ -158,7 +160,7 @@ class Table(VGroup):include_background_rectangle: bool = False,background_rectangle_color: Color = BLACK,element_to_mobject: Callable[- [Union[float, str, VMobject]],+ [float | str | VMobject],VMobject,] = Paragraph,element_to_mobject_config: dict = {},@@ -250,8 +252,8 @@ class Table(VGroup):def _table_to_mob_table(self,- table: Iterable[Iterable[Union[float, str, VMobject]]],- ) -> List:+ table: Iterable[Iterable[float | str | VMobject]],+ ) -> list:"""Initilaizes the entries of ``table`` as :class:`~.VMobject`.Parameters@@ -336,7 +338,7 @@ class Table(VGroup):mob_table.insert(0, self.col_labels)return mob_table- def _add_horizontal_lines(self) -> "Table":+ def _add_horizontal_lines(self) -> Table:"""Adds the horizontal lines to the table."""anchor_left = self.get_left()[0] - 0.5 * self.h_buffanchor_right = self.get_right()[0] + 0.5 * self.h_buff@@ -366,7 +368,7 @@ class Table(VGroup):self.horizontal_lines = line_groupreturn self- def _add_vertical_lines(self) -> "Table":+ def _add_vertical_lines(self) -> Table:"""Adds the vertical lines to the table"""anchor_top = self.get_rows().get_top()[1] + 0.5 * self.v_buffanchor_bottom = self.get_rows().get_bottom()[1] - 0.5 * self.v_buff@@ -506,7 +508,7 @@ class Table(VGroup):"""return VGroup(*(VGroup(*row) for row in self.mob_table))- def set_column_colors(self, *colors: Iterable[Color]) -> "Table":+ def set_column_colors(self, *colors: Iterable[Color]) -> Table:"""Set individual colors for each column of the table.Parameters@@ -535,7 +537,7 @@ class Table(VGroup):column.set_color(color)return self- def set_row_colors(self, *colors: Iterable[Color]) -> "Table":+ def set_row_colors(self, *colors: Iterable[Color]) -> Table:"""Set individual colors for each row of the table.Parameters@@ -566,8 +568,8 @@ class Table(VGroup):def get_entries(self,- pos: Optional[Sequence[int]] = None,- ) -> Union[VMobject, VGroup]:+ pos: Sequence[int] | None = None,+ ) -> VMobject | VGroup:"""Return the individual entries of the table (including labels) or one specific entryif the parameter, ``pos``, is set.@@ -618,8 +620,8 @@ class Table(VGroup):def get_entries_without_labels(self,- pos: Optional[Sequence[int]] = None,- ) -> Union[VMobject, VGroup]:+ pos: Sequence[int] | None = None,+ ) -> VMobject | VGroup:"""Return the individual entries of the table (without labels) or one specific entryif the parameter, ``pos``, is set.@@ -754,7 +756,7 @@ class Table(VGroup):label_group.add(*label)return label_group- def add_background_to_entries(self, color: Color = BLACK) -> "Table":+ def add_background_to_entries(self, color: Color = BLACK) -> Table:"""Adds a black :class:`~.BackgroundRectangle` to each entry of the table."""for mob in self.get_entries():mob.add_background_rectangle(color=color)@@ -819,7 +821,7 @@ class Table(VGroup):def get_highlighted_cell(self, pos: Sequence[int] = (1, 1), color: Color = YELLOW, **kwargs- ) -> "BackgroundRectangle":+ ) -> BackgroundRectangle:"""Returns a :class:`~.BackgroundRectangle` of the cell at the given position.Parameters@@ -855,7 +857,7 @@ class Table(VGroup):def add_highlighted_cell(self, pos: Sequence[int] = (1, 1), color: Color = YELLOW, **kwargs- ) -> "Table":+ ) -> Table:"""Highlights one cell at a specific position on the table by adding a :class:`~.BackgroundRectangle`.Parameters@@ -991,8 +993,8 @@ class MathTable(Table):def __init__(self,- table: Iterable[Iterable[Union[float, str]]],- element_to_mobject: Callable[[Union[float, str]], VMobject] = MathTex,+ table: Iterable[Iterable[float | str]],+ element_to_mobject: Callable[[float | str], VMobject] = MathTex,**kwargs,):"""@@ -1094,8 +1096,8 @@ class IntegerTable(Table):def __init__(self,- table: Iterable[Iterable[Union[float, str]]],- element_to_mobject: Callable[[Union[float, str]], VMobject] = Integer,+ table: Iterable[Iterable[float | str]],+ element_to_mobject: Callable[[float | str], VMobject] = Integer,**kwargs,):"""@@ -1138,8 +1140,8 @@ class DecimalTable(Table):def __init__(self,- table: Iterable[Iterable[Union[float, str]]],- element_to_mobject: Callable[[Union[float, str]], VMobject] = DecimalNumber,+ table: Iterable[Iterable[float | str]],+ element_to_mobject: Callable[[float | str], VMobject] = DecimalNumber,element_to_mobject_config: dict = {"num_decimal_places": 1},**kwargs,):diff --git a/manim/mobject/three_d_utils.py b/manim/mobject/three_d_utils.pyindex 56ada6afa..19fdcef04 100644--- a/manim/mobject/three_d_utils.py+++ b/manim/mobject/three_d_utils.py@@ -1,5 +1,7 @@"""Utility functions for three-dimensional mobjects."""+from __future__ import annotations+__all__ = ["get_3d_vmob_gradient_start_and_end_points","get_3d_vmob_start_corner_index",diff --git a/manim/mobject/three_dimensions.py b/manim/mobject/three_dimensions.pyindex 9ceaf1a78..9c22fe04a 100644--- a/manim/mobject/three_dimensions.py+++ b/manim/mobject/three_dimensions.py@@ -1,5 +1,7 @@"""Three-dimensional mobjects."""+from __future__ import annotations+__all__ = ["ThreeDVMobject","Surface",@@ -767,11 +769,7 @@ class Line3D(Cylinder):@classmethoddef parallel_to(- cls,- line: "Line3D",- point: Sequence[float] = ORIGIN,- length: float = 5,- **kwargs+ cls, line: Line3D, point: Sequence[float] = ORIGIN, length: float = 5, **kwargs):"""Returns a line parallel to another line going througha given point.@@ -808,11 +806,7 @@ class Line3D(Cylinder):@classmethoddef perpendicular_to(- cls,- line: "Line3D",- point: Sequence[float] = ORIGIN,- length: float = 5,- **kwargs+ cls, line: Line3D, point: Sequence[float] = ORIGIN, length: float = 5, **kwargs):"""Returns a line perpendicular to another line going througha given point.diff --git a/manim/mobject/types/dot_cloud.py b/manim/mobject/types/dot_cloud.pyindex 6468f7eb9..85298db19 100644--- a/manim/mobject/types/dot_cloud.py+++ b/manim/mobject/types/dot_cloud.py@@ -1,3 +1,5 @@+from __future__ import annotations+__all__ = ["TrueDot", "DotCloud"]import numpy as npdiff --git a/manim/mobject/types/image_mobject.py b/manim/mobject/types/image_mobject.pyindex 809d9da40..1cbaddb3f 100644--- a/manim/mobject/types/image_mobject.py+++ b/manim/mobject/types/image_mobject.py@@ -1,5 +1,7 @@"""Mobjects representing raster images."""+from __future__ import annotations+__all__ = ["AbstractImageMobject", "ImageMobject", "ImageMobjectFromCamera"]import pathlibdiff --git a/manim/mobject/types/opengl_point_cloud_mobject.py b/manim/mobject/types/opengl_point_cloud_mobject.pyindex 73a182822..c9894a21b 100644--- a/manim/mobject/types/opengl_point_cloud_mobject.py+++ b/manim/mobject/types/opengl_point_cloud_mobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+__all__ = ["OpenGLPMobject", "OpenGLPGroup", "OpenGLPMPoint"]import moderngldiff --git a/manim/mobject/types/opengl_surface.py b/manim/mobject/types/opengl_surface.pyindex 01d8b9194..2a69776ac 100644--- a/manim/mobject/types/opengl_surface.py+++ b/manim/mobject/types/opengl_surface.py@@ -1,3 +1,5 @@+from __future__ import annotations+import modernglimport numpy as npdiff --git a/manim/mobject/types/opengl_vectorized_mobject.py b/manim/mobject/types/opengl_vectorized_mobject.pyindex 704b50de4..87972ab25 100644--- a/manim/mobject/types/opengl_vectorized_mobject.py+++ b/manim/mobject/types/opengl_vectorized_mobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+import itertools as itimport operator as opfrom functools import reduce, wraps@@ -66,9 +68,9 @@ class OpenGLVMobject(OpenGLMobject):def __init__(self,- fill_color: Optional[Color] = None,+ fill_color: Color | None = None,fill_opacity: float = 0.0,- stroke_color: Optional[Color] = None,+ stroke_color: Color | None = None,stroke_opacity: float = 1.0,stroke_width: float = DEFAULT_STROKE_WIDTH,draw_stroke_behind_fill: bool = False,@@ -76,7 +78,7 @@ class OpenGLVMobject(OpenGLMobject):# that it should count in parent mobject's pathpre_function_handle_to_anchor_scale_factor: float = 0.01,make_smooth_after_applying_functions: float = False,- background_image_file: Optional[str] = None,+ background_image_file: str | None = None,# This is within a pixel# TODO, do we care about accounting for# varying zoom levels?@@ -156,10 +158,10 @@ class OpenGLVMobject(OpenGLMobject):def set_fill(self,- color: Optional[Color] = None,- opacity: Optional[float] = None,+ color: Color | None = None,+ opacity: float | None = None,recurse: bool = True,- ) -> "OpenGLVMobject":+ ) -> OpenGLVMobject:"""Set the fill color and fill opacity of a :class:`OpenGLVMobject`.Parameters@@ -448,7 +450,7 @@ class OpenGLVMobject(OpenGLMobject):else:self.append_points([self.get_last_point(), handle, anchor])- def add_line_to(self, point: Sequence[float]) -> "OpenGLVMobject":+ def add_line_to(self, point: Sequence[float]) -> OpenGLVMobject:"""Add a straight line from the last point of OpenGLVMobject to the given point.Parameters@@ -527,7 +529,7 @@ class OpenGLVMobject(OpenGLMobject):self.add_line_to(point)return points- def set_points_as_corners(self, points: Iterable[float]) -> "OpenGLVMobject":+ def set_points_as_corners(self, points: Iterable[float]) -> OpenGLVMobject:"""Given an array of points, set them as corner of the vmobject.To achieve that, this algorithm sets handles aligned with the anchors such that the resultant bezier curve will be the segment@@ -753,8 +755,8 @@ class OpenGLVMobject(OpenGLMobject):def get_nth_curve_function_with_length(self,n: int,- sample_points: Optional[int] = None,- ) -> Tuple[Callable[[float], np.ndarray], float]:+ sample_points: int | None = None,+ ) -> tuple[Callable[[float], np.ndarray], float]:"""Returns the expression of the nth curve along with its (approximate) length.Parameters@@ -798,7 +800,7 @@ class OpenGLVMobject(OpenGLMobject):def get_nth_curve_length(self,n: int,- sample_points: Optional[int] = None,+ sample_points: int | None = None,) -> float:"""Returns the (approximate) length of the nth curve.@@ -822,8 +824,8 @@ class OpenGLVMobject(OpenGLMobject):def get_nth_curve_function_with_length(self,n: int,- sample_points: Optional[int] = None,- ) -> Tuple[Callable[[float], np.ndarray], float]:+ sample_points: int | None = None,+ ) -> tuple[Callable[[float], np.ndarray], float]:"""Returns the expression of the nth curve along with its (approximate) length.Parameters@@ -872,7 +874,7 @@ class OpenGLVMobject(OpenGLMobject):def get_curve_functions_with_lengths(self, **kwargs- ) -> Iterable[Tuple[Callable[[float], np.ndarray], float]]:+ ) -> Iterable[tuple[Callable[[float], np.ndarray], float]]:"""Gets the functions and lengths of the curves for the mobject.Parameters@@ -937,7 +939,7 @@ class OpenGLVMobject(OpenGLMobject):def proportion_from_point(self,- point: Iterable[Union[float, int]],+ point: Iterable[float | int],) -> float:"""Returns the proportion along the path of the :class:`OpenGLVMobject`a particular given point is at.@@ -1057,7 +1059,7 @@ class OpenGLVMobject(OpenGLMobject):)return points[distinct_curves.repeat(nppc)]- def get_arc_length(self, sample_points_per_curve: Optional[int] = None) -> float:+ def get_arc_length(self, sample_points_per_curve: int | None = None) -> float:"""Return the approximated length of the whole curve.Parameters@@ -1203,7 +1205,7 @@ class OpenGLVMobject(OpenGLMobject):vmobject.set_points(np.vstack(new_subpaths2))return self- def insert_n_curves(self, n: int, recurse=True) -> "OpenGLVMobject":+ def insert_n_curves(self, n: int, recurse=True) -> OpenGLVMobject:"""Inserts n curves to the bezier curves of the vmobject.Parameters@@ -1285,10 +1287,10 @@ class OpenGLVMobject(OpenGLMobject):def pointwise_become_partial(self,- vmobject: "OpenGLVMobject",+ vmobject: OpenGLVMobject,a: float,b: float,- ) -> "OpenGLVMobject":+ ) -> OpenGLVMobject:"""Given two bounds a and b, transforms the points of the self vmobject into the points of the vmobjectpassed as parameter with respect to the bounds. Points here stand for control points of the bezier curves (anchors and handles)@@ -1354,7 +1356,7 @@ class OpenGLVMobject(OpenGLMobject):self.set_points(new_points)return self- def get_subcurve(self, a: float, b: float) -> "OpenGLVMobject":+ def get_subcurve(self, a: float, b: float) -> OpenGLVMobject:"""Returns the subcurve of the OpenGLVMobject between the interval [a, b].The curve is a OpenGLVMobject itself.@@ -1749,9 +1751,7 @@ class OpenGLVGroup(OpenGLVMobject):def __isub__(self, vmobject):return self.remove(vmobject)- def __setitem__(- self, key: int, value: Union[OpenGLVMobject, Sequence[OpenGLVMobject]]- ):+ def __setitem__(self, key: int, value: OpenGLVMobject | Sequence[OpenGLVMobject]):"""Override the [] operator for item assignment.Parameters@@ -1861,7 +1861,7 @@ class OpenGLDashedVMobject(OpenGLVMobject):def __init__(self,- vmobject: "OpenGLVMobject",+ vmobject: OpenGLVMobject,num_dashes: int = 15,dashed_ratio: float = 0.5,color: Color = WHITE,diff --git a/manim/mobject/types/point_cloud_mobject.py b/manim/mobject/types/point_cloud_mobject.pyindex cca230385..f53f78d99 100644--- a/manim/mobject/types/point_cloud_mobject.py+++ b/manim/mobject/types/point_cloud_mobject.py@@ -1,5 +1,7 @@"""Mobjects representing point clouds."""+from __future__ import annotations+__all__ = ["PMobject", "Mobject1D", "Mobject2D", "PGroup", "PointCloudDot", "Point"]import numpy as npdiff --git a/manim/mobject/value_tracker.py b/manim/mobject/value_tracker.pyindex 981ffc22f..56a65c5d0 100644--- a/manim/mobject/value_tracker.py+++ b/manim/mobject/value_tracker.py@@ -1,5 +1,7 @@"""Mobjects that dynamically show the change of a variable."""+from __future__ import annotations+__all__ = ["ValueTracker", "ComplexValueTracker"]diff --git a/manim/mobject/vector_field.py b/manim/mobject/vector_field.pyindex f8d511b93..843f04938 100644--- a/manim/mobject/vector_field.py+++ b/manim/mobject/vector_field.py@@ -1,5 +1,7 @@"""Mobjects representing vector fields."""+from __future__ import annotations+__all__ = ["VectorField","ArrowVectorField",@@ -62,8 +64,8 @@ class VectorField(VGroup):def __init__(self,func: Callable[[np.ndarray], np.ndarray],- color: Optional[Color] = None,- color_scheme: Optional[Callable[[np.ndarray], float]] = None,+ color: Color | None = None,+ color_scheme: Callable[[np.ndarray], float] | None = None,min_color_scheme_value: float = 0,max_color_scheme_value: float = 2,colors: Sequence[Color] = DEFAULT_SCALAR_FIELD_COLORS,@@ -81,7 +83,7 @@ class VectorField(VGroup):self.color_scheme = color_scheme # TODO maybe other default for direction?self.rgbs = np.array(list(map(color_to_rgb, colors)))- def pos_to_rgb(pos: np.ndarray) -> Tuple[float, float, float, float]:+ def pos_to_rgb(pos: np.ndarray) -> tuple[float, float, float, float]:vec = self.func(pos)color_value = np.clip(self.color_scheme(vec),@@ -171,7 +173,7 @@ class VectorField(VGroup):dt: float = 1,substeps: int = 1,pointwise: bool = False,- ) -> "VectorField":+ ) -> VectorField:"""Nudge a :class:`~.Mobject` along the vector field.Parameters@@ -255,7 +257,7 @@ class VectorField(VGroup):dt: float = 1,substeps: int = 1,pointwise: bool = False,- ) -> "VectorField":+ ) -> VectorField:"""Apply a nudge along the vector field to all submobjects.Parameters@@ -306,7 +308,7 @@ class VectorField(VGroup):self,speed: float = 1,pointwise: bool = False,- ) -> "VectorField":+ ) -> VectorField:"""Start continuously moving all submobjects along the vector field.Calling this method multiple times will result in removing the previous updater created by this method.@@ -333,7 +335,7 @@ class VectorField(VGroup):self.add_updater(self.submob_movement_updater)return self- def stop_submobject_movement(self) -> "VectorField":+ def stop_submobject_movement(self) -> VectorField:"""Stops the continuous movement started using :meth:`start_submobject_movement`.Returns@@ -513,8 +515,8 @@ class ArrowVectorField(VectorField):def __init__(self,func: Callable[[np.ndarray], np.ndarray],- color: Optional[Color] = None,- color_scheme: Optional[Callable[[np.ndarray], float]] = None,+ color: Color | None = None,+ color_scheme: Callable[[np.ndarray], float] | None = None,min_color_scheme_value: float = 0,max_color_scheme_value: float = 2,colors: Sequence[Color] = DEFAULT_SCALAR_FIELD_COLORS,@@ -526,7 +528,7 @@ class ArrowVectorField(VectorField):# Takes in actual norm, spits out displayed normlength_func: Callable[[float], float] = lambda norm: 0.45 * sigmoid(norm),opacity: float = 1.0,- vector_config: Optional[dict] = None,+ vector_config: dict | None = None,**kwargs):self.x_range = x_range or [@@ -685,8 +687,8 @@ class StreamLines(VectorField):def __init__(self,func: Callable[[np.ndarray], np.ndarray],- color: Optional[Color] = None,- color_scheme: Optional[Callable[[np.ndarray], float]] = None,+ color: Color | None = None,+ color_scheme: Callable[[np.ndarray], float] | None = None,min_color_scheme_value: float = 0,max_color_scheme_value: float = 2,colors: Sequence[Color] = DEFAULT_SCALAR_FIELD_COLORS,@@ -695,7 +697,7 @@ class StreamLines(VectorField):y_range: Sequence[float] = None,z_range: Sequence[float] = None,three_dimensions: bool = False,- noise_factor: Optional[float] = None,+ noise_factor: float | None = None,n_repeats=1,# Determining how lines are drawndt=0.05,@@ -827,8 +829,8 @@ class StreamLines(VectorField):def create(self,- lag_ratio: Optional[float] = None,- run_time: Optional[Callable[[float], float]] = None,+ lag_ratio: float | None = None,+ run_time: Callable[[float], float] | None = None,**kwargs) -> AnimationGroup:"""The creation animation of the stream lines.@@ -887,7 +889,7 @@ class StreamLines(VectorField):flow_speed: float = 1,time_width: float = 0.3,rate_func: Callable[[float], float] = linear,- line_animation_class: Type[ShowPassingFlash] = ShowPassingFlash,+ line_animation_class: type[ShowPassingFlash] = ShowPassingFlash,**kwargs) -> None:"""Animates the stream lines using an updater.diff --git a/manim/opengl/__init__.py b/manim/opengl/__init__.pyindex 5a15d607a..1f40fda9a 100644--- a/manim/opengl/__init__.py+++ b/manim/opengl/__init__.py@@ -1,3 +1,5 @@+from __future__ import annotations+try:from dearpygui import dearpygui as dpgexcept ImportError:diff --git a/manim/plugins/__init__.py b/manim/plugins/__init__.pyindex 15c56a2b5..a899f63bb 100644--- a/manim/plugins/__init__.py+++ b/manim/plugins/__init__.py@@ -1 +1,3 @@+from __future__ import annotations+from .import_plugins import *diff --git a/manim/plugins/import_plugins.py b/manim/plugins/import_plugins.pyindex d2aee5806..2cb69281e 100644--- a/manim/plugins/import_plugins.py+++ b/manim/plugins/import_plugins.py@@ -1,3 +1,5 @@+from __future__ import annotations+import typesfrom importlib import import_modulediff --git a/manim/plugins/plugins_flags.py b/manim/plugins/plugins_flags.pyindex b23bef341..44b0dce7f 100644--- a/manim/plugins/plugins_flags.py+++ b/manim/plugins/plugins_flags.py@@ -5,6 +5,8 @@ plugins_flags.pyPlugin Managing Utility."""+from __future__ import annotations+import pkg_resourcesfrom manim import consolediff --git a/manim/renderer/cairo_renderer.py b/manim/renderer/cairo_renderer.pyindex 99e1a7ba0..76cf0db24 100644--- a/manim/renderer/cairo_renderer.py+++ b/manim/renderer/cairo_renderer.py@@ -1,3 +1,5 @@+from __future__ import annotations+import timeimport typingfrom typing import Any@@ -201,7 +203,7 @@ class CairoRenderer:self,scene,static_mobjects: typing.Iterable[Mobject],- ) -> typing.Optional[typing.Iterable[Mobject]]:+ ) -> typing.Iterable[Mobject] | None:"""Compute and save the static frame, that will be reused at each frame to avoid to unecesseraly computerstatic mobjects.diff --git a/manim/renderer/opengl_renderer.py b/manim/renderer/opengl_renderer.pyindex 523eaba6a..eed4bcc8f 100644--- a/manim/renderer/opengl_renderer.py+++ b/manim/renderer/opengl_renderer.py@@ -1,3 +1,5 @@+from __future__ import annotations+import itertools as itimport timefrom typing import Anydiff --git a/manim/renderer/opengl_renderer_window.py b/manim/renderer/opengl_renderer_window.pyindex 7cc888333..14d913899 100644--- a/manim/renderer/opengl_renderer_window.py+++ b/manim/renderer/opengl_renderer_window.py@@ -1,3 +1,5 @@+from __future__ import annotations+import moderngl_window as mglwfrom moderngl_window.context.pyglet.window import Window as PygletWindowfrom moderngl_window.timers.clock import Timerdiff --git a/manim/renderer/shader.py b/manim/renderer/shader.pyindex d4b535873..fa2c3a99c 100644--- a/manim/renderer/shader.py+++ b/manim/renderer/shader.py@@ -1,3 +1,5 @@+from __future__ import annotations+import osimport reimport textwrapdiff --git a/manim/renderer/shader_wrapper.py b/manim/renderer/shader_wrapper.pyindex def701aa4..9fe87f3c5 100644--- a/manim/renderer/shader_wrapper.py+++ b/manim/renderer/shader_wrapper.py@@ -1,3 +1,5 @@+from __future__ import annotations+import copyimport osimport rediff --git a/manim/renderer/vectorized_mobject_rendering.py b/manim/renderer/vectorized_mobject_rendering.pyindex 348232351..5028fa3d5 100644--- a/manim/renderer/vectorized_mobject_rendering.py+++ b/manim/renderer/vectorized_mobject_rendering.py@@ -1,3 +1,5 @@+from __future__ import annotations+import collectionsimport numpy as npdiff --git a/manim/renderer/webgl_renderer.py b/manim/renderer/webgl_renderer.pyindex 4ad5a8e6c..2e3fd4254 100644--- a/manim/renderer/webgl_renderer.py+++ b/manim/renderer/webgl_renderer.py@@ -1,3 +1,5 @@+from __future__ import annotations+import copyfrom dataclasses import dataclassdiff --git a/manim/scene/moving_camera_scene.py b/manim/scene/moving_camera_scene.pyindex 2cd331a85..f68ca4586 100644--- a/manim/scene/moving_camera_scene.py+++ b/manim/scene/moving_camera_scene.py@@ -66,6 +66,8 @@ Examples"""+from __future__ import annotations+__all__ = ["MovingCameraScene"]from ..camera.moving_camera import MovingCameradiff --git a/manim/scene/scene.py b/manim/scene/scene.pyindex 8a98f7b88..26be794b9 100644--- a/manim/scene/scene.py+++ b/manim/scene/scene.py@@ -1,5 +1,7 @@"""Basic canvas for animations."""+from __future__ import annotations+__all__ = ["Scene"]import copydiff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.pyindex 0a30c6c64..a370eeba3 100644--- a/manim/scene/scene_file_writer.py+++ b/manim/scene/scene_file_writer.py@@ -1,5 +1,7 @@"""The interface between scenes and ffmpeg."""+from __future__ import annotations+__all__ = ["SceneFileWriter"]import datetime@@ -71,9 +73,9 @@ class SceneFileWriter:self.init_output_directories(scene_name)self.init_audio()self.frame_count = 0- self.partial_movie_files: List[str] = []- self.subcaptions: List[srt.Subtitle] = []- self.sections: List[Section] = []+ self.partial_movie_files: list[str] = []+ self.subcaptions: list[srt.Subtitle] = []+ self.sections: list[Section] = []# first section gets automatically created for convenience# if you need the first section to be skipped, add a first section by hand, it will replace this oneself.next_section(@@ -163,7 +165,7 @@ class SceneFileWriter:self.finish_last_section()# images don't support sections- section_video: Optional[str] = None+ section_video: str | None = None# don't save when Noneif (not config.dry_run@@ -539,7 +541,7 @@ class SceneFileWriter:def combine_files(self,- input_files: List[str],+ input_files: list[str],output_file: str,create_gif=False,includes_sound=False,@@ -664,7 +666,7 @@ class SceneFileWriter:"""Concatenate partial movie files for each section."""self.finish_last_section()- sections_index: List[Dict[str, Any]] = []+ sections_index: list[dict[str, Any]] = []for section in self.sections:# only if section does want to be savedif section.video is not None:diff --git a/manim/scene/section.py b/manim/scene/section.pyindex 62c9fb1b3..795c803ae 100644--- a/manim/scene/section.py+++ b/manim/scene/section.py@@ -1,5 +1,7 @@"""building blocks of segmented video API"""+from __future__ import annotations+import osfrom enum import Enumfrom typing import Any, Dict, List, Optional@@ -55,15 +57,13 @@ class Section::meth:`.OpenGLRenderer.update_skipping_status`"""- def __init__(- self, type: str, video: Optional[str], name: str, skip_animations: bool- ):+ def __init__(self, type: str, video: str | None, name: str, skip_animations: bool):self.type = type# None when not to be saved -> still keeps section alive- self.video: Optional[str] = video+ self.video: str | None = videoself.name = nameself.skip_animations = skip_animations- self.partial_movie_files: List[Optional[str]] = []+ self.partial_movie_files: list[str | None] = []def is_empty(self) -> bool:"""Check whether this section is empty.@@ -72,11 +72,11 @@ class Section:"""return len(self.partial_movie_files) == 0- def get_clean_partial_movie_files(self) -> List[str]:+ def get_clean_partial_movie_files(self) -> list[str]:"""Return all partial movie files that are not ``None``."""return [el for el in self.partial_movie_files if el is not None]- def get_dict(self, sections_dir: str) -> Dict[str, Any]:+ def get_dict(self, sections_dir: str) -> dict[str, Any]:"""Get dictionary representation with metadata of output video.The output from this function is used from every section to build the sections index file.diff --git a/manim/scene/three_d_scene.py b/manim/scene/three_d_scene.pyindex b9f659c24..558104baf 100644--- a/manim/scene/three_d_scene.py+++ b/manim/scene/three_d_scene.py@@ -1,5 +1,7 @@"""A scene suitable for rendering three-dimensional objects and animations."""+from __future__ import annotations+__all__ = ["ThreeDScene", "SpecialThreeDScene"]@@ -51,12 +53,12 @@ class ThreeDScene(Scene):def set_camera_orientation(self,- phi: Optional[float] = None,- theta: Optional[float] = None,- gamma: Optional[float] = None,- zoom: Optional[float] = None,- focal_distance: Optional[float] = None,- frame_center: Optional[Union["Mobject", Sequence[float]]] = None,+ phi: float | None = None,+ theta: float | None = None,+ gamma: float | None = None,+ zoom: float | None = None,+ focal_distance: float | None = None,+ frame_center: Mobject | Sequence[float] | None = None,**kwargs,):"""@@ -158,8 +160,8 @@ class ThreeDScene(Scene):def begin_3dillusion_camera_rotation(self,rate: float = 1,- origin_phi: Optional[float] = None,- origin_theta: Optional[float] = None,+ origin_phi: float | None = None,+ origin_theta: float | None = None,):"""This method creates a 3D camera rotation illusion around@@ -212,13 +214,13 @@ class ThreeDScene(Scene):def move_camera(self,- phi: Optional[float] = None,- theta: Optional[float] = None,- gamma: Optional[float] = None,- zoom: Optional[float] = None,- focal_distance: Optional[float] = None,- frame_center: Optional[Union["Mobject", Sequence[float]]] = None,- added_anims: Iterable["Animation"] = [],+ phi: float | None = None,+ theta: float | None = None,+ gamma: float | None = None,+ zoom: float | None = None,+ focal_distance: float | None = None,+ frame_center: Mobject | Sequence[float] | None = None,+ added_anims: Iterable[Animation] = [],**kwargs,):"""diff --git a/manim/scene/vector_space_scene.py b/manim/scene/vector_space_scene.pyindex dd12cb8f6..b5a09f076 100644--- a/manim/scene/vector_space_scene.py+++ b/manim/scene/vector_space_scene.py@@ -1,5 +1,7 @@"""A scene suitable for vector spaces."""+from __future__ import annotations+__all__ = ["VectorScene", "LinearTransformationScene"]@@ -561,8 +563,8 @@ class LinearTransformationScene(VectorScene):self,include_background_plane: bool = True,include_foreground_plane: bool = True,- background_plane_kwargs: Optional[dict] = None,- foreground_plane_kwargs: Optional[dict] = None,+ background_plane_kwargs: dict | None = None,+ foreground_plane_kwargs: dict | None = None,show_coordinates: bool = False,show_basis_vectors: bool = True,basis_vector_stroke_width: float = 6,diff --git a/manim/scene/zoomed_scene.py b/manim/scene/zoomed_scene.pyindex 2b7a8f0cf..573c089ff 100644--- a/manim/scene/zoomed_scene.py+++ b/manim/scene/zoomed_scene.py@@ -45,6 +45,8 @@ Examples"""+from __future__ import annotations+__all__ = ["ZoomedScene"]diff --git a/manim/utils/bezier.py b/manim/utils/bezier.pyindex 800737a25..bb891fafd 100644--- a/manim/utils/bezier.py+++ b/manim/utils/bezier.py@@ -1,5 +1,7 @@"""Utility functions related to Bézier curves."""+from __future__ import annotations+__all__ = ["bezier","partial_bezier_points",@@ -30,7 +32,7 @@ from ..utils.space_ops import cross2d, find_intersectiondef bezier(points: np.ndarray,-) -> typing.Callable[[float], typing.Union[int, typing.Iterable]]:+) -> typing.Callable[[float], int | typing.Iterable]:"""Classic implementation of a bezier curve.Parameters@@ -111,7 +113,7 @@ def integer_interpolate(start: float,end: float,alpha: float,-) -> typing.Tuple[int, float]:+) -> tuple[int, float]:"""Alpha is a float between 0 and 1. This returnsan integer between start and end (inclusive) representing@@ -217,7 +219,7 @@ def get_smooth_cubic_bezier_handle_points(points):def get_smooth_handle_points(points: np.ndarray,-) -> typing.Tuple[np.ndarray, np.ndarray]:+) -> tuple[np.ndarray, np.ndarray]:"""Given some anchors (points), compute handles so the resulting bezier curve is smooth.Parameters@@ -288,7 +290,7 @@ def get_smooth_handle_points(return handle_pairs[0::2], handle_pairs[1::2]-def diag_to_matrix(l_and_u: typing.Tuple[int, int], diag: np.ndarray) -> np.ndarray:+def diag_to_matrix(l_and_u: tuple[int, int], diag: np.ndarray) -> np.ndarray:"""Converts array whose rows represent diagonalentries of a matrix into the matrix itself.@@ -375,14 +377,14 @@ def get_quadratic_approximation_of_cubic(a0, h0, h1, a1):return result-def is_closed(points: typing.Tuple[np.ndarray, np.ndarray]) -> bool:+def is_closed(points: tuple[np.ndarray, np.ndarray]) -> bool:return np.allclose(points[0], points[-1])def proportions_along_bezier_curve_for_point(- point: typing.Iterable[typing.Union[float, int]],- control_points: typing.Iterable[typing.Iterable[typing.Union[float, int]]],- round_to: typing.Optional[typing.Union[float, int]] = 1e-6,+ point: typing.Iterable[float | int],+ control_points: typing.Iterable[typing.Iterable[float | int]],+ round_to: float | int | None = 1e-6,) -> np.ndarray:"""Obtains the proportion along the bezier curve corresponding to a given pointgiven the bezier curve's control points.@@ -464,9 +466,9 @@ def proportions_along_bezier_curve_for_point(def point_lies_on_bezier(- point: typing.Iterable[typing.Union[float, int]],- control_points: typing.Iterable[typing.Iterable[typing.Union[float, int]]],- round_to: typing.Optional[typing.Union[float, int]] = 1e-6,+ point: typing.Iterable[float | int],+ control_points: typing.Iterable[typing.Iterable[float | int]],+ round_to: float | int | None = 1e-6,) -> bool:"""Checks if a given point lies on the bezier curves with the given control points.diff --git a/manim/utils/caching.py b/manim/utils/caching.pyindex 72ff39fb8..4e776d977 100644--- a/manim/utils/caching.py+++ b/manim/utils/caching.py@@ -1,3 +1,5 @@+from __future__ import annotations+from .. import config, loggerfrom ..utils.hashing import get_hash_from_play_calldiff --git a/manim/utils/color.py b/manim/utils/color.pyindex 9cb919b76..0b024c1fa 100644--- a/manim/utils/color.py+++ b/manim/utils/color.py@@ -1,5 +1,7 @@"""Colors and utility functions for conversion between different color models."""+from __future__ import annotations+__all__ = ["color_to_rgb","color_to_rgba",@@ -449,7 +451,7 @@ __all__ += []-def color_to_rgb(color: Union[Color, str]) -> np.ndarray:+def color_to_rgb(color: Color | str) -> np.ndarray:if isinstance(color, str):return hex_to_rgb(color)elif isinstance(color, Color):@@ -458,7 +460,7 @@ def color_to_rgb(color: Union[Color, str]) -> np.ndarray:raise ValueError("Invalid color type: " + str(color))-def color_to_rgba(color: Union[Color, str], alpha: float = 1) -> np.ndarray:+def color_to_rgba(color: Color | str, alpha: float = 1) -> np.ndarray:return np.array([*color_to_rgb(color), alpha])@@ -498,7 +500,7 @@ def color_to_int_rgba(color: Color, opacity: float = 1.0) -> np.ndarray:def color_gradient(reference_colors: Iterable[Color],length_of_output: int,-) -> List[Color]:+) -> list[Color]:if length_of_output == 0:return reference_colors[0]rgbs = list(map(color_to_rgb, reference_colors))diff --git a/manim/utils/commands.py b/manim/utils/commands.pyindex 366dd32cd..19693e42c 100644--- a/manim/utils/commands.py+++ b/manim/utils/commands.py@@ -1,3 +1,5 @@+from __future__ import annotations+import jsonimport osfrom subprocess import run@@ -16,7 +18,7 @@ def capture(command, cwd=None, command_input=None):return out, err, p.returncode-def get_video_metadata(path_to_video: str) -> Dict[str, Any]:+def get_video_metadata(path_to_video: str) -> dict[str, Any]:command = ["ffprobe","-v",@@ -34,9 +36,9 @@ def get_video_metadata(path_to_video: str) -> Dict[str, Any]:return json.loads(config)["streams"][0]-def get_dir_layout(dirpath: str) -> List[str]:+def get_dir_layout(dirpath: str) -> list[str]:"""Get list of paths relative to dirpath of all files in dir and subdirs recursively."""- index_files: List[str] = []+ index_files: list[str] = []for root, dirs, files in os.walk(dirpath):for file in files:index_files.append(f"{os.path.relpath(os.path.join(root, file), dirpath)}")diff --git a/manim/utils/config_ops.py b/manim/utils/config_ops.pyindex 12ae00e93..354cc2e67 100644--- a/manim/utils/config_ops.py+++ b/manim/utils/config_ops.py@@ -1,5 +1,7 @@"""Utilities that might be useful for configuration dictionaries."""+from __future__ import annotations+__all__ = ["merge_dicts_recursively","update_dict_recursively",diff --git a/manim/utils/debug.py b/manim/utils/debug.pyindex 7cb781a6f..7b67bda82 100644--- a/manim/utils/debug.py+++ b/manim/utils/debug.py@@ -1,6 +1,8 @@"""Debugging utilities."""+from __future__ import annotations+__all__ = ["print_family", "index_labels"]diff --git a/manim/utils/deprecation.py b/manim/utils/deprecation.pyindex 8509cc1b2..0c550e2e2 100644--- a/manim/utils/deprecation.py+++ b/manim/utils/deprecation.py@@ -1,5 +1,7 @@"""Decorators for deprecating classes, functions and function parameters."""+from __future__ import annotations+__all__ = ["deprecated", "deprecated_params"]@@ -12,7 +14,7 @@ from decorator import decorate, decoratorfrom .. import logger-def _get_callable_info(callable: Callable) -> Tuple[str, str]:+def _get_callable_info(callable: Callable) -> tuple[str, str]:"""Returns type and name of a callable.Parameters@@ -36,8 +38,8 @@ def _get_callable_info(callable: Callable) -> Tuple[str, str]:def _deprecation_text_component(- since: Optional[str],- until: Optional[str],+ since: str | None,+ until: str | None,message: str,) -> str:"""Generates a text component used in deprecation messages.@@ -68,10 +70,10 @@ def _deprecation_text_component(def deprecated(func: Callable = None,- since: Optional[str] = None,- until: Optional[str] = None,- replacement: Optional[str] = None,- message: Optional[str] = "",+ since: str | None = None,+ until: str | None = None,+ replacement: str | None = None,+ message: str | None = "",) -> Callable:"""Decorator to mark a callable as deprecated.@@ -221,13 +223,12 @@ def deprecated(def deprecated_params(- params: Optional[Union[str, Iterable[str]]] = None,- since: Optional[str] = None,- until: Optional[str] = None,- message: Optional[str] = "",- redirections: Optional[- "Iterable[Union[Tuple[str, str], Callable[..., dict[str, Any]]]]"- ] = None,+ params: str | Iterable[str] | None = None,+ since: str | None = None,+ until: str | None = None,+ message: str | None = "",+ redirections: None+ | (Iterable[tuple[str, str] | Callable[..., dict[str, Any]]]) = None,) -> Callable:"""Decorator to mark parameters of a callable as deprecated.@@ -386,7 +387,7 @@ def deprecated_params(redirections = list(redirections)- def warning_msg(func: Callable, used: List[str]):+ def warning_msg(func: Callable, used: list[str]):"""Generate the deprecation warning message.Parameters@@ -409,7 +410,7 @@ def deprecated_params(deprecated = _deprecation_text_component(since, until, message)return f"The parameter{parameter_s} {used_} of {what} {name} {has_have_been} {deprecated}"- def redirect_params(kwargs: dict, used: List[str]):+ def redirect_params(kwargs: dict, used: list[str]):"""Adjust the keyword arguments as defined by the redirections.Parametersdiff --git a/manim/utils/docbuild/manim_directive.py b/manim/utils/docbuild/manim_directive.pyindex d7a5d9364..c14c269bf 100644--- a/manim/utils/docbuild/manim_directive.py+++ b/manim/utils/docbuild/manim_directive.py@@ -73,6 +73,8 @@ directive:that is rendered in a reference block after the source code."""+from __future__ import annotations+import csvimport itertools as itimport os@@ -105,7 +107,7 @@ def depart(self, node):self.depart_admonition(node)-def process_name_list(option_input: str, reference_type: str) -> List[str]:+def process_name_list(option_input: str, reference_type: str) -> list[str]:r"""Reformats a string of space separated class namesas a list of strings containing valid Sphinx references.diff --git a/manim/utils/exceptions.py b/manim/utils/exceptions.pyindex 1e98f5ccd..a7cc7f567 100644--- a/manim/utils/exceptions.py+++ b/manim/utils/exceptions.py@@ -1,3 +1,6 @@+from __future__ import annotations++class EndSceneEarlyException(Exception):passdiff --git a/manim/utils/family.py b/manim/utils/family.pyindex 2053935c0..d4f31fbb3 100644--- a/manim/utils/family.py+++ b/manim/utils/family.py@@ -1,3 +1,5 @@+from __future__ import annotations+import itertools as itfrom ..mobject.mobject import Mobjectdiff --git a/manim/utils/family_ops.py b/manim/utils/family_ops.pyindex 1fb544947..4a47e0591 100644--- a/manim/utils/family_ops.py+++ b/manim/utils/family_ops.py@@ -1,3 +1,5 @@+from __future__ import annotations+import itertools as itdiff --git a/manim/utils/file_ops.py b/manim/utils/file_ops.pyindex 173025e07..bb65b6083 100644--- a/manim/utils/file_ops.py+++ b/manim/utils/file_ops.py@@ -1,5 +1,7 @@"""Utility functions for interacting with the file system."""+from __future__ import annotations+__all__ = ["add_extension_if_not_present","guarantee_existence",diff --git a/manim/utils/hashing.py b/manim/utils/hashing.pyindex b4afe9cdf..6e015660f 100644--- a/manim/utils/hashing.py+++ b/manim/utils/hashing.py@@ -1,5 +1,7 @@"""Utilities for scene caching."""+from __future__ import annotations+import collectionsimport copyimport inspect@@ -48,7 +50,7 @@ class _Memoizer:cls._already_processed.clear()@classmethod- def check_already_processed_decorator(cls: "_Memoizer", is_method=False):+ def check_already_processed_decorator(cls: _Memoizer, is_method=False):"""Decorator to handle the arguments that goes through the decorated function.Returns _ALREADY_PROCESSED_PLACEHOLDER if the obj has been processed, or letsthe decorated function call go ahead.@@ -140,7 +142,7 @@ class _Memoizer:obj_to_membership_sign: typing.Callable[[Any], int],default_func,memoizing=True,- ) -> typing.Union[str, Any]:+ ) -> str | Any:obj_membership_sign = obj_to_membership_sign(obj)if obj_membership_sign in cls._already_processed:return cls.ALREADY_PROCESSED_PLACEHOLDERdiff --git a/manim/utils/images.py b/manim/utils/images.pyindex fade65a17..3c94fe9ff 100644--- a/manim/utils/images.py+++ b/manim/utils/images.py@@ -1,5 +1,7 @@"""Image manipulation utilities."""+from __future__ import annotations+__all__ = ["get_full_raster_image_path", "drag_pixels", "invert_image"]@@ -20,7 +22,7 @@ def get_full_raster_image_path(image_file_name: str) -> str:)-def drag_pixels(frames: List[np.array]) -> List[np.array]:+def drag_pixels(frames: list[np.array]) -> list[np.array]:curr = frames[0]new_frames = []for frame in frames:diff --git a/manim/utils/ipython_magic.py b/manim/utils/ipython_magic.pyindex cf50aa9b9..625c5b177 100644--- a/manim/utils/ipython_magic.py+++ b/manim/utils/ipython_magic.py@@ -1,5 +1,7 @@"""Utilities for using Manim with IPython (in particular: Jupyter notebooks)"""+from __future__ import annotations+import mimetypesimport osimport shutil@@ -37,7 +39,7 @@ else:self,line: str,cell: str = None,- local_ns: Dict[str, Any] = None,+ local_ns: dict[str, Any] = None,) -> None:r"""Render Manim scenes contained in IPython cells.Works as a line or cell magic.@@ -176,7 +178,7 @@ else:),)- def add_additional_args(self, args: List[str]) -> List[str]:+ def add_additional_args(self, args: list[str]) -> list[str]:additional_args = ["--jupyter"]# Use webm to support transparencyif "-t" in args and "--format" not in args:diff --git a/manim/utils/iterables.py b/manim/utils/iterables.pyindex a63ae79b1..0984b7590 100644--- a/manim/utils/iterables.py+++ b/manim/utils/iterables.py@@ -1,5 +1,7 @@"""Operations on iterables."""+from __future__ import annotations+__all__ = ["remove_list_redundancies","list_update",diff --git a/manim/utils/module_ops.py b/manim/utils/module_ops.pyindex 4d093e70a..60871cf42 100644--- a/manim/utils/module_ops.py+++ b/manim/utils/module_ops.py@@ -1,3 +1,5 @@+from __future__ import annotations+import importlib.utilimport inspectimport osdiff --git a/manim/utils/opengl.py b/manim/utils/opengl.pyindex fa3ac42ce..e84642d22 100644--- a/manim/utils/opengl.py+++ b/manim/utils/opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport numpy.linalg as linalgdiff --git a/manim/utils/paths.py b/manim/utils/paths.pyindex e5025cc90..9d7ec10d7 100644--- a/manim/utils/paths.py+++ b/manim/utils/paths.py@@ -1,5 +1,7 @@"""Functions determining transformation paths between sets of points."""+from __future__ import annotations+__all__ = ["straight_path","path_along_arc",diff --git a/manim/utils/rate_functions.py b/manim/utils/rate_functions.pyindex acff41e54..261199b52 100644--- a/manim/utils/rate_functions.py+++ b/manim/utils/rate_functions.py@@ -84,6 +84,8 @@ There are primarily 3 kinds of standard easing functions:"""+from __future__ import annotations+__all__ = ["linear","smooth",diff --git a/manim/utils/scale.py b/manim/utils/scale.pyindex e692d6537..78d7fe23d 100644--- a/manim/utils/scale.py+++ b/manim/utils/scale.py@@ -1,3 +1,5 @@+from __future__ import annotations+import mathfrom typing import TYPE_CHECKING, Any, Dict, Iterable, List@@ -54,7 +56,7 @@ class _ScaleBase:def get_custom_labels(self,val_range: Iterable[float],- ) -> Iterable["Mobject"]:+ ) -> Iterable[Mobject]:"""Custom instructions for generating labels along an axis.Parameters@@ -151,8 +153,8 @@ class LogBase(_ScaleBase):self,val_range: Iterable[float],unit_decimal_places: int = 0,- **base_config: Dict[str, Any],- ) -> List["Mobject"]:+ **base_config: dict[str, Any],+ ) -> list[Mobject]:"""Produces custom :class:`~.Integer` labels in the form of ``10^2``.Parametersdiff --git a/manim/utils/simple_functions.py b/manim/utils/simple_functions.pyindex 95fd3a961..ed37b0b74 100644--- a/manim/utils/simple_functions.py+++ b/manim/utils/simple_functions.py@@ -1,5 +1,7 @@"""A collection of simple functions."""+from __future__ import annotations+__all__ = ["sigmoid","choose",diff --git a/manim/utils/sounds.py b/manim/utils/sounds.pyindex e1c4a3554..5e0ea060f 100644--- a/manim/utils/sounds.py+++ b/manim/utils/sounds.py@@ -1,5 +1,7 @@"""Sound-related utility functions."""+from __future__ import annotations+__all__ = ["get_full_sound_file_path",]diff --git a/manim/utils/space_ops.py b/manim/utils/space_ops.pyindex 7d9c54cfa..3dd93ff9f 100644--- a/manim/utils/space_ops.py+++ b/manim/utils/space_ops.py@@ -1,5 +1,7 @@"""Utility functions for two- and three-dimensional vectors."""+from __future__ import annotations+__all__ = ["quaternion_mult","quaternion_from_angle_axis",@@ -56,7 +58,7 @@ def norm_squared(v: float) -> float:def quaternion_mult(*quats: Sequence[float],-) -> Union[np.ndarray, List[Union[float, np.ndarray]]]:+) -> np.ndarray | list[float | np.ndarray]:"""Gets the Hamilton product of the quaternions provided.For more information, check `this Wikipedia page<https://en.wikipedia.org/wiki/Quaternion>`__.@@ -100,7 +102,7 @@ def quaternion_from_angle_axis(angle: float,axis: np.ndarray,axis_normalized: bool = False,-) -> List[float]:+) -> list[float]:"""Gets a quaternion from an angle and an axis.For more information, check `this Wikipedia page<https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles>`__.@@ -208,7 +210,7 @@ def thick_diagonal(dim: int, thickness=2) -> np.ndarray:return (np.abs(row_indices - col_indices) < thickness).astype("uint8")-def rotation_matrix_transpose_from_quaternion(quat: np.ndarray) -> List[np.ndarray]:+def rotation_matrix_transpose_from_quaternion(quat: np.ndarray) -> list[np.ndarray]:"""Converts the quaternion, quat, to an equivalent rotation matrix representation.For more information, check `this page<https://in.mathworks.com/help/driving/ref/quaternion.rotmat.html>`_.@@ -275,7 +277,7 @@ def rotation_matrix(return rotation_matrix-def rotation_about_z(angle: float) -> List[List[float]]:+def rotation_about_z(angle: float) -> list[list[float]]:"""Returns a rotation matrix for a given angle.Parameters@@ -383,7 +385,7 @@ def project_along_vector(point: float, vector: np.ndarray) -> np.ndarray:return np.dot(point, matrix.T)-def normalize(vect: Union[np.ndarray, Tuple[float]], fall_back=None) -> np.ndarray:+def normalize(vect: np.ndarray | tuple[float], fall_back=None) -> np.ndarray:norm = np.linalg.norm(vect)if norm > 0:return np.array(vect) / norm@@ -473,8 +475,8 @@ def compass_directions(n: int = 4, start_vect: np.ndarray = RIGHT) -> np.ndarraydef regular_vertices(- n: int, *, radius: float = 1, start_angle: Optional[float] = None-) -> Tuple[np.ndarray, float]:+ n: int, *, radius: float = 1, start_angle: float | None = None+) -> tuple[np.ndarray, float]:"""Generates regularly spaced vertices around a circle centered at the origin.Parameters@@ -541,7 +543,7 @@ def center_of_mass(points: Sequence[float]) -> np.ndarray:def midpoint(point1: Sequence[float],point2: Sequence[float],-) -> Union[float, np.ndarray]:+) -> float | np.ndarray:"""Gets the midpoint of two points.Parametersdiff --git a/manim/utils/testing/_frames_testers.py b/manim/utils/testing/_frames_testers.pyindex 5ebd1366a..498403a81 100644--- a/manim/utils/testing/_frames_testers.py+++ b/manim/utils/testing/_frames_testers.py@@ -1,3 +1,5 @@+from __future__ import annotations+import contextlibfrom pathlib import Pathfrom typing import Tuple@@ -53,7 +55,7 @@ class _FramesTester:class _ControlDataWriter(_FramesTester):- def __init__(self, file_path: Path, size_frame: Tuple) -> None:+ def __init__(self, file_path: Path, size_frame: tuple) -> None:self.file_path = file_pathself.frames = np.empty((0, *size_frame, 4))self._number_frames_written: int = 0diff --git a/manim/utils/testing/_show_diff.py b/manim/utils/testing/_show_diff.pyindex 5a03ecc45..0e80295ef 100644--- a/manim/utils/testing/_show_diff.py+++ b/manim/utils/testing/_show_diff.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npdiff --git a/manim/utils/testing/_test_class_makers.py b/manim/utils/testing/_test_class_makers.pyindex 771cb84c7..f44c0ddcc 100644--- a/manim/utils/testing/_test_class_makers.py+++ b/manim/utils/testing/_test_class_makers.py@@ -1,3 +1,5 @@+from __future__ import annotations+from typing import Callable, Typefrom manim.scene.scene import Scene@@ -7,10 +9,10 @@ from ._frames_testers import _FramesTesterdef _make_test_scene_class(- base_scene: Type[Scene],+ base_scene: type[Scene],construct_test: Callable[[Scene], None],test_renderer,-) -> Type[Scene]:+) -> type[Scene]:class _TestedScene(base_scene):def __init__(self, *args, **kwargs):super().__init__(renderer=test_renderer, *args, **kwargs)@@ -66,7 +68,7 @@ class DummySceneFileWriter(SceneFileWriter):self.i += 1-def _make_scene_file_writer_class(tester: _FramesTester) -> Type[SceneFileWriter]:+def _make_scene_file_writer_class(tester: _FramesTester) -> type[SceneFileWriter]:class TestSceneFileWriter(DummySceneFileWriter):def write_frame(self, frame_or_renderer):tester.check_frame(self.i, frame_or_renderer)diff --git a/manim/utils/testing/frames_comparison.py b/manim/utils/testing/frames_comparison.pyindex 322e686a9..55baf6f67 100644--- a/manim/utils/testing/frames_comparison.py+++ b/manim/utils/testing/frames_comparison.py@@ -1,3 +1,5 @@+from __future__ import annotations+import functoolsimport inspectfrom pathlib import Path@@ -155,13 +157,13 @@ def frames_comparison(def _make_test_comparing_frames(file_path: Path,- base_scene: Type[Scene],+ base_scene: type[Scene],construct: Callable[[Scene], None],renderer_class, # Renderer type, there is no superclass renderer yet .....is_set_test_data_test: bool,last_frame: bool,show_diff: bool,- size_frame: Tuple,+ size_frame: tuple,) -> Callable[[], None]:"""Create the real pytest test that will fail if the frames mismatch.@@ -221,7 +223,7 @@ def _make_test_comparing_frames(def _control_data_path(- test_file_path: Optional[str], module_name: str, test_name: str, setting_test: bool+ test_file_path: str | None, module_name: str, test_name: str, setting_test: bool) -> Path:if test_file_path is None:# For some reason, path to test file containing @frames_comparison could notdiff --git a/manim/utils/tex.py b/manim/utils/tex.pyindex 6a916a3bb..2ace7f230 100644--- a/manim/utils/tex.py+++ b/manim/utils/tex.py@@ -1,5 +1,7 @@"""Utilities for processing LaTeX templates."""+from __future__ import annotations+__all__ = ["TexTemplate","TexTemplateFromFile",@@ -210,7 +212,7 @@ class TexTemplate:begin, end = self._texcode_for_environment(environment)return self.body.replace(self.placeholder_text, f"{begin}\n{expression}\n{end}")- def copy(self) -> "TexTemplate":+ def copy(self) -> TexTemplate:return copy.deepcopy(self)diff --git a/manim/utils/tex_file_writing.py b/manim/utils/tex_file_writing.pyindex 39c6c0e45..6987996c8 100644--- a/manim/utils/tex_file_writing.py+++ b/manim/utils/tex_file_writing.py@@ -6,6 +6,8 @@"""+from __future__ import annotations+import hashlibimport osimport rediff --git a/manim/utils/tex_templates.py b/manim/utils/tex_templates.pyindex 0142b8142..43153f933 100644--- a/manim/utils/tex_templates.py+++ b/manim/utils/tex_templates.py@@ -1,4 +1,6 @@"""A library of LaTeX templates."""+from __future__ import annotations+__all__ = ["TexTemplateLibrary","TexFontTemplates",diff --git a/manim/utils/unit.py b/manim/utils/unit.pyindex f620b1433..f629e070d 100644--- a/manim/utils/unit.py+++ b/manim/utils/unit.py@@ -1,5 +1,7 @@"""Implement the Unit class."""+from __future__ import annotations+import numpy as npfrom .. import config, constantsdiff --git a/scripts/dev_changelog.py b/scripts/dev_changelog.pyindex 921dd309e..da492bbae 100755--- a/scripts/dev_changelog.py+++ b/scripts/dev_changelog.py@@ -43,6 +43,8 @@ NoteThis script was taken from Numpy under the terms of BSD-3-Clause license."""+from __future__ import annotations+import datetimeimport osimport rediff --git a/scripts/make_and_open_docs.py b/scripts/make_and_open_docs.pyindex c24b73d9d..11b9360ed 100644--- a/scripts/make_and_open_docs.py+++ b/scripts/make_and_open_docs.py@@ -1,3 +1,5 @@+from __future__ import annotations+import osimport sysimport webbrowserdiff --git a/scripts/simple_cors_http_server.py b/scripts/simple_cors_http_server.pyindex e4fcbf517..8ade778c5 100755--- a/scripts/simple_cors_http_server.py+++ b/scripts/simple_cors_http_server.py@@ -1,4 +1,6 @@#!/usr/bin/env python3+from __future__ import annotations+import sysfrom http.server import HTTPServer, SimpleHTTPRequestHandler, test # type: ignorediff --git a/scripts/template_docsting_with_example.py b/scripts/template_docsting_with_example.pyindex 77ed8445b..4a8621b5e 100644--- a/scripts/template_docsting_with_example.py+++ b/scripts/template_docsting_with_example.py@@ -1,6 +1,9 @@# see more documentation guidelines online here: https://github.com/ManimCommunity/manim/wiki/Documentation-guidelines-(WIP)+from __future__ import annotations++class SomeClass:"""A one line description of the Class.diff --git a/scripts/update_protos.py b/scripts/update_protos.pyindex e0b52d984..aed4b0055 100755--- a/scripts/update_protos.py+++ b/scripts/update_protos.py@@ -3,6 +3,8 @@This is intended to be run from manim/grpc"""+from __future__ import annotations+import osCMD_STRING = """diff --git a/tests/assert_utils.py b/tests/assert_utils.pyindex a71d439f3..1c9a3acba 100644--- a/tests/assert_utils.py+++ b/tests/assert_utils.py@@ -1,10 +1,12 @@+from __future__ import annotations+import osfrom pathlib import Pathfrom pprint import pformatfrom typing import Dict, List, Union-def assert_file_exists(filepath: Union[str, os.PathLike]) -> None:+def assert_file_exists(filepath: str | os.PathLike) -> None:"""Assert that filepath points to an existing file. Print all the elements (files and dir) of the parent dir of the given filepath.This is mostly to have better assert message than using a raw assert os.path.isfile(filepath).@@ -26,7 +28,7 @@ def assert_file_exists(filepath: Union[str, os.PathLike]) -> None:raise AssertionError(message)-def assert_dir_exists(dirpath: Union[str, os.PathLike]) -> None:+def assert_dir_exists(dirpath: str | os.PathLike) -> None:"""Assert that directory exists.Parameters@@ -46,7 +48,7 @@ def assert_dir_exists(dirpath: Union[str, os.PathLike]) -> None:raise AssertionError(message)-def assert_dir_filled(dirpath: Union[str, os.PathLike]) -> None:+def assert_dir_filled(dirpath: str | os.PathLike) -> None:"""Assert that directory exists and contains at least one file or directory (or file like objects like symlinks on Linux).Parameters@@ -63,7 +65,7 @@ def assert_dir_filled(dirpath: Union[str, os.PathLike]) -> None:raise AssertionError(f"{dirpath} is an empty directory.")-def assert_file_not_exists(filepath: Union[str, os.PathLike]) -> None:+def assert_file_not_exists(filepath: str | os.PathLike) -> None:"""Assert that filepath does not point to an existing file. Print all the elements (files and dir) of the parent dir of the given filepath.This is mostly to have better assert message than using a raw assert os.path.isfile(filepath).@@ -85,7 +87,7 @@ def assert_file_not_exists(filepath: Union[str, os.PathLike]) -> None:raise AssertionError(message)-def assert_dir_not_exists(dirpath: Union[str, os.PathLike]) -> None:+def assert_dir_not_exists(dirpath: str | os.PathLike) -> None:"""Assert that directory does not exist.Parameters@@ -105,13 +107,13 @@ def assert_dir_not_exists(dirpath: Union[str, os.PathLike]) -> None:raise AssertionError(message)-def assert_shallow_dict_compare(a: Dict, b: Dict, message_start: str) -> None:+def assert_shallow_dict_compare(a: dict, b: dict, message_start: str) -> None:"""Assert that Directories ``a`` and ``b`` are the same.``b`` is treated as the expected values that ``a`` shall abide by.Print helpful error with custom message start."""- mismatch: List[str] = []+ mismatch: list[str] = []for b_key, b_value in b.items():if b_key not in a:diff --git a/tests/conftest.py b/tests/conftest.pyindex 09b5d2c97..c70dae4f1 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -1,3 +1,5 @@+from __future__ import annotations+import osimport sysfrom pathlib import Pathdiff --git a/tests/helpers/graphical_units.py b/tests/helpers/graphical_units.pyindex 848f890ad..46b230319 100644--- a/tests/helpers/graphical_units.py+++ b/tests/helpers/graphical_units.py@@ -1,6 +1,8 @@"""Helpers functions for devs to set up new graphical-units data."""+from __future__ import annotations+import osimport tempfilediff --git a/tests/helpers/path_utils.py b/tests/helpers/path_utils.pyindex 6c438e065..f1aa5f5d8 100644--- a/tests/helpers/path_utils.py+++ b/tests/helpers/path_utils.py@@ -1,3 +1,5 @@+from __future__ import annotations+from pathlib import Pathdiff --git a/tests/helpers/video_utils.py b/tests/helpers/video_utils.pyindex 03380fa19..1cc499603 100644--- a/tests/helpers/video_utils.py+++ b/tests/helpers/video_utils.py@@ -1,5 +1,7 @@"""Helpers for dev to set up new tests that use videos."""+from __future__ import annotations+import jsonimport osimport pathlib@@ -8,7 +10,7 @@ from typing import Any, Dict, Listfrom manim import get_dir_layout, get_video_metadata, logger-def get_section_dir_layout(dirpath: str) -> List[str]:+def get_section_dir_layout(dirpath: str) -> list[str]:"""Return a list of all files in the sections directory."""# test if sections have been created in the first place, doesn't work with multiple scene but this isn't an issue with testsif not os.path.isdir(dirpath):@@ -19,7 +21,7 @@ def get_section_dir_layout(dirpath: str) -> List[str]:return files-def get_section_index(metapath: str) -> List[Dict[str, Any]]:+def get_section_index(metapath: str) -> list[dict[str, Any]]:"""Return content of sections index file."""parent_folder = pathlib.Path(metapath).parent.absolute()# test if sections have been created in the first placediff --git a/tests/opengl/test_animate_opengl.py b/tests/opengl/test_animate_opengl.pyindex b30f727ab..2312f41fc 100644--- a/tests/opengl/test_animate_opengl.py+++ b/tests/opengl/test_animate_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport pytestdiff --git a/tests/opengl/test_axes_shift_opengl.py b/tests/opengl/test_axes_shift_opengl.pyindex ec3fe90b5..4b320b1fb 100644--- a/tests/opengl/test_axes_shift_opengl.py+++ b/tests/opengl/test_axes_shift_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom manim.mobject.coordinate_systems import Axesdiff --git a/tests/opengl/test_color_opengl.py b/tests/opengl/test_color_opengl.pyindex fe70d6e67..61d927307 100644--- a/tests/opengl/test_color_opengl.py+++ b/tests/opengl/test_color_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom colour import Colordiff --git a/tests/opengl/test_composition_opengl.py b/tests/opengl/test_composition_opengl.pyindex aa6fcb607..8f4580580 100644--- a/tests/opengl/test_composition_opengl.py+++ b/tests/opengl/test_composition_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim.animation.animation import Animation, Waitfrom manim.animation.composition import AnimationGroup, Successionfrom manim.animation.fading import FadeIn, FadeOutdiff --git a/tests/opengl/test_config_opengl.py b/tests/opengl/test_config_opengl.pyindex 764240824..f3013800d 100644--- a/tests/opengl/test_config_opengl.py+++ b/tests/opengl/test_config_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import tempfilefrom pathlib import Pathdiff --git a/tests/opengl/test_coordinate_system_opengl.py b/tests/opengl/test_coordinate_system_opengl.pyindex 28d99a3f9..8e1d778e5 100644--- a/tests/opengl/test_coordinate_system_opengl.py+++ b/tests/opengl/test_coordinate_system_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import mathimport numpy as npdiff --git a/tests/opengl/test_copy_opengl.py b/tests/opengl/test_copy_opengl.pyindex ebef68897..31c49011d 100644--- a/tests/opengl/test_copy_opengl.py+++ b/tests/opengl/test_copy_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from pathlib import Pathfrom manim import BraceLabel, configdiff --git a/tests/opengl/test_family_opengl.py b/tests/opengl/test_family_opengl.pyindex 3d1fea33b..f1939c158 100644--- a/tests/opengl/test_family_opengl.py+++ b/tests/opengl/test_family_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom manim import RIGHT, Circlediff --git a/tests/opengl/test_graph_opengl.py b/tests/opengl/test_graph_opengl.pyindex f360bd73e..4c246eaca 100644--- a/tests/opengl/test_graph_opengl.py+++ b/tests/opengl/test_graph_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import Dot, Graph, Line, Textdiff --git a/tests/opengl/test_ipython_magic_opengl.py b/tests/opengl/test_ipython_magic_opengl.pyindex 81e63f0f9..ade725cbe 100644--- a/tests/opengl/test_ipython_magic_opengl.py+++ b/tests/opengl/test_ipython_magic_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import refrom manim import config, tempconfigdiff --git a/tests/opengl/test_markup_opengl.py b/tests/opengl/test_markup_opengl.pyindex 7f9e86684..b8a0e1c9f 100644--- a/tests/opengl/test_markup_opengl.py+++ b/tests/opengl/test_markup_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import MarkupTextdiff --git a/tests/opengl/test_number_line_opengl.py b/tests/opengl/test_number_line_opengl.pyindex 16cff0caf..acebdda42 100644--- a/tests/opengl/test_number_line_opengl.py+++ b/tests/opengl/test_number_line_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom manim import NumberLinediff --git a/tests/opengl/test_numbers_opengl.py b/tests/opengl/test_numbers_opengl.pyindex 01b9e76c5..2651b0e08 100644--- a/tests/opengl/test_numbers_opengl.py+++ b/tests/opengl/test_numbers_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom manim.mobject.numbers import DecimalNumberdiff --git a/tests/opengl/test_opengl_mobject.py b/tests/opengl/test_opengl_mobject.pyindex 70471750a..c7a816bda 100644--- a/tests/opengl/test_opengl_mobject.py+++ b/tests/opengl/test_opengl_mobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom manim import configdiff --git a/tests/opengl/test_opengl_vectorized_mobject.py b/tests/opengl/test_opengl_vectorized_mobject.pyindex 49d8e0e45..196b2fc0e 100644--- a/tests/opengl/test_opengl_vectorized_mobject.py+++ b/tests/opengl/test_opengl_vectorized_mobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport pytestdiff --git a/tests/opengl/test_override_animation_opengl.py b/tests/opengl/test_override_animation_opengl.pyindex f115e9577..38d714d2f 100644--- a/tests/opengl/test_override_animation_opengl.py+++ b/tests/opengl/test_override_animation_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom manim import Animation, override_animationdiff --git a/tests/opengl/test_scene_opengl.py b/tests/opengl/test_scene_opengl.pyindex d69570268..596b097cb 100644--- a/tests/opengl/test_scene_opengl.py+++ b/tests/opengl/test_scene_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import Scene, tempconfigfrom manim.mobject.opengl_mobject import OpenGLMobjectdiff --git a/tests/opengl/test_sound_opengl.py b/tests/opengl/test_sound_opengl.pyindex 990f7fe1f..40ec914de 100644--- a/tests/opengl/test_sound_opengl.py+++ b/tests/opengl/test_sound_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import structimport wavefrom pathlib import Pathdiff --git a/tests/opengl/test_stroke_opengl.py b/tests/opengl/test_stroke_opengl.pyindex bebd24d44..74e373eea 100644--- a/tests/opengl/test_stroke_opengl.py+++ b/tests/opengl/test_stroke_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from colour import Colorimport manim.utils.color as Cdiff --git a/tests/opengl/test_svg_mobject_opengl.py b/tests/opengl/test_svg_mobject_opengl.pyindex a1afabf5a..c67205577 100644--- a/tests/opengl/test_svg_mobject_opengl.py+++ b/tests/opengl/test_svg_mobject_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from colour import Colorfrom manim import *diff --git a/tests/opengl/test_texmobject_opengl.py b/tests/opengl/test_texmobject_opengl.pyindex 118277db0..7c2b0c5f2 100644--- a/tests/opengl/test_texmobject_opengl.py+++ b/tests/opengl/test_texmobject_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from pathlib import Pathimport pytestdiff --git a/tests/opengl/test_text_mobject_opengl.py b/tests/opengl/test_text_mobject_opengl.pyindex 40799acf6..29984399a 100644--- a/tests/opengl/test_text_mobject_opengl.py+++ b/tests/opengl/test_text_mobject_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim.mobject.svg.text_mobject import MarkupText, Textdiff --git a/tests/opengl/test_ticks_opengl.py b/tests/opengl/test_ticks_opengl.pyindex 714adc543..3fe4a4f3a 100644--- a/tests/opengl/test_ticks_opengl.py+++ b/tests/opengl/test_ticks_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom manim import PI, Axes, NumberLinediff --git a/tests/opengl/test_unit_geometry_opengl.py b/tests/opengl/test_unit_geometry_opengl.pyindex bfb49c1e2..c92b5978c 100644--- a/tests/opengl/test_unit_geometry_opengl.py+++ b/tests/opengl/test_unit_geometry_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom manim import Sectordiff --git a/tests/opengl/test_value_tracker_opengl.py b/tests/opengl/test_value_tracker_opengl.pyindex e487acfe5..ad8ac3acf 100644--- a/tests/opengl/test_value_tracker_opengl.py+++ b/tests/opengl/test_value_tracker_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim.mobject.value_tracker import ComplexValueTracker, ValueTrackerdiff --git a/tests/template_generate_graphical_units_data.py b/tests/template_generate_graphical_units_data.pyindex 4b0960e18..1e8565985 100644--- a/tests/template_generate_graphical_units_data.py+++ b/tests/template_generate_graphical_units_data.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from tests.helpers.graphical_units import set_test_scenediff --git a/tests/test_animate.py b/tests/test_animate.pyindex 7739e2148..3163796a7 100644--- a/tests/test_animate.py+++ b/tests/test_animate.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport pytestdiff --git a/tests/test_auto_zoom.py b/tests/test_auto_zoom.pyindex a8555ff09..115e46a51 100644--- a/tests/test_auto_zoom.py+++ b/tests/test_auto_zoom.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *diff --git a/tests/test_axes_shift.py b/tests/test_axes_shift.pyindex d3735492b..e6b0f1d85 100644--- a/tests/test_axes_shift.py+++ b/tests/test_axes_shift.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport pytestdiff --git a/tests/test_boolean_ops.py b/tests/test_boolean_ops.pyindex 29b76b577..8ff5f78ef 100644--- a/tests/test_boolean_ops.py+++ b/tests/test_boolean_ops.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport pytestdiff --git a/tests/test_color.py b/tests/test_color.pyindex dec03bf2a..86b2dc133 100644--- a/tests/test_color.py+++ b/tests/test_color.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport pytestdiff --git a/tests/test_commands.py b/tests/test_commands.pyindex e9f537840..ca284aa52 100644--- a/tests/test_commands.py+++ b/tests/test_commands.py@@ -1,3 +1,5 @@+from __future__ import annotations+import sysfrom pathlib import Pathfrom textwrap import dedentdiff --git a/tests/test_composition.py b/tests/test_composition.pyindex d73aa432f..844e683a8 100644--- a/tests/test_composition.py+++ b/tests/test_composition.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom manim.animation.animation import Animation, Waitdiff --git a/tests/test_config.py b/tests/test_config.pyindex 5e7698aae..9a3c15de0 100644--- a/tests/test_config.py+++ b/tests/test_config.py@@ -1,3 +1,5 @@+from __future__ import annotations+import osimport tempfilefrom pathlib import Pathdiff --git a/tests/test_coordinate_system.py b/tests/test_coordinate_system.pyindex 87c2f0395..1695f5c54 100644--- a/tests/test_coordinate_system.py+++ b/tests/test_coordinate_system.py@@ -1,3 +1,5 @@+from __future__ import annotations+import mathimport numpy as npdiff --git a/tests/test_copy.py b/tests/test_copy.pyindex 7875be7e1..ce9f472f7 100644--- a/tests/test_copy.py+++ b/tests/test_copy.py@@ -1,3 +1,5 @@+from __future__ import annotations+from pathlib import Pathfrom manim import BraceLabel, Mobject, configdiff --git a/tests/test_deprecation.py b/tests/test_deprecation.pyindex a5601b534..9e587c1fd 100644--- a/tests/test_deprecation.py+++ b/tests/test_deprecation.py@@ -1,3 +1,5 @@+from __future__ import annotations+import loggingimport pytestdiff --git a/tests/test_family.py b/tests/test_family.pyindex c528fdf4d..0e0c1e518 100644--- a/tests/test_family.py+++ b/tests/test_family.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom manim import RIGHT, Circle, Mobjectdiff --git a/tests/test_file_ops.py b/tests/test_file_ops.pyindex 60fdc75a0..30c0f00f9 100644--- a/tests/test_file_ops.py+++ b/tests/test_file_ops.py@@ -1,3 +1,5 @@+from __future__ import annotations+import osfrom manim import *diff --git a/tests/test_get_set.py b/tests/test_get_set.pyindex 202efa3ca..ec0614ceb 100644--- a/tests/test_get_set.py+++ b/tests/test_get_set.py@@ -1,3 +1,5 @@+from __future__ import annotations+import typesimport pytestdiff --git a/tests/test_graph.py b/tests/test_graph.pyindex d9bf2a9ee..91b291b01 100644--- a/tests/test_graph.py+++ b/tests/test_graph.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import Graph, Scene, Text, tempconfigdiff --git a/tests/test_graphical_units/conftest.py b/tests/test_graphical_units/conftest.pyindex 5d8200504..01bec579d 100644--- a/tests/test_graphical_units/conftest.py+++ b/tests/test_graphical_units/conftest.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestdiff --git a/tests/test_graphical_units/test_axes.py b/tests/test_graphical_units/test_axes.pyindex 6c1915e66..8c6442620 100644--- a/tests/test_graphical_units/test_axes.py+++ b/tests/test_graphical_units/test_axes.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_boolops.py b/tests/test_graphical_units/test_boolops.pyindex f80ec78b1..3f4e4fe26 100644--- a/tests/test_graphical_units/test_boolops.py+++ b/tests/test_graphical_units/test_boolops.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import (BLUE,Circle,diff --git a/tests/test_graphical_units/test_brace.py b/tests/test_graphical_units/test_brace.pyindex 3ebfbb0a9..7a2e73d56 100644--- a/tests/test_graphical_units/test_brace.py+++ b/tests/test_graphical_units/test_brace.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_composition.py b/tests/test_graphical_units/test_composition.pyindex 3992225cc..1bcfb5bb5 100644--- a/tests/test_graphical_units/test_composition.py+++ b/tests/test_graphical_units/test_composition.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_coordinate_systems.py b/tests/test_graphical_units/test_coordinate_systems.pyindex a18c96db8..1e619386c 100644--- a/tests/test_graphical_units/test_coordinate_systems.py+++ b/tests/test_graphical_units/test_coordinate_systems.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_creation.py b/tests/test_graphical_units/test_creation.pyindex a32158782..87bc6e212 100644--- a/tests/test_graphical_units/test_creation.py+++ b/tests/test_graphical_units/test_creation.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_functions.py b/tests/test_graphical_units/test_functions.pyindex c65da5ada..7a7b39bea 100644--- a/tests/test_graphical_units/test_functions.py+++ b/tests/test_graphical_units/test_functions.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_geometry.py b/tests/test_graphical_units/test_geometry.pyindex 48e37147b..51e6817d7 100644--- a/tests/test_graphical_units/test_geometry.py+++ b/tests/test_graphical_units/test_geometry.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_img_and_svg.py b/tests/test_graphical_units/test_img_and_svg.pyindex 416600e54..1a94ddcf2 100644--- a/tests/test_graphical_units/test_img_and_svg.py+++ b/tests/test_graphical_units/test_img_and_svg.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_indication.py b/tests/test_graphical_units/test_indication.pyindex ef56dcdde..f134f4e9c 100644--- a/tests/test_graphical_units/test_indication.py+++ b/tests/test_graphical_units/test_indication.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_mobjects.py b/tests/test_graphical_units/test_mobjects.pyindex 5bb6aedd3..0ec5879b1 100644--- a/tests/test_graphical_units/test_mobjects.py+++ b/tests/test_graphical_units/test_mobjects.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_modifier_methods.py b/tests/test_graphical_units/test_modifier_methods.pyindex 80346874c..7d123cc79 100644--- a/tests/test_graphical_units/test_modifier_methods.py+++ b/tests/test_graphical_units/test_modifier_methods.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_movements.py b/tests/test_graphical_units/test_movements.pyindex 0753a25fd..09e7784b1 100644--- a/tests/test_graphical_units/test_movements.py+++ b/tests/test_graphical_units/test_movements.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_numbers.py b/tests/test_graphical_units/test_numbers.pyindex f5069a777..5f294bdb7 100644--- a/tests/test_graphical_units/test_numbers.py+++ b/tests/test_graphical_units/test_numbers.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_opengl.py b/tests/test_graphical_units/test_opengl.pyindex da93058e9..5111b7f27 100644--- a/tests/test_graphical_units/test_opengl.py+++ b/tests/test_graphical_units/test_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom manim import *diff --git a/tests/test_graphical_units/test_polyhedra.py b/tests/test_graphical_units/test_polyhedra.pyindex e9ba62431..bc13676fd 100644--- a/tests/test_graphical_units/test_polyhedra.py+++ b/tests/test_graphical_units/test_polyhedra.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_specialized.py b/tests/test_graphical_units/test_specialized.pyindex 534b7a4a2..f11023513 100644--- a/tests/test_graphical_units/test_specialized.py+++ b/tests/test_graphical_units/test_specialized.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_tables.py b/tests/test_graphical_units/test_tables.pyindex 79dbf882a..37a204201 100644--- a/tests/test_graphical_units/test_tables.py+++ b/tests/test_graphical_units/test_tables.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_threed.py b/tests/test_graphical_units/test_threed.pyindex c730a0364..650ee13bf 100644--- a/tests/test_graphical_units/test_threed.py+++ b/tests/test_graphical_units/test_threed.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_transform.py b/tests/test_graphical_units/test_transform.pyindex 667139e98..cfad32c36 100644--- a/tests/test_graphical_units/test_transform.py+++ b/tests/test_graphical_units/test_transform.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_updaters.py b/tests/test_graphical_units/test_updaters.pyindex 623e9f709..c05024687 100644--- a/tests/test_graphical_units/test_updaters.py+++ b/tests/test_graphical_units/test_updaters.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *from manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_graphical_units/test_vector_scene.py b/tests/test_graphical_units/test_vector_scene.pyindex e0333f9f2..52d1b473b 100644--- a/tests/test_graphical_units/test_vector_scene.py+++ b/tests/test_graphical_units/test_vector_scene.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim.scene.vector_space_scene import VectorScenefrom manim.utils.testing.frames_comparison import frames_comparisondiff --git a/tests/test_hashing.py b/tests/test_hashing.pyindex 990a11451..9e56e2d6a 100644--- a/tests/test_hashing.py+++ b/tests/test_hashing.py@@ -1,3 +1,5 @@+from __future__ import annotations+import jsonfrom zlib import crc32diff --git a/tests/test_ipython_magic.py b/tests/test_ipython_magic.pyindex 6b483533e..b3bff2450 100644--- a/tests/test_ipython_magic.py+++ b/tests/test_ipython_magic.py@@ -1,3 +1,5 @@+from __future__ import annotations+import refrom manim import tempconfigdiff --git a/tests/test_logging/basic_scenes_error.py b/tests/test_logging/basic_scenes_error.pyindex 5a4bda080..dc7a33c8f 100644--- a/tests/test_logging/basic_scenes_error.py+++ b/tests/test_logging/basic_scenes_error.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *# This module is intended to raise an error.diff --git a/tests/test_logging/basic_scenes_square_to_circle.py b/tests/test_logging/basic_scenes_square_to_circle.pyindex c1b835cbc..a42ec4d98 100644--- a/tests/test_logging/basic_scenes_square_to_circle.py+++ b/tests/test_logging/basic_scenes_square_to_circle.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *# This module is used in the CLI tests in tests_CLi.py.diff --git a/tests/test_logging/basic_scenes_write_stuff.py b/tests/test_logging/basic_scenes_write_stuff.pyindex 149e15139..34ce16c72 100644--- a/tests/test_logging/basic_scenes_write_stuff.py+++ b/tests/test_logging/basic_scenes_write_stuff.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *# This module is used in the CLI tests in tests_CLi.py.diff --git a/tests/test_logging/test_logging.py b/tests/test_logging/test_logging.pyindex 78c3849d9..a3bdabb12 100644--- a/tests/test_logging/test_logging.py+++ b/tests/test_logging/test_logging.py@@ -1,3 +1,5 @@+from __future__ import annotations+import osimport refrom pathlib import Pathdiff --git a/tests/test_markup.py b/tests/test_markup.pyindex 779966675..5e0826740 100644--- a/tests/test_markup.py+++ b/tests/test_markup.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom manim import MarkupTextdiff --git a/tests/test_mobject.py b/tests/test_mobject.pyindex 5a1bdf7e6..7ce936c02 100644--- a/tests/test_mobject.py+++ b/tests/test_mobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom manim import Mobjectdiff --git a/tests/test_number_line.py b/tests/test_number_line.pyindex 16cff0caf..acebdda42 100644--- a/tests/test_number_line.py+++ b/tests/test_number_line.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom manim import NumberLinediff --git a/tests/test_numbers.py b/tests/test_numbers.pyindex dda101638..96a0ef8a7 100644--- a/tests/test_numbers.py+++ b/tests/test_numbers.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom colour import Colordiff --git a/tests/test_opengl_metaclass.py b/tests/test_opengl_metaclass.pyindex ba30338fd..bfc40a68d 100644--- a/tests/test_opengl_metaclass.py+++ b/tests/test_opengl_metaclass.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import Mobject, config, tempconfigfrom manim.mobject.opengl_compatibility import ConvertToOpenGLfrom manim.mobject.opengl_mobject import OpenGLMobjectdiff --git a/tests/test_override_animation.py b/tests/test_override_animation.pyindex 92d3c3bc3..2b7fea495 100644--- a/tests/test_override_animation.py+++ b/tests/test_override_animation.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom manim import Animation, Mobject, override_animationdiff --git a/tests/test_plugins/simple_scenes.py b/tests/test_plugins/simple_scenes.pyindex 187c62de9..156219611 100644--- a/tests/test_plugins/simple_scenes.py+++ b/tests/test_plugins/simple_scenes.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *diff --git a/tests/test_plugins/test_plugins.py b/tests/test_plugins/test_plugins.pyindex 42bdfefe1..149d70541 100644--- a/tests/test_plugins/test_plugins.py+++ b/tests/test_plugins/test_plugins.py@@ -1,3 +1,5 @@+from __future__ import annotations+import randomimport stringimport tempfilediff --git a/tests/test_scene.py b/tests/test_scene.pyindex be9f3223c..cb7d37a8d 100644--- a/tests/test_scene.py+++ b/tests/test_scene.py@@ -1,3 +1,5 @@+from __future__ import annotations+import datetimeimport pytestdiff --git a/tests/test_scene_rendering/conftest.py b/tests/test_scene_rendering/conftest.pyindex 331fd57e0..9748edab0 100644--- a/tests/test_scene_rendering/conftest.py+++ b/tests/test_scene_rendering/conftest.py@@ -1,3 +1,5 @@+from __future__ import annotations+from pathlib import Pathimport pytestdiff --git a/tests/test_scene_rendering/infallible_scenes.py b/tests/test_scene_rendering/infallible_scenes.pyindex 2a270a4cd..b9f1e1ca0 100644--- a/tests/test_scene_rendering/infallible_scenes.py+++ b/tests/test_scene_rendering/infallible_scenes.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *diff --git a/tests/test_scene_rendering/opengl/test_caching_related_opengl.py b/tests/test_scene_rendering/opengl/test_caching_related_opengl.pyindex 0e1dc163c..3bc517957 100644--- a/tests/test_scene_rendering/opengl/test_caching_related_opengl.py+++ b/tests/test_scene_rendering/opengl/test_caching_related_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import sysimport pytestdiff --git a/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py b/tests/test_scene_rendering/opengl/test_cli_flags_opengl.pyindex 70521f8ce..ad49bccd3 100644--- a/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py+++ b/tests/test_scene_rendering/opengl/test_cli_flags_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+import itertoolsimport osimport sysdiff --git a/tests/test_scene_rendering/opengl/test_opengl_renderer.py b/tests/test_scene_rendering/opengl/test_opengl_renderer.pyindex 292099ab9..e3d69c053 100644--- a/tests/test_scene_rendering/opengl/test_opengl_renderer.py+++ b/tests/test_scene_rendering/opengl/test_opengl_renderer.py@@ -1,3 +1,5 @@+from __future__ import annotations+from unittest.mock import Mockimport pytestdiff --git a/tests/test_scene_rendering/opengl/test_play_logic_opengl.py b/tests/test_scene_rendering/opengl/test_play_logic_opengl.pyindex 73e637481..4f987c598 100644--- a/tests/test_scene_rendering/opengl/test_play_logic_opengl.py+++ b/tests/test_scene_rendering/opengl/test_play_logic_opengl.py@@ -1,3 +1,5 @@+from __future__ import annotations+from unittest.mock import Mockimport pytestdiff --git a/tests/test_scene_rendering/simple_scenes.py b/tests/test_scene_rendering/simple_scenes.pyindex 1b84e6f24..d8eb61976 100644--- a/tests/test_scene_rendering/simple_scenes.py+++ b/tests/test_scene_rendering/simple_scenes.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim import *diff --git a/tests/test_scene_rendering/test_caching_related.py b/tests/test_scene_rendering/test_caching_related.pyindex f9ad587af..3142c06ea 100644--- a/tests/test_scene_rendering/test_caching_related.py+++ b/tests/test_scene_rendering/test_caching_related.py@@ -1,3 +1,5 @@+from __future__ import annotations+import osimport subprocessimport sysdiff --git a/tests/test_scene_rendering/test_cairo_renderer.py b/tests/test_scene_rendering/test_cairo_renderer.pyindex 56dea35bb..8e9ebe71f 100644--- a/tests/test_scene_rendering/test_cairo_renderer.py+++ b/tests/test_scene_rendering/test_cairo_renderer.py@@ -1,3 +1,5 @@+from __future__ import annotations+import osfrom unittest.mock import Mock, patchdiff --git a/tests/test_scene_rendering/test_cli_flags.py b/tests/test_scene_rendering/test_cli_flags.pyindex a5dba3cca..2cb924b4c 100644--- a/tests/test_scene_rendering/test_cli_flags.py+++ b/tests/test_scene_rendering/test_cli_flags.py@@ -1,3 +1,5 @@+from __future__ import annotations+import itertoolsimport osimport sysdiff --git a/tests/test_scene_rendering/test_play_logic.py b/tests/test_scene_rendering/test_play_logic.pyindex 66572d39b..df447a34f 100644--- a/tests/test_scene_rendering/test_play_logic.py+++ b/tests/test_scene_rendering/test_play_logic.py@@ -1,3 +1,5 @@+from __future__ import annotations+import sysfrom functools import wrapsfrom pathlib import Pathdiff --git a/tests/test_scene_rendering/test_sections.py b/tests/test_scene_rendering/test_sections.pyindex fb0044e9d..4291154df 100644--- a/tests/test_scene_rendering/test_sections.py+++ b/tests/test_scene_rendering/test_sections.py@@ -1,3 +1,5 @@+from __future__ import annotations+import osimport sysdiff --git a/tests/test_set_attr.py b/tests/test_set_attr.pyindex d6f9aa9e5..edac7b3fb 100644--- a/tests/test_set_attr.py+++ b/tests/test_set_attr.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport pytestdiff --git a/tests/test_sound.py b/tests/test_sound.pyindex 958f6b99e..cfd67ed2d 100644--- a/tests/test_sound.py+++ b/tests/test_sound.py@@ -1,3 +1,5 @@+from __future__ import annotations+import structimport wavefrom pathlib import Pathdiff --git a/tests/test_space_ops.py b/tests/test_space_ops.pyindex f6ceeef41..fef1862d5 100644--- a/tests/test_space_ops.py+++ b/tests/test_space_ops.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom manim import cartesian_to_spherical, spherical_to_cartesiandiff --git a/tests/test_stroke.py b/tests/test_stroke.pyindex 678dd707c..ad6b0edac 100644--- a/tests/test_stroke.py+++ b/tests/test_stroke.py@@ -1,3 +1,5 @@+from __future__ import annotations+import manim.utils.color as Cfrom manim import VMobjectdiff --git a/tests/test_svg_mobject.py b/tests/test_svg_mobject.pyindex c1dd01564..d6fb81adb 100644--- a/tests/test_svg_mobject.py+++ b/tests/test_svg_mobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+from colour import Colorfrom manim import *diff --git a/tests/test_texmobject.py b/tests/test_texmobject.pyindex fddb0ab6a..527d12e42 100644--- a/tests/test_texmobject.py+++ b/tests/test_texmobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+from pathlib import Pathimport pytestdiff --git a/tests/test_text_mobject.py b/tests/test_text_mobject.pyindex 72c245bdc..d3e62bf50 100644--- a/tests/test_text_mobject.py+++ b/tests/test_text_mobject.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pytestfrom manim.mobject.svg.text_mobject import MarkupText, Textdiff --git a/tests/test_ticks.py b/tests/test_ticks.pyindex 8beeb5aeb..eeac2ac0a 100644--- a/tests/test_ticks.py+++ b/tests/test_ticks.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npfrom manim import PI, Axes, NumberLinediff --git a/tests/test_unit_geometry.py b/tests/test_unit_geometry.pyindex b15ff2e88..fe16b23f9 100644--- a/tests/test_unit_geometry.py+++ b/tests/test_unit_geometry.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport pytestdiff --git a/tests/test_units.py b/tests/test_units.pyindex 9c1222bcb..ff1ad7886 100644--- a/tests/test_units.py+++ b/tests/test_units.py@@ -1,3 +1,5 @@+from __future__ import annotations+import numpy as npimport pytestdiff --git a/tests/test_value_tracker.py b/tests/test_value_tracker.pyindex 0c0f5d656..c7dc034dc 100644--- a/tests/test_value_tracker.py+++ b/tests/test_value_tracker.py@@ -1,3 +1,5 @@+from __future__ import annotations+from manim.mobject.geometry import Dotfrom manim.mobject.value_tracker import ComplexValueTracker, ValueTrackerdiff --git a/tests/test_version.py b/tests/test_version.pyindex 476c08659..0ad87cd2d 100644--- a/tests/test_version.py+++ b/tests/test_version.py@@ -1,3 +1,5 @@+from __future__ import annotations+import pkg_resourcesfrom manim import __name__, __version__diff --git a/tests/utils/GraphicalUnitTester.py b/tests/utils/GraphicalUnitTester.pyindex 85506e35d..1e86c88be 100644--- a/tests/utils/GraphicalUnitTester.py+++ b/tests/utils/GraphicalUnitTester.py@@ -1,3 +1,5 @@+from __future__ import annotations+import loggingimport osdiff --git a/tests/utils/logging_tester.py b/tests/utils/logging_tester.pyindex b33b05655..5e40f4219 100644--- a/tests/utils/logging_tester.py+++ b/tests/utils/logging_tester.py@@ -1,3 +1,5 @@+from __future__ import annotations+import itertoolsimport jsonimport osdiff --git a/tests/utils/testing_utils.py b/tests/utils/testing_utils.pyindex 7bd97609b..8c4729742 100644--- a/tests/utils/testing_utils.py+++ b/tests/utils/testing_utils.py@@ -1,3 +1,5 @@+from __future__ import annotations+import inspectimport sysdiff --git a/tests/utils/video_tester.py b/tests/utils/video_tester.pyindex df7e02395..0c479cb81 100644--- a/tests/utils/video_tester.py+++ b/tests/utils/video_tester.py@@ -1,3 +1,5 @@+from __future__ import annotations+import jsonimport osimport pathlib