cohydra.argparse¶
Argument parsing for the simulation.
Classes
A simple-to-use argument parser for log levels. |
-
class
cohydra.argparse.
ArgumentParser
(prog=None, usage=None, description=None, epilog=None, version=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True)[source]¶ Bases:
argparse.ArgumentParser
A simple-to-use argument parser for log levels.
ArgumentParser by default defines the –verbose and –log-level flag. It is used to abstract these flags away and prevent repetition in the example scenarios. –verbose sets the overall log level to DEBUG. Valid options for log-level are INFO and DEBUG.
- Parameters
logger (str) – The name of the logger argument to pass to the main function.
-
run
(main, setup_logging=True, logger_arg=None)[source]¶ Parse the arguments and pass them to a function to be called afterwards
- Parameters
main (callable) – The function to call and to pass the arguments to.
setup_logging (bool) – Whether to set up logging with the default python logger and parse log levels.
logger_arg (string) – The name of the argument to pass the logger to the
main
function.
-
add_argument
(dest, ..., name=value, ...)¶ add_argument(option_string, option_string, …, name=value, …)
-
add_argument_group
(*args, **kwargs)¶
-
add_mutually_exclusive_group
(**kwargs)¶
-
error
(message: string)[source]¶ Prints a usage message incorporating the message to stderr and exits.
If you override this in a subclass, it should not return – it should either exit or raise an exception.
-
get_default
(dest)¶
-
register
(registry_name, value, object)¶
-
set_defaults
(**kwargs)¶
Inheritance Diagramm