mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
5a4fed87a9
commit
d3f6a6768a
2 changed files with 20 additions and 6 deletions
|
|
@ -101,7 +101,9 @@ def render(**kwargs: Any) -> ClickArgs | dict[str, Any]:
|
|||
renderer = OpenGLRenderer()
|
||||
keep_running = True
|
||||
while keep_running:
|
||||
for SceneClass in scene_classes_from_file(file, include_imported=kwargs["render_imported_scenes"]):
|
||||
for SceneClass in scene_classes_from_file(
|
||||
file, include_imported=kwargs["render_imported_scenes"]
|
||||
):
|
||||
with tempconfig({}):
|
||||
scene = SceneClass(renderer)
|
||||
rerun = scene.render()
|
||||
|
|
@ -118,7 +120,9 @@ def render(**kwargs: Any) -> ClickArgs | dict[str, Any]:
|
|||
error_console.print_exception()
|
||||
sys.exit(1)
|
||||
else:
|
||||
for SceneClass in scene_classes_from_file(file, include_imported=kwargs["render_imported_scenes"]):
|
||||
for SceneClass in scene_classes_from_file(
|
||||
file, include_imported=kwargs["render_imported_scenes"]
|
||||
):
|
||||
try:
|
||||
with tempconfig({}):
|
||||
scene = SceneClass()
|
||||
|
|
|
|||
|
|
@ -69,10 +69,13 @@ def get_module(file_name: Path) -> types.ModuleType:
|
|||
raise FileNotFoundError(f"{file_name} not found")
|
||||
|
||||
|
||||
def get_scene_classes_from_module(module: types.ModuleType, include_imported: bool = False) -> list[type[Scene]]:
|
||||
def get_scene_classes_from_module(
|
||||
module: types.ModuleType, include_imported: bool = False
|
||||
) -> list[type[Scene]]:
|
||||
from ..scene.scene import Scene
|
||||
|
||||
|
||||
if include_imported:
|
||||
|
||||
def is_child_scene(obj: Any, module: types.ModuleType) -> bool:
|
||||
return (
|
||||
inspect.isclass(obj)
|
||||
|
|
@ -81,6 +84,7 @@ def get_scene_classes_from_module(module: types.ModuleType, include_imported: bo
|
|||
and not obj.__module__.startswith("manim.")
|
||||
)
|
||||
else:
|
||||
|
||||
def is_child_scene(obj: Any, module: types.ModuleType) -> bool:
|
||||
return (
|
||||
inspect.isclass(obj)
|
||||
|
|
@ -148,7 +152,10 @@ def prompt_user_for_choice(scene_classes: list[type[Scene]]) -> list[type[Scene]
|
|||
|
||||
@overload
|
||||
def scene_classes_from_file(
|
||||
file_path: Path, require_single_scene: bool, full_list: Literal[True], include_imported: bool = False
|
||||
file_path: Path,
|
||||
require_single_scene: bool,
|
||||
full_list: Literal[True],
|
||||
include_imported: bool = False,
|
||||
) -> list[type[Scene]]: ...
|
||||
|
||||
|
||||
|
|
@ -171,7 +178,10 @@ def scene_classes_from_file(
|
|||
|
||||
|
||||
def scene_classes_from_file(
|
||||
file_path: Path, require_single_scene: bool = False, full_list: bool = False, include_imported: bool = False
|
||||
file_path: Path,
|
||||
require_single_scene: bool = False,
|
||||
full_list: bool = False,
|
||||
include_imported: bool = False,
|
||||
) -> type[Scene] | list[type[Scene]]:
|
||||
module = get_module(file_path)
|
||||
all_scene_classes = get_scene_classes_from_module(module, include_imported)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue