Skip to content
Snippets Groups Projects
Commit 3a7ad05f authored by Martin Craig's avatar Martin Craig
Browse files

Arguments given as None are ignored

It's often helpful to be able to leave an argument as None and only set it
if you want to use it.
parent 9eb11443
No related branches found
No related tags found
No related merge requests found
...@@ -299,11 +299,12 @@ def applyArgStyle(style, valsep=None, argmap=None, valmap=None, singlechar_args= ...@@ -299,11 +299,12 @@ def applyArgStyle(style, valsep=None, argmap=None, valmap=None, singlechar_args=
for k, v in kwargs.items(): for k, v in kwargs.items():
if v is None: continue
k = argmap.get(k, k) k = argmap.get(k, k)
mapv = valmap.get(k, fmtval(v)) mapv = valmap.get(k, fmtval(v))
k = fmtarg(k) k = fmtarg(k)
if mapv in (SHOW_IF_TRUE, HIDE_IF_TRUE): if mapv in (SHOW_IF_TRUE, HIDE_IF_TRUE):
if (mapv is SHOW_IF_TRUE and v) or \ if (mapv is SHOW_IF_TRUE and v) or \
(mapv is HIDE_IF_TRUE and not v): (mapv is HIDE_IF_TRUE and not v):
...@@ -621,6 +622,7 @@ class _FileOrThing(object): ...@@ -621,6 +622,7 @@ class _FileOrThing(object):
val = allargs.get(name, None) val = allargs.get(name, None)
if val is None: if val is None:
allargs.pop(name, None)
continue continue
if val is LOAD: if val is LOAD:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment