Runtime Arguments Container¶
- class Arguments(*args, parent=None, strict_keys=True, silent_strict=False, typing_with_value=False)
Purpose¶
Arguments is a mutable mapping of Argument definitions and their
values.
Key methods¶
validate(key, value, throw=True)Validate a key/value pair.
arguments.validate("count", 2)
at(index, in_keywords=False)Return an argument by order.
arguments.at(0)
get_arg(key),set_arg(arg)Work with the stored argument definitions directly.
set(key, value)Set a value, optionally creating a new definition when strict keys are off.
arguments.set("name", "erik")
ensure_defaults(**kwargs)Guarantee defaults for certain keys.
arguments.ensure_defaults(extra=2)
remove(key)Remove and return one argument definition.
iter_keywords()/iter_positionals()Iterate stored keys by category.
Behavior notes¶
When strict_keys is False, unknown keys can create new runtime argument
definitions on the fly.