File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ Widen ` ChunksLike ` type alias to use ` Iterable ` instead of ` Sequence ` , and also
2+ remove ` None ` from the type union. This supports a broader range of types,
3+ removing the necessity to "materialize" iterable values simply to satisfy type
4+ annotations. It also allows use of ` ChunksLike ` in cases where ` None ` should
5+ not be permitted.
Original file line number Diff line number Diff line change @@ -4397,11 +4397,8 @@ async def init_array(
43974397 chunk_key_encoding , zarr_format = zarr_format
43984398 )
43994399
4400- if overwrite :
4401- if store_path .store .supports_deletes :
4402- await store_path .delete_dir ()
4403- else :
4404- await ensure_no_existing_node (store_path , zarr_format = zarr_format )
4400+ if overwrite and store_path .store .supports_deletes :
4401+ await store_path .delete_dir ()
44054402 else :
44064403 await ensure_no_existing_node (store_path , zarr_format = zarr_format )
44074404
@@ -4417,12 +4414,10 @@ async def init_array(
44174414 )
44184415
44194416 # Normalize the user's chunks into canonical ChunksTuple form
4420- if chunks is None or chunks == "auto" :
4421- chunks_normalized = guess_chunks (
4422- shape_parsed ,
4423- item_size ,
4424- max_bytes = SHARDED_INNER_CHUNK_MAX_BYTES if shards is not None else None ,
4425- )
4417+
4418+ if chunks == "auto" :
4419+ max_bytes = None if shards is None else SHARDED_INNER_CHUNK_MAX_BYTES
4420+ chunks_normalized = guess_chunks (shape_parsed , item_size , max_bytes = max_bytes )
44264421 else :
44274422 chunks_normalized = normalize_chunks_nd (chunks , shape_parsed )
44284423
Original file line number Diff line number Diff line change 3737
3838BytesLike = bytes | bytearray | memoryview
3939ShapeLike = Iterable [int | np .integer [Any ]] | int | np .integer [Any ]
40- ChunksLike = ShapeLike | Sequence [ Sequence [int ]] | None
40+ ChunksLike = ShapeLike | Iterable [ Iterable [int ]]
4141# For backwards compatibility
4242ChunkCoords = tuple [int , ...]
4343ZarrFormat = Literal [2 , 3 ]
You can’t perform that action at this time.
0 commit comments