@@ -68,7 +68,7 @@ class ShardingCodecIndexLocation(Enum):
6868 end = "end"
6969
7070
71- def parse_index_location (data : JSON ) -> ShardingCodecIndexLocation :
71+ def parse_index_location (data : object ) -> ShardingCodecIndexLocation :
7272 return parse_enum (data , ShardingCodecIndexLocation )
7373
7474
@@ -333,7 +333,7 @@ def __init__(
333333 chunk_shape : ChunkCoordsLike ,
334334 codecs : Iterable [Codec | dict [str , JSON ]] = (BytesCodec (),),
335335 index_codecs : Iterable [Codec | dict [str , JSON ]] = (BytesCodec (), Crc32cCodec ()),
336- index_location : ShardingCodecIndexLocation = ShardingCodecIndexLocation .end ,
336+ index_location : ShardingCodecIndexLocation | str = ShardingCodecIndexLocation .end ,
337337 ) -> None :
338338 chunk_shape_parsed = parse_shapelike (chunk_shape )
339339 codecs_parsed = parse_codecs (codecs )
@@ -373,16 +373,16 @@ def from_dict(cls, data: dict[str, JSON]) -> Self:
373373
374374 @property
375375 def codec_pipeline (self ) -> CodecPipeline :
376- return get_pipeline_class ().from_list (self .codecs )
376+ return get_pipeline_class ().from_codecs (self .codecs )
377377
378378 def to_dict (self ) -> dict [str , JSON ]:
379379 return {
380380 "name" : "sharding_indexed" ,
381381 "configuration" : {
382- "chunk_shape" : list ( self .chunk_shape ) ,
383- "codecs" : [s .to_dict () for s in self .codecs ],
384- "index_codecs" : [s .to_dict () for s in self .index_codecs ],
385- "index_location" : self .index_location ,
382+ "chunk_shape" : self .chunk_shape ,
383+ "codecs" : tuple ( [s .to_dict () for s in self .codecs ]) ,
384+ "index_codecs" : tuple ( [s .to_dict () for s in self .index_codecs ]) ,
385+ "index_location" : self .index_location . value ,
386386 },
387387 }
388388
@@ -620,7 +620,7 @@ async def _decode_shard_index(
620620 index_array = next (
621621 iter (
622622 await get_pipeline_class ()
623- .from_list (self .index_codecs )
623+ .from_codecs (self .index_codecs )
624624 .decode (
625625 [(index_bytes , self ._get_index_chunk_spec (chunks_per_shard ))],
626626 )
@@ -633,7 +633,7 @@ async def _encode_shard_index(self, index: _ShardIndex) -> Buffer:
633633 index_bytes = next (
634634 iter (
635635 await get_pipeline_class ()
636- .from_list (self .index_codecs )
636+ .from_codecs (self .index_codecs )
637637 .encode (
638638 [
639639 (
@@ -651,7 +651,7 @@ async def _encode_shard_index(self, index: _ShardIndex) -> Buffer:
651651 def _shard_index_size (self , chunks_per_shard : ChunkCoords ) -> int :
652652 return (
653653 get_pipeline_class ()
654- .from_list (self .index_codecs )
654+ .from_codecs (self .index_codecs )
655655 .compute_encoded_size (
656656 16 * product (chunks_per_shard ), self ._get_index_chunk_spec (chunks_per_shard )
657657 )
0 commit comments