A community-maintained Python framework for creating mathematical animations.
Running Black On Master (#419)
github-actions[bot]384de0ff913c
diff --git a/example_scenes/basic.py b/example_scenes/basic.pyindex 945de3002..6b2d6aa63 100644--- a/example_scenes/basic.py+++ b/example_scenes/basic.py@@ -21,7 +21,8 @@ class OpeningManimExample(Scene):basel = MathTex("\\sum_{n=1}^\\infty " "\\frac{1}{n^2} = \\frac{\\pi^2}{6}")VGroup(title, basel).arrange(DOWN)self.play(- Write(title), FadeInFrom(basel, UP),+ Write(title),+ FadeInFrom(basel, UP),)self.wait()@@ -53,7 +54,14 @@ class OpeningManimExample(Scene):grid.prepare_for_nonlinear_transform()self.play(grid.apply_function,- lambda p: p + np.array([np.sin(p[1]), np.sin(p[0]), 0,]),+ lambda p: p+ + np.array(+ [+ np.sin(p[1]),+ np.sin(p[0]),+ 0,+ ]+ ),run_time=3,)self.wait()@@ -88,7 +96,9 @@ class WarpSquare(Scene):class WriteStuff(Scene):def construct(self):example_text = Tex("This is a some text", tex_to_color_map={"text": YELLOW})- example_tex = MathTex("\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}",)+ example_tex = MathTex(+ "\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}",+ )group = VGroup(example_text, example_tex)group.arrange(DOWN)group.set_width(config["frame_width"] - 2 * LARGE_BUFF)@@ -101,7 +111,10 @@ class WriteStuff(Scene):class UpdatersExample(Scene):def construct(self):decimal = DecimalNumber(- 0, show_ellipsis=True, num_decimal_places=3, include_sign=True,+ 0,+ show_ellipsis=True,+ num_decimal_places=3,+ include_sign=True,)square = Square().to_edge(UP)@@ -109,7 +122,10 @@ class UpdatersExample(Scene):decimal.add_updater(lambda d: d.set_value(square.get_center()[1]))self.add(square, decimal)self.play(- square.to_edge, DOWN, rate_func=there_and_back, run_time=5,+ square.to_edge,+ DOWN,+ rate_func=there_and_back,+ run_time=5,)self.wait()@@ -198,9 +214,9 @@ class VariableExample(Scene):self.wait()int_var = 0- on_screen_int_var = Variable(int_var, Text("int_var"), var_type=Integer).next_to(- on_screen_var, DOWN- )+ on_screen_int_var = Variable(+ int_var, Text("int_var"), var_type=Integer+ ).next_to(on_screen_var, DOWN)on_screen_int_var.label.set_color(RED)on_screen_int_var.value.set_color(GREEN)@@ -215,7 +231,8 @@ class VariableExample(Scene):# variable with subscripts, superscripts, etc. the default class# for the label is MathTexsubscript_label_var = 10- on_screen_subscript_var = Variable(subscript_label_var, "{a}_{i}").next_to(on_screen_int_var, DOWN)+ on_screen_subscript_var = Variable(subscript_label_var, "{a}_{i}").next_to(+ on_screen_int_var, DOWN+ )self.play(Write(on_screen_subscript_var))self.wait()-diff --git a/manim/animation/indication.py b/manim/animation/indication.pyindex 2e1b03e14..6e9b9763c 100644--- a/manim/animation/indication.py+++ b/manim/animation/indication.py@@ -99,7 +99,9 @@ class Flash(AnimationGroup):self.lines = self.create_lines()animations = self.create_line_anims()super().__init__(- *animations, group=self.lines, **kwargs,+ *animations,+ group=self.lines,+ **kwargs,)def create_lines(self):@@ -122,7 +124,9 @@ class CircleIndicate(Indicate):CONFIG = {"rate_func": there_and_back,"remover": True,- "circle_config": {"color": YELLOW,},+ "circle_config": {+ "color": YELLOW,+ },}def __init__(self, mobject, **kwargs):@@ -194,7 +198,9 @@ class AnimationOnSurroundingRectangle(AnimationGroup):rect = self.get_rect()rect.add_updater(lambda r: r.move_to(mobject))- super().__init__(self.rect_animation(rect, **kwargs),)+ super().__init__(+ self.rect_animation(rect, **kwargs),+ )def get_rect(self):return SurroundingRectangle(diff --git a/manim/animation/specialized.py b/manim/animation/specialized.pyindex 558b4131a..bcceecdb6 100644--- a/manim/animation/specialized.py+++ b/manim/animation/specialized.py@@ -34,7 +34,10 @@ class MoveCar(ApplyMethod):super().begin()car = self.mobjectdistance = get_norm(- op.sub(self.target_mobject.get_right(), self.starting_mobject.get_right(),)+ op.sub(+ self.target_mobject.get_right(),+ self.starting_mobject.get_right(),+ ))if not self.moving_forward:distance *= -1@@ -67,7 +70,11 @@ class Broadcast(LaggedStart):digest_config(self, kwargs)circles = VGroup()for x in range(self.n_circles):- circle = Circle(radius=self.big_radius, stroke_color=BLACK, stroke_width=0,)+ circle = Circle(+ radius=self.big_radius,+ stroke_color=BLACK,+ stroke_width=0,+ )circle.add_updater(lambda c: c.move_to(focal_point))circle.save_state()circle.set_width(self.small_radius * 2)diff --git a/manim/animation/transform.py b/manim/animation/transform.pyindex 82e9dc852..563b43b5c 100644--- a/manim/animation/transform.py+++ b/manim/animation/transform.py@@ -57,7 +57,10 @@ class Transform(Animation):elif self.path_arc == 0:self.path_func = straight_pathelse:- self.path_func = path_along_arc(self.path_arc, self.path_arc_axis,)+ self.path_func = path_along_arc(+ self.path_arc,+ self.path_arc_axis,+ )def begin(self):# Use a copy of target_mobject for the align_data@@ -106,7 +109,11 @@ class Transform(Animation):return zip(*[mob.family_members_with_points()- for mob in [self.mobject, self.starting_mobject, self.target_copy,]+ for mob in [+ self.mobject,+ self.starting_mobject,+ self.target_copy,+ ]])diff --git a/manim/animation/update.py b/manim/animation/update.pyindex fdc808950..7d55c2ea2 100644--- a/manim/animation/update.py+++ b/manim/animation/update.py@@ -33,7 +33,10 @@ class UpdateFromAlphaFunc(UpdateFromFunc):class MaintainPositionRelativeTo(Animation):def __init__(self, mobject, tracked_mobject, **kwargs):self.tracked_mobject = tracked_mobject- self.diff = op.sub(mobject.get_center(), tracked_mobject.get_center(),)+ self.diff = op.sub(+ mobject.get_center(),+ tracked_mobject.get_center(),+ )super().__init__(mobject, **kwargs)def interpolate_mobject(self, alpha):diff --git a/manim/camera/mapping_camera.py b/manim/camera/mapping_camera.pyindex f96d3c92a..460d4c6cc 100644--- a/manim/camera/mapping_camera.py+++ b/manim/camera/mapping_camera.py@@ -41,7 +41,10 @@ class MappingCamera(Camera):):mobject.insert_n_curves(self.min_num_curves)Camera.capture_mobjects(- self, mobject_copies, include_submobjects=False, excluded_mobjects=None,+ self,+ mobject_copies,+ include_submobjects=False,+ excluded_mobjects=None,)@@ -122,5 +125,7 @@ class SplitScreenCamera(OldMultiCamera):camera.reset_pixel_shape(camera.pixel_height, half_width)OldMultiCamera.__init__(- self, (left_camera, (0, 0)), (right_camera, (0, half_width)),+ self,+ (left_camera, (0, 0)),+ (right_camera, (0, half_width)),)diff --git a/manim/camera/moving_camera.py b/manim/camera/moving_camera.pyindex ff7f82be3..55afc497b 100644--- a/manim/camera/moving_camera.py+++ b/manim/camera/moving_camera.py@@ -41,7 +41,8 @@ class MovingCamera(Camera):if frame is None:frame = ScreenRectangle(height=config["frame_height"])frame.set_stroke(- self.default_frame_stroke_color, self.default_frame_stroke_width,+ self.default_frame_stroke_color,+ self.default_frame_stroke_width,)self.frame = frameCamera.__init__(self, **kwargs)diff --git a/manim/config/__init__.py b/manim/config/__init__.pyindex 2711c21b0..05aa100e2 100644--- a/manim/config/__init__.py+++ b/manim/config/__init__.py@@ -5,5 +5,12 @@ from . import config as _configfrom .config import config, tempconfig, file_writer_config, camera_configfrom .logger import logger, console-__all__ = ["_config", "config", "tempconfig", "file_writer_config",- "camera_config", "logger", "console"]+__all__ = [+ "_config",+ "config",+ "tempconfig",+ "file_writer_config",+ "camera_config",+ "logger",+ "console",+]diff --git a/manim/config/config_utils.py b/manim/config/config_utils.pyindex 37b265032..0254bcf84 100644--- a/manim/config/config_utils.py+++ b/manim/config/config_utils.py@@ -196,7 +196,8 @@ def _parse_cli(arg_list, input=True):if only_manim or not _subcommand_name(ignore=["--help", "-h"]):parser.add_argument(- "file", help="path to file holding the python code for the scene",+ "file",+ help="path to file holding the python code for the scene",)parser.add_argument("scene_names",@@ -298,19 +299,25 @@ def _parse_cli(arg_list, input=True):)# The default value of the following is set in manim.cfgparser.add_argument(- "-c", "--background_color", help="Specify background color",+ "-c",+ "--background_color",+ help="Specify background color",)parser.add_argument(- "--background_opacity", help="Specify background opacity",+ "--background_opacity",+ help="Specify background opacity",)parser.add_argument(- "--media_dir", help="Directory to store media (including video files)",+ "--media_dir",+ help="Directory to store media (including video files)",)parser.add_argument(- "--log_dir", help="Directory to store log files",+ "--log_dir",+ help="Directory to store log files",)parser.add_argument(- "--tex_template", help="Specify a custom TeX template file",+ "--tex_template",+ help="Specify a custom TeX template file",)# All of the following use (action="store_true"). This means that@@ -338,16 +345,28 @@ def _parse_cli(arg_list, input=True):# The following are mutually exclusive and each overrides# FRAME_RATE, PIXEL_HEIGHT, and PIXEL_WIDTH,parser.add_argument(- "-l", "--low_quality", action="store_true", help="Render at low quality",+ "-l",+ "--low_quality",+ action="store_true",+ help="Render at low quality",)parser.add_argument(- "-m", "--medium_quality", action="store_true", help="Render at medium quality",+ "-m",+ "--medium_quality",+ action="store_true",+ help="Render at medium quality",)parser.add_argument(- "-e", "--high_quality", action="store_true", help="Render at high quality",+ "-e",+ "--high_quality",+ action="store_true",+ help="Render at high quality",)parser.add_argument(- "-k", "--fourk_quality", action="store_true", help="Render at 4K quality",+ "-k",+ "--fourk_quality",+ action="store_true",+ help="Render at 4K quality",)# This overrides any of the above@@ -370,7 +389,8 @@ def _parse_cli(arg_list, input=True):# Specify the manim.cfg fileparser.add_argument(- "--config_file", help="Specify the configuration file",+ "--config_file",+ help="Specify the configuration file",)# Specify whether to use the custom folders@@ -567,7 +587,9 @@ def _init_cfg_subcmd(subparsers)::class:`argparse.ArgumentParser`The parser that parser anything cfg subcommand related."""- cfg_related = subparsers.add_parser("cfg",)+ cfg_related = subparsers.add_parser(+ "cfg",+ )cfg_subparsers = cfg_related.add_subparsers(dest="cfg_subcommand")cfg_write_parser = cfg_subparsers.add_parser("write")diff --git a/manim/config/logger.py b/manim/config/logger.pyindex 143509b34..46f8af97e 100644--- a/manim/config/logger.py+++ b/manim/config/logger.py@@ -7,7 +7,7 @@ This library uses rich for coloured log outputs."""-__all__ = ['logger', 'console']+__all__ = ["logger", "console"]import configparserdiff --git a/manim/mobject/coordinate_systems.py b/manim/mobject/coordinate_systems.pyindex 20b088a3b..1f32a676a 100644--- a/manim/mobject/coordinate_systems.py+++ b/manim/mobject/coordinate_systems.py@@ -27,13 +27,13 @@ class CoordinateSystem:def __init__(self, dim=2):self.dimension = dim- if not hasattr(self, 'x_min'):+ if not hasattr(self, "x_min"):self.x_min = -config["frame_x_radius"]- if not hasattr(self, 'x_max'):+ if not hasattr(self, "x_max"):self.x_max = config["frame_x_radius"]- if not hasattr(self, 'y_min'):+ if not hasattr(self, "y_min"):self.y_min = -config["frame_y_radius"]- if not hasattr(self, 'y_max'):+ if not hasattr(self, "y_max"):self.y_max = config["frame_y_radius"]def coords_to_point(self, *coords):@@ -83,7 +83,8 @@ class CoordinateSystem:def get_axis_labels(self, x_label_tex="x", y_label_tex="y"):self.axis_labels = VGroup(- self.get_x_axis_label(x_label_tex), self.get_y_axis_label(y_label_tex),+ self.get_x_axis_label(x_label_tex),+ self.get_y_axis_label(y_label_tex),)return self.axis_labels@@ -152,7 +153,9 @@ class Axes(VGroup, CoordinateSystem):def create_axis(self, min_val, max_val, axis_config):new_config = merge_dicts_recursively(- self.axis_config, {"x_min": min_val, "x_max": max_val}, axis_config,+ self.axis_config,+ {"x_min": min_val, "x_max": max_val},+ axis_config,)return NumberLine(**new_config)@@ -193,7 +196,6 @@ class Axes(VGroup, CoordinateSystem):class ThreeDAxes(Axes):CONFIG = {-"z_axis_config": {},"z_min": -3.5,"z_max": 3.5,@@ -230,7 +232,10 @@ class ThreeDAxes(Axes):def set_axis_shading(self):def make_func(axis):vect = self.light_source- return lambda: (axis.get_edge_center(-vect), axis.get_edge_center(vect),)+ return lambda: (+ axis.get_edge_center(-vect),+ axis.get_edge_center(vect),+ )for axis in self:for submob in axis.family_members_with_points():@@ -280,10 +285,15 @@ class NumberPlane(Axes):self.faded_line_style = styleself.background_lines, self.faded_lines = self.get_lines()- self.background_lines.set_style(**self.background_line_style,)- self.faded_lines.set_style(**self.faded_line_style,)+ self.background_lines.set_style(+ **self.background_line_style,+ )+ self.faded_lines.set_style(+ **self.faded_line_style,+ )self.add_to_back(- self.faded_lines, self.background_lines,+ self.faded_lines,+ self.background_lines,)def get_lines(self):@@ -300,10 +310,16 @@ class NumberPlane(Axes):y_freq = self.y_line_frequencyx_lines1, x_lines2 = self.get_lines_parallel_to_axis(- x_axis, y_axis, x_freq, self.faded_line_ratio,+ x_axis,+ y_axis,+ x_freq,+ self.faded_line_ratio,)y_lines1, y_lines2 = self.get_lines_parallel_to_axis(- y_axis, x_axis, y_freq, self.faded_line_ratio,+ y_axis,+ x_axis,+ y_freq,+ self.faded_line_ratio,)lines1 = VGroup(*x_lines1, *y_lines1)lines2 = VGroup(*x_lines2, *y_lines2)@@ -416,7 +432,8 @@ class ComplexPlane(NumberPlane):axis = self.get_y_axis()value = z.imagkwargs = merge_dicts_recursively(- kwargs, {"number_config": {"unit": "i"}},+ kwargs,+ {"number_config": {"unit": "i"}},)else:axis = self.get_x_axis()diff --git a/manim/mobject/mobject.py b/manim/mobject/mobject.pyindex c02476a44..a9dbf772b 100644--- a/manim/mobject/mobject.py+++ b/manim/mobject/mobject.py@@ -608,7 +608,8 @@ class Mobject(Container):raise Exception("Cannot position endpoints of closed loop")target_vect = np.array(end) - np.array(start)self.scale(- get_norm(target_vect) / get_norm(curr_vect), about_point=curr_start,+ get_norm(target_vect) / get_norm(curr_vect),+ about_point=curr_start,)self.rotate(angle_of_vector(target_vect) - angle_of_vector(curr_vect),@@ -917,7 +918,9 @@ class Mobject(Container):def match_coord(self, mobject, dim, direction=ORIGIN):return self.set_coord(- mobject.get_coord(dim, direction), dim=dim, direction=direction,+ mobject.get_coord(dim, direction),+ dim=dim,+ direction=direction,)def match_x(self, mobject, direction=ORIGIN):diff --git a/manim/mobject/number_line.py b/manim/mobject/number_line.pyindex 76c231f3d..7de1eb395 100644--- a/manim/mobject/number_line.py+++ b/manim/mobject/number_line.py@@ -42,7 +42,9 @@ class NumberLine(Line):"tip_height": 0.25,"add_start": 0, # extend number line by this amount at its starting point"add_end": 0, # extend number line by this amount at its end point- "decimal_number_config": {"num_decimal_places": 0,},+ "decimal_number_config": {+ "num_decimal_places": 0,+ },"exclude_zero_from_default_numbers": False,}@@ -84,7 +86,8 @@ class NumberLine(Line):])self.add(- self.tick_marks, self.big_tick_marks,+ self.tick_marks,+ self.big_tick_marks,)def get_tick(self, x, size=None):@@ -97,7 +100,10 @@ class NumberLine(Line):return resultdef get_tick_marks(self):- return VGroup(*self.tick_marks, *self.big_tick_marks,)+ return VGroup(+ *self.tick_marks,+ *self.big_tick_marks,+ )def get_tick_numbers(self):u = -1 if self.include_tip and self.add_end == 0 else 1@@ -140,7 +146,10 @@ class NumberLine(Line):def default_numbers_to_display(self):if self.numbers_to_show is not None:return self.numbers_to_show- numbers = np.arange(np.floor(self.leftmost_tick), np.ceil(self.x_max),)+ numbers = np.arange(+ np.floor(self.leftmost_tick),+ np.ceil(self.x_max),+ )if self.exclude_zero_from_default_numbers:numbers = numbers[numbers != 0]return numbers@@ -149,7 +158,8 @@ class NumberLine(Line):self, number, number_config=None, scale_val=None, direction=None, buff=None):number_config = merge_dicts_recursively(- self.decimal_number_config, number_config or {},+ self.decimal_number_config,+ number_config or {},)if scale_val is None:scale_val = self.number_scale_val@@ -184,7 +194,9 @@ class UnitInterval(NumberLine):"tick_frequency": 0.1,"numbers_with_elongated_ticks": [0, 1],"number_at_center": 0.5,- "decimal_number_config": {"num_decimal_places": 1,},+ "decimal_number_config": {+ "num_decimal_places": 1,+ },}def __init__(self, **kwargs):diff --git a/manim/mobject/numbers.py b/manim/mobject/numbers.pyindex 1c14b7d1d..ee2d51b2a 100644--- a/manim/mobject/numbers.py+++ b/manim/mobject/numbers.py@@ -194,7 +194,7 @@ class Variable(VMobject):self, var, label, var_type=DecimalNumber, num_decimal_places=2, **kwargs):- self.label = MathTex(label) if isinstance(label,str) else label+ self.label = MathTex(label) if isinstance(label, str) else labelequals = MathTex("=").next_to(self.label, RIGHT)self.label.add(equals)diff --git a/manim/mobject/shape_matchers.py b/manim/mobject/shape_matchers.pyindex 378201055..96eefd1fd 100644--- a/manim/mobject/shape_matchers.py+++ b/manim/mobject/shape_matchers.py@@ -71,7 +71,9 @@ class Cross(VGroup):def __init__(self, mobject, **kwargs):VGroup.__init__(- self, Line(UP + LEFT, DOWN + RIGHT), Line(UP + RIGHT, DOWN + LEFT),+ self,+ Line(UP + LEFT, DOWN + RIGHT),+ Line(UP + RIGHT, DOWN + LEFT),)self.replace(mobject, stretch=True)self.set_stroke(self.stroke_color, self.stroke_width)diff --git a/manim/mobject/three_d_shading_utils.py b/manim/mobject/three_d_shading_utils.pyindex 89526e609..110e2e577 100644--- a/manim/mobject/three_d_shading_utils.py+++ b/manim/mobject/three_d_shading_utils.py@@ -39,7 +39,8 @@ def get_3d_vmob_unit_normal(vmob, point_index):im1 = i - 1 if i > 0 else (n_points - 2)ip1 = i + 1 if i < (n_points - 1) else 1return get_unit_normal(- vmob.points[ip1] - vmob.points[i], vmob.points[im1] - vmob.points[i],+ vmob.points[ip1] - vmob.points[i],+ vmob.points[im1] - vmob.points[i],)diff --git a/manim/mobject/three_d_utils.py b/manim/mobject/three_d_utils.pyindex 5acc8f4bd..1ec6b8f74 100644--- a/manim/mobject/three_d_utils.py+++ b/manim/mobject/three_d_utils.py@@ -53,7 +53,8 @@ def get_3d_vmob_unit_normal(vmob, point_index):im3 = i - 3 if i > 2 else (n_points - 4)ip3 = i + 3 if i < (n_points - 3) else 3unit_normal = get_unit_normal(- vmob.points[ip3] - vmob.points[i], vmob.points[im3] - vmob.points[i],+ vmob.points[ip3] - vmob.points[i],+ vmob.points[im3] - vmob.points[i],)if get_norm(unit_normal) == 0:return np.array(UP)diff --git a/manim/mobject/three_dimensions.py b/manim/mobject/three_dimensions.pyindex 54cb6a06d..f113bfa81 100644--- a/manim/mobject/three_dimensions.py+++ b/manim/mobject/three_dimensions.py@@ -67,7 +67,13 @@ class ParametricSurface(VGroup):v1, v2 = v_values[j : j + 2]face = ThreeDVMobject()face.set_points_as_corners(- [[u1, v1, 0], [u2, v1, 0], [u2, v2, 0], [u1, v2, 0], [u1, v1, 0],]+ [+ [u1, v1, 0],+ [u2, v1, 0],+ [u2, v2, 0],+ [u1, v2, 0],+ [u1, v1, 0],+ ])faces.add(face)face.u_index = i@@ -124,7 +130,10 @@ class Cube(VGroup):def generate_points(self):for vect in IN, OUT, LEFT, RIGHT, UP, DOWN:- face = Square(side_length=self.side_length, shade_in_3d=True,)+ face = Square(+ side_length=self.side_length,+ shade_in_3d=True,+ )face.flip()face.shift(self.side_length * OUT / 2.0)face.apply_matrix(z_to_vector(vect))diff --git a/manim/mobject/types/image_mobject.py b/manim/mobject/types/image_mobject.pyindex 25badc257..db8bedf29 100644--- a/manim/mobject/types/image_mobject.py+++ b/manim/mobject/types/image_mobject.py@@ -33,7 +33,13 @@ class AbstractImageMobject(Mobject):def reset_points(self):# Corresponding corners of image are fixed to these 3 points- self.points = np.array([UP + LEFT, UP + RIGHT, DOWN + LEFT,])+ self.points = np.array(+ [+ UP + LEFT,+ UP + RIGHT,+ DOWN + LEFT,+ ]+ )self.center()h, w = self.get_pixel_array().shape[:2]self.stretch_to_fit_height(self.height)diff --git a/manim/mobject/types/point_cloud_mobject.py b/manim/mobject/types/point_cloud_mobject.pyindex 838908a84..ffe523081 100644--- a/manim/mobject/types/point_cloud_mobject.py+++ b/manim/mobject/types/point_cloud_mobject.py@@ -161,7 +161,9 @@ class PMobject(Mobject):self.rgbas = interpolate(mobject1.rgbas, mobject2.rgbas, alpha)self.set_stroke_width(interpolate(- mobject1.get_stroke_width(), mobject2.get_stroke_width(), alpha,+ mobject1.get_stroke_width(),+ mobject2.get_stroke_width(),+ alpha,))return selfdiff --git a/manim/mobject/vector_field.py b/manim/mobject/vector_field.pyindex 890f01ebb..89ab1ca37 100644--- a/manim/mobject/vector_field.py+++ b/manim/mobject/vector_field.py@@ -41,8 +41,8 @@ DEFAULT_SCALAR_FIELD_COLORS = [BLUE_E, GREEN, YELLOW, RED]def get_colored_background_image(- scalar_field_func,- number_to_rgb_func,+ scalar_field_func,+ number_to_rgb_func,):ph = config["pixel_height"]pw = config["pixel_width"]@@ -64,7 +64,10 @@ def get_colored_background_image(def get_rgb_gradient_function(- min_value=0, max_value=1, colors=[BLUE, RED], flip_alphas=True, # Why?+ min_value=0,+ max_value=1,+ colors=[BLUE, RED],+ flip_alphas=True, # Why?):rgbs = np.array(list(map(color_to_rgb, colors)))@@ -235,7 +238,9 @@ class StreamLines(VGroup):if self.color_by_arc_length:len_to_rgb = get_rgb_gradient_function(- self.min_arc_length, self.max_arc_length, colors=self.colors,+ self.min_arc_length,+ self.max_arc_length,+ colors=self.colors,)for line in self:arc_length = line.get_arc_length()@@ -305,7 +310,11 @@ class AnimatedStreamLines(VGroup):CONFIG = {"lag_range": 4,"line_anim_class": ShowPassingFlash,- "line_anim_config": {"run_time": 4, "rate_func": linear, "time_width": 0.3,},+ "line_anim_config": {+ "run_time": 4,+ "rate_func": linear,+ "time_width": 0.3,+ },}def __init__(self, stream_lines, **kwargs):diff --git a/manim/scene/scene.py b/manim/scene/scene.pyindex 834139a47..951dc8d81 100644--- a/manim/scene/scene.py+++ b/manim/scene/scene.py@@ -65,7 +65,10 @@ class Scene(Container):def __init__(self, **kwargs):Container.__init__(self, **kwargs)self.camera = self.camera_class(**camera_config)- self.file_writer = SceneFileWriter(self, **file_writer_config,)+ self.file_writer = SceneFileWriter(+ self,+ **file_writer_config,+ )self.play_hashes_list = []self.mobjects = []# TODO, remove need for foreground mobjects@@ -195,7 +198,10 @@ class Scene(Container):if file_writer_config["skip_animations"] and not ignore_skipping:returnif mobjects is None:- mobjects = list_update(self.mobjects, self.foreground_mobjects,)+ mobjects = list_update(+ self.mobjects,+ self.foreground_mobjects,+ )if background is not None:self.camera.set_pixel_array(background)else:diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.pyindex e5762291e..4a4a5d2c8 100644--- a/manim/scene/scene_file_writer.py+++ b/manim/scene/scene_file_writer.py@@ -59,7 +59,8 @@ class SceneFileWriter(object):if not file_writer_config["custom_folders"]:image_dir = guarantee_existence(os.path.join(- file_writer_config["images_dir"], module_directory,+ file_writer_config["images_dir"],+ module_directory,))else:@@ -93,7 +94,11 @@ class SceneFileWriter(object):)if not file_writer_config["custom_folders"]:self.partial_movie_directory = guarantee_existence(- os.path.join(movie_dir, "partial_movie_files", scene_name,)+ os.path.join(+ movie_dir,+ "partial_movie_files",+ scene_name,+ ))else:self.partial_movie_directory = guarantee_existence(@@ -252,7 +257,8 @@ class SceneFileWriter(object):diff = new_end - curr_endif diff > 0:segment = segment.append(- AudioSegment.silent(int(np.ceil(diff * 1000))), crossfade=0,+ AudioSegment.silent(int(np.ceil(diff * 1000))),+ crossfade=0,)self.audio_segment = segment.overlay(new_segment,@@ -444,7 +450,8 @@ class SceneFileWriter(object):self.writing_process.stdin.close()self.writing_process.wait()shutil.move(- self.temp_partial_movie_file_path, self.partial_movie_file_path,+ self.temp_partial_movie_file_path,+ self.partial_movie_file_path,)logger.info(f"Animation {self.scene.num_plays} : Partial movie file written in {self.partial_movie_file_path}"@@ -536,7 +543,8 @@ class SceneFileWriter(object):# Makes sure sound file length will match video fileself.add_audio_segment(AudioSegment.silent(0))self.audio_segment.export(- sound_file_path, bitrate="312k",+ sound_file_path,+ bitrate="312k",)temp_file_path = movie_file_path.replace(".", "_temp.")commands = [diff --git a/manim/scene/zoomed_scene.py b/manim/scene/zoomed_scene.pyindex 27205c8c1..b2f321d16 100644--- a/manim/scene/zoomed_scene.py+++ b/manim/scene/zoomed_scene.py@@ -84,7 +84,8 @@ class ZoomedScene(MovingCameraScene):self.play(self.get_zoom_in_animation())self.play(self.get_zoomed_display_pop_out_animation())self.add_foreground_mobjects(- self.zoomed_camera.frame, self.zoomed_display,+ self.zoomed_camera.frame,+ self.zoomed_display,)def get_zoom_in_animation(self, run_time=2, **kwargs):diff --git a/manim/utils/rate_functions.py b/manim/utils/rate_functions.pyindex 1bb741ed6..5727f6d27 100644--- a/manim/utils/rate_functions.py+++ b/manim/utils/rate_functions.py@@ -28,7 +28,11 @@ def linear(t):def smooth(t, inflection=10.0):error = sigmoid(-inflection / 2)- return np.clip((sigmoid(inflection * (t - 0.5)) - error) / (1 - 2 * error), 0, 1,)+ return np.clip(+ (sigmoid(inflection * (t - 0.5)) - error) / (1 - 2 * error),+ 0,+ 1,+ )def rush_into(t, inflection=10.0):diff --git a/manim/utils/sounds.py b/manim/utils/sounds.pyindex 0f30ca949..38c173a76 100644--- a/manim/utils/sounds.py+++ b/manim/utils/sounds.py@@ -12,7 +12,13 @@ from ..utils.file_ops import seek_full_path_from_defaultsdef play_chord(*nums):commands = (- ["play", "-n", "-c1", "--no-show-progress", "synth",]+ [+ "play",+ "-n",+ "-c1",+ "--no-show-progress",+ "synth",+ ]+ ["sin %-" + str(num) for num in nums]+ ["fade h 0.5 1 0.5", ">", os.devnull])diff --git a/tests/helpers/graphical_units.py b/tests/helpers/graphical_units.pyindex 01bfb1379..ad8914a03 100644--- a/tests/helpers/graphical_units.py+++ b/tests/helpers/graphical_units.py@@ -24,7 +24,7 @@ def set_test_scene(scene_object, module_name):Examples--------Normal usage::-+set_test_scene(DotTest, "geometry")"""diff --git a/tests/test_coordinate_system.py b/tests/test_coordinate_system.pyindex 2c8bbd9b9..c575db31b 100644--- a/tests/test_coordinate_system.py+++ b/tests/test_coordinate_system.py@@ -8,22 +8,23 @@ from manim import config, tempconfig, ORIGIN, LEFTdef test_initial_config():"""Check that all attributes are defined properly from the config."""cs = CS()- assert cs.x_min == -config['frame_x_radius']- assert cs.x_max == config['frame_x_radius']- assert cs.y_min == -config['frame_y_radius']- assert cs.y_max == config['frame_y_radius']+ assert cs.x_min == -config["frame_x_radius"]+ assert cs.x_max == config["frame_x_radius"]+ assert cs.y_min == -config["frame_y_radius"]+ assert cs.y_max == config["frame_y_radius"]ax = Axes()assert np.allclose(ax.center_point, ORIGIN)- assert np.allclose(ax.y_axis_config['label_direction'], LEFT)+ assert np.allclose(ax.y_axis_config["label_direction"], LEFT)- with tempconfig({'frame_x_radius': 100, 'frame_y_radius': 200}):+ with tempconfig({"frame_x_radius": 100, "frame_y_radius": 200}):cs = CS()assert cs.x_min == -100assert cs.x_max == 100assert cs.y_min == -200assert cs.y_max == 200+def test_dimension():"""Check that objects have the correct dimension."""assert Axes().dimension == 2diff --git a/tests/test_family.py b/tests/test_family.pyindex 3cbc7055e..47744cbb4 100644--- a/tests/test_family.py+++ b/tests/test_family.py@@ -37,7 +37,11 @@ def test_family():def test_overlapping_family():"""Check that each member of the family is only gathered once."""- mob, child1, child2, = Mobject(), Mobject(), Mobject(),+ mob, child1, child2, = (+ Mobject(),+ Mobject(),+ Mobject(),+ )gchild1, gchild2, gchild_common = Mobject(), Mobject(), Mobject()child1.add(gchild1, gchild_common)child2.add(gchild2, gchild_common)@@ -57,7 +61,11 @@ def test_shift_family():"""# Note shift() needs the mobject to have a non-empty `points` attribute, so# we cannot use a plain Mobject or VMobject. We use Circle instead.- mob, child1, child2, = Circle(), Circle(), Circle(),+ mob, child1, child2, = (+ Circle(),+ Circle(),+ Circle(),+ )gchild1, gchild2, gchild_common = Circle(), Circle(), Circle()child1.add(gchild1, gchild_common)diff --git a/tests/test_graphical_units/test_geometry.py b/tests/test_graphical_units/test_geometry.pyindex d2522c809..84366097a 100644--- a/tests/test_graphical_units/test_geometry.py+++ b/tests/test_graphical_units/test_geometry.py@@ -32,9 +32,13 @@ class CurvedArrowTest(Scene):class CustomDoubleArrowTest(Scene):def construct(self):from manim.mobject.geometry import ArrowCircleTip, ArrowSquareFilledTip- a = DoubleArrow(np.array([-1, -1, 0]), np.array([1, 1, 0]),- tip_shape_start=ArrowCircleTip,- tip_shape_end=ArrowSquareFilledTip)++ a = DoubleArrow(+ np.array([-1, -1, 0]),+ np.array([1, 1, 0]),+ tip_shape_start=ArrowCircleTip,+ tip_shape_end=ArrowSquareFilledTip,+ )self.play(Animation(a))diff --git a/tests/utils/commands.py b/tests/utils/commands.pyindex 6aa32fc0d..90c5d3caf 100644--- a/tests/utils/commands.py+++ b/tests/utils/commands.py@@ -3,7 +3,10 @@ import subprocessdef capture(command):proc = subprocess.Popen(- command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf8",+ command,+ stdout=subprocess.PIPE,+ stderr=subprocess.PIPE,+ encoding="utf8",)out, err = proc.communicate()return out, err, proc.returncode