osc_lib.cli.parseractions
Module¶argparse Custom Actions
osc_lib.cli.parseractions.
KeyValueAction
(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶Bases: argparse.Action
A custom action to parse arguments as key=value pairs
Ensures that dest
is a dict
osc_lib.cli.parseractions.
MultiKeyValueAction
(option_strings, dest, nargs=None, required_keys=None, optional_keys=None, **kwargs)¶Bases: argparse.Action
A custom action to parse arguments as key1=value1,key2=value2 pairs
Ensure that dest
is a list. The list will finally contain multiple
dicts, with key=value pairs in them.
NOTE: The arguments string should be a comma separated key-value pairs. And comma(‘,’) and equal(‘=’) may not be used in the key or value.
osc_lib.cli.parseractions.
MultiKeyValueCommaAction
(option_strings, dest, nargs=None, required_keys=None, optional_keys=None, **kwargs)¶Bases: osc_lib.cli.parseractions.MultiKeyValueAction
Custom action to parse arguments from a set of key=value pair
Ensures that dest
is a dict.
Parses dict by separating comma separated string into individual values
Ex. key1=val1,val2,key2=val3 => {“key1”: “val1,val2”, “key2”: “val3”}
osc_lib.cli.parseractions.
NonNegativeAction
(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶Bases: argparse.Action
A custom action to check whether the value is non-negative or not
Ensures the value is >= 0.
osc_lib.cli.parseractions.
RangeAction
(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)¶Bases: argparse.Action
A custom action to parse a single value or a range of values
Parses single integer values or a range of integer values delimited
by a colon and returns a tuple of integers:
‘4’ sets dest
to (4, 4)
‘6:9’ sets dest
to (6, 9)
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.