Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

run black

Syrus Dark4e7061389503
diff --git a/manim/_config/__init__.py b/manim/_config/__init__.py
index 17a513bba..6806510cc 100644
--- a/manim/_config/__init__.py
+++ b/manim/_config/__init__.py
@@ -31,7 +31,9 @@ frame = ManimFrame(config)
# This has to go here because it needs access to this module's config
@contextmanager
-def tempconfig(temp:Union[ManimConfig,dict]) -> Generator[int, float, None]: #doubtful
+def tempconfig(
+ temp: Union[ManimConfig, dict]
+) -> Generator[int, float, None]: # doubtful
"""Context manager that temporarily modifies the global ``config`` object.
Inside the ``with`` statement, the modified config will be used. After
diff --git a/manim/_config/cfg_subcmds.py b/manim/_config/cfg_subcmds.py
index 1d0a7af75..f9e88245a 100644
--- a/manim/_config/cfg_subcmds.py
+++ b/manim/_config/cfg_subcmds.py
@@ -19,15 +19,15 @@ from rich.style import Style
__all__ = ["write", "show", "export"]
-RICH_COLOUR_INSTRUCTIONS:str = """
+RICH_COLOUR_INSTRUCTIONS: str = """
[red]The default colour is used by the input statement.
If left empty, the default colour will be used.[/red]
[magenta] For a full list of styles, visit[/magenta] [green]https://rich.readthedocs.io/en/latest/style.html[/green]
"""
-RICH_NON_STYLE_ENTRIES:str = ["log.width", "log.height", "log.timestamps"]
+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) -> Union[str, int, bool]:
"""Extracts the literal of proper datatype from a string.
Parameters
----------
@@ -46,7 +46,7 @@ def value_from_string(value:str) -> Union[str,int,bool]:
return value
-def _is_expected_datatype(value:str, expected:str, style:bool=False) -> bool:
+def _is_expected_datatype(value: str, expected: str, style: bool = False) -> bool:
"""Checks whether `value` is the same datatype as `expected`,
and checks if it is a valid `style` if `style` is true.
@@ -71,7 +71,7 @@ def _is_expected_datatype(value:str, expected:str, style:bool=False) -> bool:
return isinstance(value, expected) and (is_valid_style(value) if style else True)
-def is_valid_style(style:str) -> bool:
+def is_valid_style(style: str) -> bool:
"""Checks whether the entered color is a valid color according to rich
Parameters
----------
@@ -89,7 +89,7 @@ def is_valid_style(style:str) -> bool:
return False
-def replace_keys(default:dict) -> dict:
+def replace_keys(default: dict) -> dict:
"""Replaces _ to . and viceversa in a dictionary for rich
Parameters
----------
@@ -114,7 +114,7 @@ def replace_keys(default:dict) -> dict:
return default
-def write(level:str=None, openfile:bool=False)-> None:
+def write(level: str = None, openfile: bool = False) -> None:
config_paths = config_file_paths()
console.print(
"[yellow bold]Manim Configuration File Writer[/yellow bold]", justify="center"
diff --git a/manim/_config/main_utils.py b/manim/_config/main_utils.py
index fddc73c87..aee2ec76d 100644
--- a/manim/_config/main_utils.py
+++ b/manim/_config/main_utils.py
@@ -9,7 +9,7 @@ from manim import constants
__all__ = ["parse_args"]
-def _find_subcommand(args:list) -> typing.Union[str,None]:
+def _find_subcommand(args: list) -> typing.Union[str, None]:
"""Return the subcommand that has been passed, if any.
Parameters
@@ -40,7 +40,7 @@ def _find_subcommand(args:list) -> typing.Union[str,None]:
return None
-def _init_cfg_subcmd(subparsers:argparse._SubParsersAction) -> argparse.ArgumentParser:
+def _init_cfg_subcmd(subparsers: argparse._SubParsersAction) -> argparse.ArgumentParser:
"""Initialises the subparser for the `cfg` subcommand.
Parameters
@@ -74,7 +74,7 @@ def _init_cfg_subcmd(subparsers:argparse._SubParsersAction) -> argparse.Argument
return cfg_related
-def _str2bool(s:str) -> bool:
+def _str2bool(s: str) -> bool:
"""Helper function that handles boolean CLI arguments."""
if s == "True":
return True
@@ -84,7 +84,7 @@ def _str2bool(s:str) -> bool:
raise argparse.ArgumentTypeError("True or False expected")
-def parse_args(args:list)->argparse.Namespace:
+def parse_args(args: list) -> argparse.Namespace:
"""Parse CLI arguments.
Parameters
@@ -115,7 +115,7 @@ def parse_args(args:list)->argparse.Namespace:
return _parse_args_no_subcmd(args)
-def _parse_args_cfg_subcmd(args:list) -> argparse.Namespace:
+def _parse_args_cfg_subcmd(args: list) -> argparse.Namespace:
"""Parse arguments of the form 'manim cfg <subcmd> <args>'."""
parser = argparse.ArgumentParser(
description="Animation engine for explanatory math videos",
@@ -153,7 +153,7 @@ def _parse_args_cfg_subcmd(args:list) -> argparse.Namespace:
return parsed
-def _parse_args_plugins(args:list) -> argparse.Namespace:
+def _parse_args_plugins(args: list) -> argparse.Namespace:
"""Parse arguments of the form 'manim plugins <args>'."""
parser = argparse.ArgumentParser(
description="Utility command for managing plugins",
@@ -173,7 +173,7 @@ def _parse_args_plugins(args:list) -> argparse.Namespace:
return parsed
-def _parse_args_no_subcmd(args:list)->argparse.Namespace:
+def _parse_args_no_subcmd(args: list) -> argparse.Namespace:
"""Parse arguments of the form 'manim <args>', when no command is present."""
parser = argparse.ArgumentParser(
description="Animation engine for explanatory math videos",
diff --git a/manim/mobject/vector_field.py b/manim/mobject/vector_field.py
index f48c28819..11577da84 100644
--- a/manim/mobject/vector_field.py
+++ b/manim/mobject/vector_field.py
@@ -91,7 +91,7 @@ def get_rgb_gradient_function(
def get_color_field_image_file(
- scalar_func: Callable[[npt.ArrayLike],np.ndarray],
+ scalar_func: Callable[[npt.ArrayLike], np.ndarray],
min_value: int = 0,
max_value: int = 2,
colors: list = DEFAULT_SCALAR_FIELD_COLORS,
diff --git a/manim/utils/bezier.py b/manim/utils/bezier.py
index 90b35bfd7..fc8bc07c6 100644
--- a/manim/utils/bezier.py
+++ b/manim/utils/bezier.py
@@ -53,7 +53,7 @@ def partial_bezier_points(points, a, b):
# Linear interpolation variants
-def interpolate(start:int, end:int, alpha:float) -> float:
+def interpolate(start: int, end: int, alpha: float) -> float:
return (1 - alpha) * start + alpha * end