marvis.argparse

Argument parsing for the simulation.

Classes

ArgumentParser

A simple-to-use argument parser for log levels.


class marvis.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, ...) None
add_argument_group(*args, **kwargs)
add_mutually_exclusive_group(**kwargs)
add_subparsers(**kwargs)[source]
convert_arg_line_to_args(arg_line)[source]
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.

exit(status=0, message=None)[source]
format_help()[source]
format_usage()[source]
format_version()[source]
get_default(dest)
parse_args(args=None, namespace=None)[source]
parse_known_args(args=None, namespace=None)[source]
print_help(file=None)[source]
print_usage(file=None)[source]
print_version(file=None)[source]
register(registry_name, value, object)
set_defaults(**kwargs)

Inheritance Diagramm

Inheritance diagram of marvis.argparse