Skip to content

Commit d8094ba

Browse files
committed
format
1 parent f063515 commit d8094ba

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/zarr/core/indexing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,15 +1344,16 @@ def decode_morton(z: int, chunk_shape: ChunkCoords) -> ChunkCoords:
13441344

13451345
def morton_order_iter(chunk_shape: ChunkCoords) -> Iterator[ChunkCoords]:
13461346
i = 0
1347-
order = []
1348-
while len(order)<product(chunk_shape):
1347+
order: list[ChunkCoords] = []
1348+
while len(order) < product(chunk_shape):
13491349
m = decode_morton(i, chunk_shape)
1350-
if m not in order and all(x < y for x,y in zip(m, chunk_shape, strict=False)):
1350+
if m not in order and all(x < y for x, y in zip(m, chunk_shape, strict=False)):
13511351
order.append(m)
1352-
i+=1
1352+
i += 1
13531353
for j in range(product(chunk_shape)):
13541354
yield order[j]
13551355

1356+
13561357
def c_order_iter(chunks_per_shard: ChunkCoords) -> Iterator[ChunkCoords]:
13571358
return itertools.product(*(range(x) for x in chunks_per_shard))
13581359

tests/test_codecs/test_sharding.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,14 +394,18 @@ async def test_sharding_with_empty_inner_chunk(
394394
data_read = await a.getitem(...)
395395
assert np.array_equal(data_read, data)
396396

397+
397398
@pytest.mark.parametrize("store", ["local", "memory"], indirect=["store"])
398399
@pytest.mark.parametrize(
399-
"index_location", [ShardingCodecIndexLocation.start, ShardingCodecIndexLocation.end],
400+
"index_location",
401+
[ShardingCodecIndexLocation.start, ShardingCodecIndexLocation.end],
400402
)
401-
@pytest.mark.parametrize("chunks_per_shard", [(5,2), (2,5), (5,5)])
402-
async def test_sharding_with_chunks_per_shard(store: Store, index_location: ShardingCodecIndexLocation, chunks_per_shard: tuple) -> None:
403-
chunk_shape = (2,1)
404-
shape = [x*y for x,y in zip(chunks_per_shard, chunk_shape, strict=False)]
403+
@pytest.mark.parametrize("chunks_per_shard", [(5, 2), (2, 5), (5, 5)])
404+
async def test_sharding_with_chunks_per_shard(
405+
store: Store, index_location: ShardingCodecIndexLocation, chunks_per_shard: tuple[int]
406+
) -> None:
407+
chunk_shape = (2, 1)
408+
shape = [x * y for x, y in zip(chunks_per_shard, chunk_shape, strict=False)]
405409
data = np.ones(np.prod(shape), dtype="int32").reshape(shape)
406410
fill_value = 42
407411

0 commit comments

Comments
 (0)