parse_keyword_list(options,
exit_on_error=True)
|
|
Adds keystring and keydict properties to the argparse options object
that are the list of keyword arguments turned into, respectively, a
string or a dictionary. Valid keyword syntax is checked for.
Typical usage:
jobutils.add_keyword_parser_argument(parser) options =
parser.parse_args(args) jobutils.parse_keyword_list(options) print
options.keystring, options.keydict
- Parameters:
options (argparse.Namespace ) - The parser Namespace object with a keywords attribute
exit_on_error (bool) - True if the ValueError for keyword syntax should result in a
message being printed and sys.exit() being called, False if the
error should just be raised.
- Raises:
ValueError - If an invalid keyword pair syntax is detected and handle_error is
False
|