Skip to content

Commit

Permalink
bring back old branch necessary for awkward < 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasdavis committed Nov 2, 2023
1 parent c6f6e0b commit c353ac6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/dask_awkward/lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,8 @@ def _is_numpy_or_cupy_like(arr: Any) -> bool:
def _finalize_array(results: Sequence[Any]) -> Any:
# special cases for length 1 results
if len(results) == 1:
if isinstance(results[0], (int, ak.Array)) or _is_numpy_or_cupy_like(
results[0]
):
np_like = _is_numpy_or_cupy_like(results[0])
if isinstance(results[0], (int, ak.Array)) or np_like: # type: ignore[unreachable]
return results[0]

# a sequence of arrays that need to be concatenated.
Expand All @@ -562,6 +561,12 @@ def _finalize_array(results: Sequence[Any]) -> Any:
):
return ak.Array(list(results))

# in awkward < 2.5 we can get integers instead of np.array scalars
elif isinstance(results, (tuple, list)) and all(
isinstance(r, (int, np.integer)) for r in results
):
return ak.Array(list(results))

# sometimes all partition results will be None (some write-to-disk
# operations)
elif all(r is None for r in results):
Expand Down

0 comments on commit c353ac6

Please sign in to comment.