Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

black

leotrs4e28d1f6ae53
diff --git a/manim/config/utils.py b/manim/config/utils.py
index 9d1111ab5..40bf9eaeb 100644
--- a/manim/config/utils.py
+++ b/manim/config/utils.py
@@ -74,7 +74,7 @@ def make_config_parser(custom_file=None):
parser.read_file(file) # necessary file
other_files = [user_wide, custom_file if custom_file else folder_wide]
- parser.read(other_files) # optional files
+ parser.read(other_files) # optional files
return parser
@@ -193,7 +193,6 @@ class ManimConfig(MutableMapping):
for k, v in _dict.items():
self[k] = v
-
# don't allow to delete anything
def __delitem__(self, key):
raise AttributeError("'ManimConfig' object does not support item deletion")
diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.py
index 50d5ed6ea..321ab0567 100644
--- a/manim/scene/scene_file_writer.py
+++ b/manim/scene/scene_file_writer.py
@@ -60,7 +60,7 @@ class SceneFileWriter(object):
files will be written to and read from (within MEDIA_DIR).
If they don't already exist, they will be created.
"""
- if config['dry_run']:
+ if config["dry_run"]:
return
if config["input_file"]:
@@ -102,7 +102,7 @@ class SceneFileWriter(object):
default_name, config["movie_file_extension"]
),
)
- if config['save_as_gif']:
+ if config["save_as_gif"]:
self.gif_file_path = os.path.join(
movie_dir,
add_extension_if_not_present(default_name, GIF_FILE_EXTENSION),
diff --git a/tests/test_config.py b/tests/test_config.py
index 946055cee..fc598c628 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -39,13 +39,13 @@ def test_transparent():
orig_verbosity = config["verbosity"]
config["verbosity"] = "ERROR"
- with tempconfig({'dry_run': True}):
+ with tempconfig({"dry_run": True}):
scene = MyScene()
scene.render()
frame = scene.renderer.get_frame()
assert np.allclose(frame[0, 0], [0, 0, 0, 255])
- with tempconfig({"transparent": True, 'dry_run': True}):
+ with tempconfig({"transparent": True, "dry_run": True}):
scene = MyScene()
scene.render()
frame = scene.renderer.get_frame()
@@ -65,24 +65,25 @@ def test_background_color():
def test_digest_file():
"""Test that a config file can be digested programatically."""
- assert config['media_dir'] == Path('media')
- assert config['video_dir'] == Path('media/videos')
+ assert config["media_dir"] == Path("media")
+ assert config["video_dir"] == Path("media/videos")
with tempconfig({}):
temp_cfg = tempfile.NamedTemporaryFile()
- with open(temp_cfg.name, 'w') as file:
- file.write("""
+ with open(temp_cfg.name, "w") as file:
+ file.write(
+ """
[CLI]
media_dir = this_is_my_favorite_path
video_dir = {media_dir}/videos
"""
)
config.digest_file(temp_cfg.name)
- assert config['media_dir'] == Path('this_is_my_favorite_path')
- assert config['video_dir'] == Path('this_is_my_favorite_path/videos')
+ assert config["media_dir"] == Path("this_is_my_favorite_path")
+ assert config["video_dir"] == Path("this_is_my_favorite_path/videos")
- assert config['media_dir'] == Path('media')
- assert config['video_dir'] == Path('media/videos')
+ assert config["media_dir"] == Path("media")
+ assert config["video_dir"] == Path("media/videos")
def test_temporary_dry_run():
diff --git a/tests/test_container.py b/tests/test_container.py
index c49979981..27aca4262 100644
--- a/tests/test_container.py
+++ b/tests/test_container.py
@@ -10,7 +10,7 @@ def test_ABC():
# The following should work without raising exceptions
Mobject()
- with tempconfig({'dry_run': True}):
+ with tempconfig({"dry_run": True}):
Scene()
@@ -67,7 +67,7 @@ def test_mobject_remove():
def test_scene_add_remove():
"""Test Scene.add() and Scene.remove()."""
- with tempconfig({'dry_run': True}):
+ with tempconfig({"dry_run": True}):
scene = Scene()
container_add(scene, lambda: scene.mobjects)
scene = Scene()