8
8
9
9
from zarr .abc .metadata import Metadata
10
10
from zarr .abc .store import ByteGetter , ByteSetter
11
- from zarr .buffer import Buffer , NDBuffer
12
- from zarr .chunk_grids import ChunkGrid
13
- from zarr .common import ChunkCoords , concurrent_map
14
- from zarr .config import config
11
+ from zarr .core . buffer import Buffer , NDBuffer
12
+ from zarr .core . chunk_grids import ChunkGrid
13
+ from zarr .core . common import ChunkCoords , concurrent_map
14
+ from zarr .core . config import config
15
15
16
16
if TYPE_CHECKING :
17
17
from typing_extensions import Self
18
18
19
- from zarr .array_spec import ArraySpec
20
- from zarr .common import JSON
21
- from zarr .indexing import SelectorTuple
19
+ from zarr .core .array_spec import ArraySpec
20
+ from zarr .core .common import JSON
21
+ from zarr .core .indexing import SelectorTuple
22
+
23
+ __all__ = [
24
+ "CodecInput" ,
25
+ "CodecOutput" ,
26
+ "ArrayArrayCodec" ,
27
+ "ArrayBytesCodec" ,
28
+ "BytesBytesCodec" ,
29
+ "ArrayBytesCodecPartialDecodeMixin" ,
30
+ "ArrayBytesCodecPartialEncodeMixin" ,
31
+ "CodecPipeline" ,
32
+ ]
22
33
23
34
CodecInput = TypeVar ("CodecInput" , bound = NDBuffer | Buffer )
24
35
CodecOutput = TypeVar ("CodecOutput" , bound = NDBuffer | Buffer )
@@ -112,7 +123,7 @@ async def decode(
112
123
-------
113
124
Iterable[CodecInput | None]
114
125
"""
115
- return await batching_helper (self ._decode_single , chunks_and_specs )
126
+ return await _batching_helper (self ._decode_single , chunks_and_specs )
116
127
117
128
async def _encode_single (
118
129
self , chunk_data : CodecInput , chunk_spec : ArraySpec
@@ -135,7 +146,7 @@ async def encode(
135
146
-------
136
147
Iterable[CodecOutput | None]
137
148
"""
138
- return await batching_helper (self ._encode_single , chunks_and_specs )
149
+ return await _batching_helper (self ._encode_single , chunks_and_specs )
139
150
140
151
141
152
class ArrayArrayCodec (_Codec [NDBuffer , NDBuffer ]):
@@ -401,18 +412,18 @@ def from_dict(cls, data: Iterable[JSON | Codec]) -> Self:
401
412
return cls (** data )
402
413
403
414
404
- async def batching_helper (
415
+ async def _batching_helper (
405
416
func : Callable [[CodecInput , ArraySpec ], Awaitable [CodecOutput | None ]],
406
417
batch_info : Iterable [tuple [CodecInput | None , ArraySpec ]],
407
418
) -> list [CodecOutput | None ]:
408
419
return await concurrent_map (
409
420
list (batch_info ),
410
- noop_for_none (func ),
421
+ _noop_for_none (func ),
411
422
config .get ("async.concurrency" ),
412
423
)
413
424
414
425
415
- def noop_for_none (
426
+ def _noop_for_none (
416
427
func : Callable [[CodecInput , ArraySpec ], Awaitable [CodecOutput | None ]],
417
428
) -> Callable [[CodecInput | None , ArraySpec ], Awaitable [CodecOutput | None ]]:
418
429
async def wrap (chunk : CodecInput | None , chunk_spec : ArraySpec ) -> CodecOutput | None :
0 commit comments