A community-maintained Python framework for creating mathematical animations.
some fixes by PG
leotrs85e6b7987674
diff --git a/manim/__main__.py b/manim/__main__.pyindex 3be58a2b5..1fba10fa9 100644--- a/manim/__main__.py+++ b/manim/__main__.py@@ -61,14 +61,10 @@ def open_file_if_needed(file_writer):def is_child_scene(obj, module):- if (- not inspect.isclass(obj)- or not issubclass(obj, Scene)- or obj == Scene- or not obj.__module__.startswith(module.__name__)- ):- return False- return True+ return (inspect.isclass(obj)+ and issubclass(obj, Scene)+ and obj != Scene+ and obj.__module__.startswith(module.__name__))def prompt_user_for_choice(scene_classes):@@ -79,19 +75,13 @@ def prompt_user_for_choice(scene_classes):print("%d: %s" % (count, name))num_to_class[count] = scene_classtry:+ import reuser_input = input(constants.CHOOSE_NUMBER_MESSAGE)- return [- num_to_class[int(num_str)]- for num_str in user_input.split(",")- ]+ return [num_to_class[int(num_str)]+ for num_str in re.split(r"\s*,\s*", user_input.strip())]except KeyError:logger.error(constants.INVALID_NUMBER_MESSAGE)sys.exit(2)- user_input = input(constants.CHOOSE_NUMBER_MESSAGE)- return [- num_to_class[int(num_str)]- for num_str in user_input.split(",")- ]except EOFError:sys.exit(1)diff --git a/manim/config.py b/manim/config.pyindex 12f0ff424..67927d28b 100644--- a/manim/config.py+++ b/manim/config.py@@ -24,9 +24,6 @@ def _parse_config(config_parser, args):# By default, use the CLI section of the digested .cfg filesdefault = config_parser['CLI']- # This will be the final config dict exposed to the user- config = {}-# Handle the *_quality flags. These determine the section to read# and are stored in 'camera_config'. Note the highest resolution# passed as argument will be used.@@ -114,13 +111,12 @@ def _parse_file_writer_config(config_parser, args):for boolean_opt in ['preview', 'show_file_in_finder', 'quiet', 'sound','leave_progress_bars', 'write_to_movie', 'save_last_frame','save_pngs', 'save_as_gif', 'write_all']:+ attr = getattr(args, boolean_opt)config[boolean_opt] = (default.getboolean(boolean_opt)- if getattr(args, boolean_opt) is None- else getattr(args, boolean_opt))+ if attr is None else attr)for str_opt in ['media_dir', 'video_dir', 'tex_dir', 'text_dir']:- config[str_opt] = (default[str_opt]- if getattr(args, str_opt) is None- else getattr(args, str_opt))+ attr = getattr(args, str_opt)+ config[str_opt] = (default[str_opt] if attr is None else attr)# Handle the -t (--transparent) flag. This flag determines which# section to use from the .cfg file.