Skip to content

Commit

Permalink
Allow multiple output functions to just return a tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwhite committed Sep 16, 2024
1 parent 887d802 commit 18ad533
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cubed/primitive/blockwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ def apply_blockwise(out_coords: List[int], *, config: BlockwiseSpec) -> None:
args.append(arg)

results = config.function(*args)
# if blockwise function is a regular function (not a generator) then make it iterable
if not inspect.isgeneratorfunction(config.function):
# if blockwise function is a regular function (not a generator) that doesn't return multiple values then make it iterable
if not inspect.isgeneratorfunction(config.function) and not isinstance(
results, tuple
):
results = (results,)
for i, result in enumerate(results):
out_chunk_key = key_to_slices(
Expand Down

0 comments on commit 18ad533

Please sign in to comment.