Skip to content

Commit 5879d67

Browse files
committed
more debug
1 parent 2295d76 commit 5879d67

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/zarr/core/array.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -651,10 +651,7 @@ async def _save_metadata(self, metadata: ArrayMetadata, ensure_parents: bool = F
651651
]
652652
)
653653

654-
for awaitable in awaitables:
655-
await awaitable
656-
657-
# await gather(*awaitables)
654+
await gather(*awaitables)
658655

659656
async def _set_selection(
660657
self,
@@ -2393,21 +2390,26 @@ def chunks_initialized(array: Array | AsyncArray) -> tuple[str, ...]:
23932390
def _build_parents(node: AsyncArray | AsyncGroup) -> list[AsyncGroup]:
23942391
from zarr.core.group import AsyncGroup, GroupMetadata
23952392

2396-
required_parts = node.store_path.path.split("/")[:-1]
2393+
store = node.store_path.store
2394+
path = node.store_path.path
2395+
if not path:
2396+
return []
2397+
2398+
required_parts = path.split("/")[:-1]
23972399
parents = [
23982400
# the root group
23992401
AsyncGroup(
24002402
metadata=GroupMetadata(zarr_format=node.metadata.zarr_format),
2401-
store_path=StorePath(store=node.store_path.store, path=""),
2403+
store_path=StorePath(store=store, path=""),
24022404
)
24032405
]
24042406

24052407
for i, part in enumerate(required_parts):
2406-
path = "/".join(required_parts[:i] + [part])
2408+
p = "/".join(required_parts[:i] + [part])
24072409
parents.append(
24082410
AsyncGroup(
24092411
metadata=GroupMetadata(zarr_format=node.metadata.zarr_format),
2410-
store_path=StorePath(store=node.store_path.store, path=path),
2412+
store_path=StorePath(store=store, path=p),
24112413
)
24122414
)
24132415

tests/v3/test_group.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ async def test_create_creates_parents(store: Store, zarr_format: ZarrFormat) ->
6262
await zarr.api.asynchronous.open_group(
6363
store=store, path="a", zarr_format=zarr_format, attributes={"key": "value"}
6464
)
65+
objs = {x async for x in store.list()}
66+
if zarr_format == 2:
67+
assert objs == {".zgroup", ".zattrs", "a/.zgroup", "a/.zattrs"}
68+
else:
69+
assert objs == {"zarr.json", "a/zarr.json"}
6570

6671
# test that root group node was created
6772
root = await zarr.api.asynchronous.open_group(

0 commit comments

Comments
 (0)