Skip to content

Commit 1c6ac97

Browse files
committed
allow sequence types for fields with requires (can be empty)
1 parent 47c3958 commit 1c6ac97

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pydra/compose/base/field.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,12 @@ def mandatory(self):
229229

230230
@requires.validator
231231
def _requires_validator(self, _, value):
232-
if value and self.type not in (ty.Any, bool) and not is_optional(self.type):
232+
if (
233+
value
234+
and self.type not in (ty.Any, bool)
235+
and not is_optional(self.type)
236+
and not issubclass(self.type, ty.Sequence)
237+
):
233238
raise ValueError(
234239
f"Fields with requirements must be of optional type (i.e. in union "
235240
f"with None) or boolean, not type {self.type} ({self!r})"

0 commit comments

Comments
 (0)