Skip to content

Commit 9c1a0d5

Browse files
committed
fixed up case where type to coerce to is iterable
1 parent e4041a7 commit 9c1a0d5

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pydra/utils/typing.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,6 @@ def expand_pattern(t):
103103
origin = get_origin(t)
104104
if origin is None:
105105
return t
106-
if origin not in (ty.Union, type):
107-
if not any(issubclass(origin, t) for t in (ty.Mapping, ty.Sequence)):
108-
# Don't know what to do with type arguments so just return original type
109-
return t
110106
args = get_args(t)
111107
if not args or args == (Ellipsis,): # Not sure Ellipsis by itself is valid
112108
# If no args were provided, or those arguments were an ellipsis
@@ -190,7 +186,7 @@ def expand_and_coerce(obj, pattern: ty.Union[type, tuple]):
190186
) from e
191187
if issubclass(origin, ty.Tuple):
192188
return coerce_tuple(type_, obj_args, pattern_args)
193-
if issubclass(origin, ty.Sequence):
189+
if issubclass(origin, ty.Iterable):
194190
return coerce_sequence(type_, obj_args, pattern_args)
195191
else:
196192
assert (

0 commit comments

Comments
 (0)