A community-maintained Python framework for creating mathematical animations.
Added some docstrings for added methods.
Aathishfa718a489271
diff --git a/manim/utils/cfg_subcmds.py b/manim/utils/cfg_subcmds.pyindex 6c26820a6..9e172e3c6 100644--- a/manim/utils/cfg_subcmds.py+++ b/manim/utils/cfg_subcmds.py@@ -27,6 +27,16 @@ console = Console()def value_from_string(value):+ """Extracts the literal of proper datatype from a string.+ Parameters+ ----------+ value : :class:`str`+ The value to check get the literal from.+ Returns+ -------+ Union[:class:`str`, :class:`int`, :class:`bool`]+ Returns whether it is valid style or not according to rich.+ """try:value = literal_eval(value)except (SyntaxError, ValueError):@@ -35,6 +45,24 @@ def value_from_string(value):def _is_expected_datatype(value, expected, style=False):+ """Checks whether `value` is the same datatype as `expected`,+ and checks if it is a valid `style` if `style` is true.++ Parameters+ ----------+ value : :class:`str`+ The string of the value to check (obtained from reading the user input).+ expected : :class:`str`+ The string of the literal datatype must be matched by `value`. Obtained from+ reading the cfg file.+ style : Optional[:class:`bool`], optional+ Whether or not to confirm if `value` is a style, by default False++ Returns+ -------+ :class:`bool`+ Whether or not `value` matches the datatype of `expected`.+ """value = value_from_string(value)expected = type(value_from_string(expected))diff --git a/manim/utils/config_utils.py b/manim/utils/config_utils.pyindex 45ae02b4c..a30db759c 100644--- a/manim/utils/config_utils.py+++ b/manim/utils/config_utils.py@@ -475,12 +475,12 @@ def _subcommand_name(ignore=[]):Parameters----------- ignore : list, optional+ ignore : Optional[:class:`list`]List of NON_ANIM_UTILS to ignore when searching for subcommands, by default []Returns-------- str, None+ Union[:class:`str`, :class:`None`]If a subcommand is found, returns the string of its name. Returns None if nosubcommand is found."""@@ -507,6 +507,18 @@ def _subcommand_name(ignore=[]):def _init_cfg_subcmd(subparsers):+ """Initialises the subparser for the `cfg` subcommand.++ Parameters+ ----------+ subparsers : :class:`argparse._SubParsersAction`+ The subparser object for which to add the sub-subparser for the cfg subcommand.++ Returns+ -------+ :class:`argparse.ArgumentParser`+ The parser that parser anything cfg subcommand related.+ """cfg_related = subparsers.add_parser("cfg",)cfg_subparsers = cfg_related.add_subparsers(dest="cfg_subcommand")