If either default or default_factory are set, then both the field and the generated
command-line arguments are optional. Otherwise, both are required.
Negative flags are generated using negative_prefix and negative_option:
When negative_option is passed, it is used to create the negative flag.
Otherwise, negative_prefix is prepended to the field name to create the negative flag.
NOTE: The negative flags don't accept a value. (i.e. --noverbose works, but
--noverbose=True does not.)
The positive flags can be used either with or without a value.
"""
Breaking changes:
Make it invalid to use nargs not in {"?", None} for single boolean fields
Rework and refactor the BooleanOptionalAction class.
Overhaul of the
flag
function:negative_prefix
andnegative_option
arguments to theflag
function.default=True
behaviour of setting the opposite of the default valueIf either
default
ordefault_factory
are set, then both the field and the generated command-line arguments are optional. Otherwise, both are required.Negative flags are generated using
negative_prefix
andnegative_option
:negative_option
is passed, it is used to create the negative flag.negative_prefix
is prepended to the field name to create the negative flag.NOTE: The negative flags don't accept a value. (i.e.
--noverbose
works, but--noverbose=True
does not.) The positive flags can be used either with or without a value. """Breaking changes:
nargs not in {"?", None}
for single boolean fieldsBooleanOptionalAction
class.Signed-off-by: Fabrice Normandin fabrice.normandin@gmail.com