Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Address review comments

Devin Neal44a0deed7948
diff --git a/manim/__main__.py b/manim/__main__.py
index c8034558d..2ea9593d4 100644
--- a/manim/__main__.py
+++ b/manim/__main__.py
@@ -1,14 +1,9 @@
-import inspect
import os
import platform
-import subprocess as sp
import sys
-import re
import traceback
-import importlib.util
-import types
-from . import constants, logger, console, file_writer_config
+from . import logger, file_writer_config
from .config.config import camera_config, args
from .config import cfg_subcmds
from .utils.module_ops import (
@@ -16,10 +11,8 @@ from .utils.module_ops import (
get_scene_classes_from_module,
get_scenes_to_render,
)
-from .scene.scene import Scene
from .utils.file_ops import open_file as open_media_file
from .grpc.impl import frame_server_impl
-from .renderer.cairo_renderer import CairoRenderer
def open_file_if_needed(file_writer):
diff --git a/manim/renderer/cairo_renderer.py b/manim/renderer/cairo_renderer.py
index a619ce6cc..dc97effbb 100644
--- a/manim/renderer/cairo_renderer.py
+++ b/manim/renderer/cairo_renderer.py
@@ -1,8 +1,7 @@
import numpy as np
-from .. import config, camera_config, file_writer_config, logger
+from .. import config, camera_config, file_writer_config
from ..utils.iterables import list_update
from ..utils.exceptions import EndSceneEarlyException
-from ..utils.hashing import get_hash_from_play_call, get_hash_from_wait_call
from ..constants import DEFAULT_WAIT_TIME
from ..scene.scene_file_writer import SceneFileWriter
from ..utils.caching import handle_caching_play, handle_caching_wait
diff --git a/manim/utils/caching.py b/manim/utils/caching.py
index 66cb6521b..6b611b96c 100644
--- a/manim/utils/caching.py
+++ b/manim/utils/caching.py
@@ -4,15 +4,18 @@ from ..constants import DEFAULT_WAIT_TIME
def handle_caching_play(func):
- """
- Decorator that returns a wrapped version of func that will compute the hash of the play invocation.
+ """Decorator that returns a wrapped version of func that will compute
+ the hash of the play invocation.
- The returned function will act according to the computed hash: either skip the animation because it's already cached, or let the invoked function play normally.
+ The returned function will act according to the computed hash: either skip
+ the animation because it's already cached, or let the invoked function
+ play normally.
Parameters
----------
func : Callable[[...], None]
- The play like function that has to be written to the video file stream. Take the same parameters as `scene.play`.
+ The play like function that has to be written to the video file stream.
+ Take the same parameters as `scene.play`.
"""
def wrapper(self, scene, *args, **kwargs):
@@ -53,15 +56,17 @@ def handle_caching_play(func):
def handle_caching_wait(func):
- """
- Decorator that returns a wrapped version of func that will compute the hash of the wait invocation.
+ """Decorator that returns a wrapped version of func that will compute the hash of
+ the wait invocation.
- The returned function will act according to the computed hash: either skip the animation because it's already cached, or let the invoked function play normally.
+ The returned function will act according to the computed hash: either skip the
+ animation because it's already cached, or let the invoked function play normally.
Parameters
----------
func : Callable[[...], None]
- The wait like function that has to be written to the video file stream. Take the same parameters as `scene.wait`.
+ The wait like function that has to be written to the video file stream.
+ Take the same parameters as `scene.wait`.
"""
def wrapper(self, scene, duration=DEFAULT_WAIT_TIME, stop_condition=None):
@@ -89,7 +94,7 @@ def handle_caching_wait(func):
self.animations_hashes.append(hash_wait)
self.file_writer.add_partial_movie_file(hash_wait)
logger.debug(
- "Animations hashes list of the scene : (concatened to 5) %(h)s",
+ "List of the first few animation hashes of the scene: %(h)s",
{"h": str(self.animations_hashes[:5])},
)
func(self, scene, duration, stop_condition)
diff --git a/manim/utils/family.py b/manim/utils/family.py
index b7f8498b9..428f2c816 100644
--- a/manim/utils/family.py
+++ b/manim/utils/family.py
@@ -7,8 +7,9 @@ from ..utils.iterables import remove_list_redundancies
def extract_mobject_family_members(
mobjects, use_z_index=False, only_those_with_points=False
):
- """Returns a list of the types of mobjects and
- their family members present.
+ """Returns a list of the types of mobjects and their family members present.
+ A "family" in this context refers to a mobject, its submobjects, and their
+ submobjects, recursively.
Parameters
----------
diff --git a/tests/test_container.py b/tests/test_container.py
index 880b2e5c8..5a26b3ba5 100644
--- a/tests/test_container.py
+++ b/tests/test_container.py
@@ -1,5 +1,5 @@
import pytest
-from manim import Container, Mobject, Scene, CairoRenderer
+from manim import Container, Mobject, Scene
def test_ABC():
diff --git a/tests/utils/GraphicalUnitTester.py b/tests/utils/GraphicalUnitTester.py
index 5935bf4fd..b4352b708 100644
--- a/tests/utils/GraphicalUnitTester.py
+++ b/tests/utils/GraphicalUnitTester.py
@@ -1,13 +1,8 @@
-import numpy as np
import os
-import sys
-import inspect
import logging
-import pytest
-import warnings
-from platform import system
+import numpy as np
-from manim import config, file_writer_config, CairoRenderer
+from manim import config, file_writer_config
class GraphicalUnitTester: