Skip to content

Commit

Permalink
implementing Jim's suggestion, disabling CI errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ohrechykha committed Sep 10, 2024
1 parent 6e8b6ee commit 36dfb42
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/ragged/_spec_set_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def unique_all(x: array, /) -> tuple[array, array, array, array]:
if isinstance(x, ragged.array):
if x.ndim == 0:
return unique_all_result(
values=ragged.array(x),
values=ragged.array(np.unique(x._impl)),
indices=ragged.array([0]),
inverse_indices=ragged.array([0]),
counts=ragged.array([1]),
)
else:
x_flat = ak.ravel(x._impl)
if isinstance(x_flat.layout, ak.contents.EmptyArray):
x_flat = ak.ravel(x._impl) # pylint: disable=W0212
if isinstance(x_flat.layout, ak.contents.EmptyArray): # pylint: disable=E1101
return unique_all_result(
values=ragged.array([]),
indices=ragged.array([]),
Expand Down Expand Up @@ -116,7 +116,7 @@ def unique_counts(x: array, /) -> tuple[array, array]:
if isinstance(x, ragged.array):
if x.ndim == 0:
return unique_counts_result(
values=ragged.array(x), counts=ragged.array([1])
values=ragged.array(np.unique(x._impl)), counts=ragged.array([1])
)
else:
x_flat = ak.ravel(x._impl)
Expand Down Expand Up @@ -162,7 +162,8 @@ def unique_inverse(x: array, /) -> tuple[array, array]:
if isinstance(x, ragged.array):
if x.ndim == 0:
return unique_inverse_result(
values=ragged.array(x), inverse_indices=ragged.array([0])
values=ragged.array(np.unique(x._impl)),
inverse_indices=ragged.array([0]),
)
else:
x_flat = ak.ravel(x._impl)
Expand Down Expand Up @@ -198,7 +199,7 @@ def unique_values(x: array, /) -> array:
"""
if isinstance(x, ragged.array):
if x.ndim == 0:
return ragged.array(x)
return ragged.array(np.unique(x._impl))

else:
x_flat = ak.ravel(x._impl)
Expand Down

0 comments on commit 36dfb42

Please sign in to comment.