From 53a437440605ea0df8c6f80774137e07906779b1 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Mon, 3 Aug 2020 11:18:33 +0100 Subject: [PATCH 1/2] Removed line that excluded fields parameter during export. --- nipype/pipeline/engine/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index d7a65b74de..3d0f078e35 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -365,7 +365,6 @@ def format_node(node, format="python", include_config=False): comment = "# Node: %s" % node.fullname spec = signature(node.interface.__init__) args = [p.name for p in list(spec.parameters.values())] - args = args[1:] if args: filled_args = [] for arg in args: From 8a67fbeabfa1cb57829231c1b91e2d2cb7db5222 Mon Sep 17 00:00:00 2001 From: Matteo Mancini Date: Mon, 3 Aug 2020 11:23:50 +0100 Subject: [PATCH 2/2] Added if statement to correctly handle strings and list during export. --- nipype/pipeline/engine/utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index 3d0f078e35..6f73d62189 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -369,9 +369,15 @@ def format_node(node, format="python", include_config=False): filled_args = [] for arg in args: if hasattr(node.interface, "_%s" % arg): - filled_args.append( - "%s=%s" % (arg, getattr(node.interface, "_%s" % arg)) - ) + argval = getattr(node.interface, "_%s" % arg) + if isinstance(argval, str): + filled_args.append( + "%s='%s'" % (arg, argval) + ) + else: + filled_args.append( + "%s=%s" % (arg, argval) + ) args = ", ".join(filled_args) else: args = ""