From 3a7ad05f18fb68426e3a48d0fe667ea98968c9f0 Mon Sep 17 00:00:00 2001 From: Martin Craig <martin.craig@eng.ox.ac.uk> Date: Tue, 10 Jul 2018 13:12:53 +0100 Subject: [PATCH] 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. --- fsl/wrappers/wrapperutils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fsl/wrappers/wrapperutils.py b/fsl/wrappers/wrapperutils.py index 39339e18f..a4ed4d4a7 100644 --- a/fsl/wrappers/wrapperutils.py +++ b/fsl/wrappers/wrapperutils.py @@ -299,11 +299,12 @@ def applyArgStyle(style, valsep=None, argmap=None, valmap=None, singlechar_args= for k, v in kwargs.items(): + if v is None: continue + k = argmap.get(k, k) mapv = valmap.get(k, fmtval(v)) k = fmtarg(k) - if mapv in (SHOW_IF_TRUE, HIDE_IF_TRUE): if (mapv is SHOW_IF_TRUE and v) or \ (mapv is HIDE_IF_TRUE and not v): @@ -621,6 +622,7 @@ class _FileOrThing(object): val = allargs.get(name, None) if val is None: + allargs.pop(name, None) continue if val is LOAD: -- GitLab