From 51a0e3f2b9d96a4f369c6d39dc5bd87e149c9136 Mon Sep 17 00:00:00 2001 From: Ghislain Vaillant Date: Tue, 21 Mar 2023 22:52:35 +0100 Subject: [PATCH 1/2] FIX: Allow any iterable for ShellOutSpec requires --- pydra/engine/specs.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pydra/engine/specs.py b/pydra/engine/specs.py index af152f6f8..cf6e50f3c 100644 --- a/pydra/engine/specs.py +++ b/pydra/engine/specs.py @@ -636,11 +636,12 @@ def _check_requires(self, fld, inputs): if "requires" in fld.metadata: # if requires is a list of list it is treated as el[0] OR el[1] OR... - if all([isinstance(el, list) for el in fld.metadata["requires"]]): - field_required_OR = fld.metadata["requires"] + required_fields = list(fld.metadata["requires"]) + if all([isinstance(el, list) for el in required_fields]): + field_required_OR = required_fields # if requires is a list of tuples/strings - I'm creating a 1-el nested list - elif all([isinstance(el, (str, tuple)) for el in fld.metadata["requires"]]): - field_required_OR = [fld.metadata["requires"]] + elif all([isinstance(el, (str, tuple)) for el in required_fields]): + field_required_OR = [required_fields] else: raise Exception( f"requires field can be a list of list, or a list " From d061b35fc609b65665c7bce2a01f96fe5474454b Mon Sep 17 00:00:00 2001 From: Ghislain Vaillant Date: Thu, 23 Mar 2023 15:44:22 +0100 Subject: [PATCH 2/2] REF: Use ensure_list instead of list for the str case Co-authored-by: Chris Markiewicz --- pydra/engine/specs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydra/engine/specs.py b/pydra/engine/specs.py index cf6e50f3c..a1fc2d6ad 100644 --- a/pydra/engine/specs.py +++ b/pydra/engine/specs.py @@ -636,7 +636,7 @@ def _check_requires(self, fld, inputs): if "requires" in fld.metadata: # if requires is a list of list it is treated as el[0] OR el[1] OR... - required_fields = list(fld.metadata["requires"]) + required_fields = ensure_list(fld.metadata["requires"]) if all([isinstance(el, list) for el in required_fields]): field_required_OR = required_fields # if requires is a list of tuples/strings - I'm creating a 1-el nested list