demessaging.cli module
Command-line options for the backend module.
Classes:
|
An |
Functions:
|
Generate the command line parser. |
|
Split a namespace into multiple namespaces. |
- class demessaging.cli.MessagingArgumentParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)[source]
Bases:
ArgumentParser
An
argparse.ArgumentParser
for the messaging framework.Methods:
parse_known_args
([args, namespace])
- demessaging.cli.get_parser(module_name: str = '__main__', config: ModuleConfig | None = None) ArgumentParser [source]
Generate the command line parser.
- demessaging.cli.split_namespace(ns: Namespace) Tuple[Namespace, Dict[str, Namespace]] [source]
Split a namespace into multiple namespaces.
This utility function takes a namespace and looks for attributes with a
.
inside. These are then splitted and returned as the second attribute.Example
Consider the following namespace:
>>> from argparse import Namespace >>> ns = Namespace(**{"main": 1, "sub.main": 2}) >>> split_namespace(ns) (Namespace(main=1), {'sub': Namespace(main=2)})