Skip to content

Commit a1a3f48

Browse files
committed
Move check for floats from create to normalize_chunks
1 parent 7c1e34c commit a1a3f48

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/zarr/core/array.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,11 +461,8 @@ async def create(
461461
raise ValueError("Only one of chunk_shape or chunks can be provided.")
462462

463463
if chunks:
464-
chunks = parse_shapelike(chunks)
465464
_chunks = normalize_chunks(chunks, shape, dtype_parsed.itemsize)
466465
else:
467-
if chunk_shape:
468-
chunk_shape = parse_shapelike(chunk_shape)
469466
_chunks = normalize_chunks(chunk_shape, shape, dtype_parsed.itemsize)
470467

471468
result: AsyncArray[ArrayV3Metadata] | AsyncArray[ArrayV2Metadata]

src/zarr/core/chunk_grids.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ def normalize_chunks(chunks: Any, shape: tuple[int, ...], typesize: int) -> tupl
138138
s if c == -1 or c is None else int(c) for s, c in zip(shape, chunks, strict=False)
139139
)
140140

141+
if not all(isinstance(c, numbers.Integral) for c in chunks):
142+
raise TypeError("non integer value in chunks")
143+
141144
return tuple(int(c) for c in chunks)
142145

143146

0 commit comments

Comments
 (0)