onyo.argparse_helpers module
- class onyo.argparse_helpers.StoreMultipleKeyValuePairs(option_strings, dest, nargs=None, **kwargs)[source]
Bases:
ActionStore a list of dictionaries of key-value pairs.
See also
- __call__(parser, namespace, key_values, option_string=None)[source]
Turn a list of ‘KEY=VALUE’ pairs into a list of dictionaries.
Each KEY can be defined either 1 or N times (where N is the number of dictionaries to be created).
A KEY that is declared once will apply to all dictionaries.
All KEYs appearing N times must appear the same number of times. If not, a message will print to standard error and the program will exit with status code 2.
- Parameters:
parser (
ArgumentParser)namespace (
Namespace)key_values (
list[str]) – List of strings containing key-value pairs.option_string (
str|None(default:None))
- Return type:
None
- class onyo.argparse_helpers.StoreSingleKeyValuePairs(option_strings, dest, nargs=None, **kwargs)[source]
Bases:
ActionStore a dictionary of key-value pairs.
See also
- __call__(parser, namespace, key_values, option_string=None)[source]
Turn a list of ‘KEY=VALUE’ pairs into a dictionary.
Each KEY can be defined once. If defined more than once, a message will print to standard error and the program will exit with status code 2.
- Parameters:
parser (
ArgumentParser)namespace (
Namespace)key_values (
list[str]) – List of strings containing key-value pairs.option_string (
str|None(default:None))
- Return type:
None