Skip to content

Commit 26f63a3

Browse files
committed
Revert "normalize in codec_pipeline"
This reverts commit 234431cd6efb661c53e2a832a0e4ea4dca772c1b.
1 parent e178492 commit 26f63a3

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

src/zarr/core/codec_pipeline.py

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,6 @@
3535
U = TypeVar("U")
3636

3737

38-
def normalize_slices(
39-
idxr: tuple[int | slice, ...], shape: tuple[int, ...]
40-
) -> tuple[int | slice, ...]:
41-
# replace slice objects with stop==None with size
42-
out = []
43-
for i, size in zip(idxr, shape, strict=False):
44-
if not isinstance(i, slice):
45-
out.append(i)
46-
continue
47-
if i.step not in [1, None] or i.start not in [0, None]:
48-
out.append(i)
49-
continue
50-
out.append(slice(i.start, i.stop if i.stop is not None else size, i.step))
51-
return tuple(out)
52-
53-
5438
def _unzip2(iterable: Iterable[tuple[T, U]]) -> tuple[list[T], list[U]]:
5539
out0: list[T] = []
5640
out1: list[U] = []
@@ -295,10 +279,7 @@ async def read_batch(
295279
chunk_array_batch, batch_info, strict=False
296280
):
297281
if chunk_array is not None:
298-
normalized_selection = normalize_slices(
299-
chunk_selection, out[out_selection].shape
300-
)
301-
tmp = chunk_array[normalized_selection]
282+
tmp = chunk_array[chunk_selection]
302283
if drop_axes != ():
303284
tmp = tmp.squeeze(axis=drop_axes)
304285
out[out_selection] = tmp
@@ -341,9 +322,7 @@ def _merge_chunk_array(
341322
for idx in range(chunk_spec.ndim)
342323
)
343324
chunk_value = chunk_value[item]
344-
345-
normalized_selection = normalize_slices(chunk_selection, chunk_value.shape)
346-
chunk_array[normalized_selection] = chunk_value
325+
chunk_array[chunk_selection] = chunk_value
347326
return chunk_array
348327

349328
async def write_batch(

0 commit comments

Comments
 (0)