tools: fix default for SinglePropertyAction

For positional arguments default is sent to __call__ even when not
provided on command line. Exclude it in SinglePropertyAction, since
"default" value is really meant for 'properties' attribute, not
individual property.
This commit is contained in:
Marek Marczykowski-Górecki 2017-04-28 02:07:12 +02:00
parent 984ea09cef
commit 4113651f01
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -107,6 +107,9 @@ class SinglePropertyAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
if values is self.default and self.default == {}:
return
properties = getattr(namespace, self.dest)
# copy it, to not modify _mutable_ self.default
if not properties: