Skip to content

Commit

Permalink
fixed up bug I just introduced
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Jul 17, 2023
1 parent 7c254b6 commit e4041a7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pydra/utils/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,15 @@ def expand_pattern(t):
origin = get_origin(t)
if origin is None:
return t
if origin not in (ty.Union, type):
if not any(issubclass(origin, t) for t in (ty.Mapping, ty.Sequence)):
# Don't know what to do with type arguments so just return original type
return t
args = get_args(t)

Check warning on line 110 in pydra/utils/typing.py

View check run for this annotation

Codecov / codecov/patch

pydra/utils/typing.py#L109-L110

Added lines #L109 - L110 were not covered by tests
if not args or args == (Ellipsis,): # Not sure Ellipsis by itself is valid
# If no args were provided, or those arguments were an ellipsis
assert isinstance(origin, type)
return origin

Check warning on line 114 in pydra/utils/typing.py

View check run for this annotation

Codecov / codecov/patch

pydra/utils/typing.py#L113-L114

Added lines #L113 - L114 were not covered by tests
if origin not in (ty.Union, type) or any(
issubclass(origin, t) for t in (ty.Mapping, ty.Sequence)
):
# Don't know what to do with type arguments so just return original type
return t
return (origin, [expand_pattern(a) for a in args])

self.tp = tp
Expand Down

0 comments on commit e4041a7

Please sign in to comment.