1313if TYPE_CHECKING :
1414 from typing_extensions import Self
1515
16- from zarr .common import ArraySpec , SliceSelection
16+ from zarr .common import ArraySpec
17+ from zarr .indexing import SelectorTuple
1718 from zarr .metadata import ArrayMetadata
1819
1920
@@ -155,21 +156,21 @@ class ArrayBytesCodecPartialDecodeMixin:
155156 """Mixin for array-to-bytes codecs that implement partial decoding."""
156157
157158 async def _decode_partial_single (
158- self , byte_getter : ByteGetter , selection : SliceSelection , chunk_spec : ArraySpec
159+ self , byte_getter : ByteGetter , selection : SelectorTuple , chunk_spec : ArraySpec
159160 ) -> NDBuffer | None :
160161 raise NotImplementedError
161162
162163 async def decode_partial (
163164 self ,
164- batch_info : Iterable [tuple [ByteGetter , SliceSelection , ArraySpec ]],
165+ batch_info : Iterable [tuple [ByteGetter , SelectorTuple , ArraySpec ]],
165166 ) -> Iterable [NDBuffer | None ]:
166167 """Partially decodes a batch of chunks.
167168 This method determines parts of a chunk from the slice selection,
168169 fetches these parts from the store (via ByteGetter) and decodes them.
169170
170171 Parameters
171172 ----------
172- batch_info : Iterable[tuple[ByteGetter, SliceSelection , ArraySpec]]
173+ batch_info : Iterable[tuple[ByteGetter, SelectorTuple , ArraySpec]]
173174 Ordered set of information about slices of encoded chunks.
174175 The slice selection determines which parts of the chunk will be fetched.
175176 The ByteGetter is used to fetch the necessary bytes.
@@ -196,14 +197,14 @@ async def _encode_partial_single(
196197 self ,
197198 byte_setter : ByteSetter ,
198199 chunk_array : NDBuffer ,
199- selection : SliceSelection ,
200+ selection : SelectorTuple ,
200201 chunk_spec : ArraySpec ,
201202 ) -> None :
202203 raise NotImplementedError
203204
204205 async def encode_partial (
205206 self ,
206- batch_info : Iterable [tuple [ByteSetter , NDBuffer , SliceSelection , ArraySpec ]],
207+ batch_info : Iterable [tuple [ByteSetter , NDBuffer , SelectorTuple , ArraySpec ]],
207208 ) -> None :
208209 """Partially encodes a batch of chunks.
209210 This method determines parts of a chunk from the slice selection, encodes them and
@@ -213,7 +214,7 @@ async def encode_partial(
213214
214215 Parameters
215216 ----------
216- batch_info : Iterable[tuple[ByteSetter, NDBuffer, SliceSelection , ArraySpec]]
217+ batch_info : Iterable[tuple[ByteSetter, NDBuffer, SelectorTuple , ArraySpec]]
217218 Ordered set of information about slices of to-be-encoded chunks.
218219 The slice selection determines which parts of the chunk will be encoded.
219220 The ByteSetter is used to write the necessary bytes and fetch bytes for existing chunk data.
@@ -342,15 +343,16 @@ async def encode(
342343 @abstractmethod
343344 async def read (
344345 self ,
345- batch_info : Iterable [tuple [ByteGetter , ArraySpec , SliceSelection , SliceSelection ]],
346+ batch_info : Iterable [tuple [ByteGetter , ArraySpec , SelectorTuple , SelectorTuple ]],
346347 out : NDBuffer ,
348+ drop_axes : tuple [int , ...] = (),
347349 ) -> None :
348350 """Reads chunk data from the store, decodes it and writes it into an output array.
349351 Partial decoding may be utilized if the codecs and stores support it.
350352
351353 Parameters
352354 ----------
353- batch_info : Iterable[tuple[ByteGetter, ArraySpec, SliceSelection, SliceSelection ]]
355+ batch_info : Iterable[tuple[ByteGetter, ArraySpec, SelectorTuple, SelectorTuple ]]
354356 Ordered set of information about the chunks.
355357 The first slice selection determines which parts of the chunk will be fetched.
356358 The second slice selection determines where in the output array the chunk data will be written.
@@ -363,16 +365,17 @@ async def read(
363365 @abstractmethod
364366 async def write (
365367 self ,
366- batch_info : Iterable [tuple [ByteSetter , ArraySpec , SliceSelection , SliceSelection ]],
368+ batch_info : Iterable [tuple [ByteSetter , ArraySpec , SelectorTuple , SelectorTuple ]],
367369 value : NDBuffer ,
370+ drop_axes : tuple [int , ...] = (),
368371 ) -> None :
369372 """Encodes chunk data and writes it to the store.
370373 Merges with existing chunk data by reading first, if necessary.
371374 Partial encoding may be utilized if the codecs and stores support it.
372375
373376 Parameters
374377 ----------
375- batch_info : Iterable[tuple[ByteSetter, ArraySpec, SliceSelection, SliceSelection ]]
378+ batch_info : Iterable[tuple[ByteSetter, ArraySpec, SelectorTuple, SelectorTuple ]]
376379 Ordered set of information about the chunks.
377380 The first slice selection determines which parts of the chunk will be encoded.
378381 The second slice selection determines where in the value array the chunk data is located.
0 commit comments