Skip to content

Commit 7a718d5

Browse files
committed
docstrings
1 parent 661678f commit 7a718d5

File tree

1 file changed

+33
-7
lines changed

1 file changed

+33
-7
lines changed

src/zarr/core/group.py

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,16 +2856,19 @@ async def create_hierarchy(
28562856
28572857
Parameters
28582858
----------
2859-
store_path : StorePath
2860-
The StorePath object pointing to the root of the hierarchy.
2859+
store : Store
2860+
The storage backend to use.
2861+
path : str
2862+
The name of the root of the created hierarchy. Every key in ``nodes`` will be prefixed with
2863+
``path`` prior to creating nodes.
28612864
nodes : dict[str, GroupMetadata | ArrayV3Metadata | ArrayV2Metadata]
28622865
A dictionary defining the hierarchy. The keys are the paths of the nodes
28632866
in the hierarchy, and the values are the metadata of the nodes. The
28642867
metadata must be either an instance of GroupMetadata, ArrayV3Metadata
28652868
or ArrayV2Metadata.
28662869
semaphore : asyncio.Semaphore | None
28672870
An optional semaphore to limit the number of concurrent tasks. If not
2868-
provided, the number of concurrent tasks is not limited.
2871+
provided, the number of concurrent tasks is unlimited.
28692872
allow_root : bool
28702873
Whether to allow a root node to be created. If ``False``, attempting to create a root node
28712874
will result in an error. Use this option when calling this function as part of a method
@@ -2966,9 +2969,32 @@ async def create_nodes(
29662969
nodes: dict[str, GroupMetadata | ArrayV2Metadata | ArrayV3Metadata],
29672970
semaphore: asyncio.Semaphore | None = None,
29682971
) -> AsyncIterator[AsyncGroup | AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]]:
2969-
"""
2970-
Create a collection of zarr arrays and groups concurrently and atomically. To ensure atomicity,
2971-
no attempt is made to ensure that intermediate groups are created.
2972+
"""Create a collection of arrays and / or groups concurrently.
2973+
2974+
Note: no attempt is made to validate that these arrays and / or groups collectively form a
2975+
valid Zarr hierarchy. It is the responsibility of the caller of this function to ensure that
2976+
the ``nodes`` parameter satisfies any correctness constraints.
2977+
2978+
Parameters
2979+
----------
2980+
store : Store
2981+
The storage backend to use.
2982+
path : str
2983+
The name of the root of the created hierarchy. Every key in ``nodes`` will be prefixed with
2984+
``path`` prior to creating nodes.
2985+
nodes : dict[str, GroupMetadata | ArrayV3Metadata | ArrayV2Metadata]
2986+
A dictionary defining the hierarchy. The keys are the paths of the nodes
2987+
in the hierarchy, and the values are the metadata of the nodes. The
2988+
metadata must be either an instance of GroupMetadata, ArrayV3Metadata
2989+
or ArrayV2Metadata.
2990+
semaphore : asyncio.Semaphore | None
2991+
An optional semaphore to limit the number of concurrent tasks. If not
2992+
provided, the number of concurrent tasks is unlimited.
2993+
2994+
Yields
2995+
------
2996+
AsyncGroup | AsyncArray
2997+
The created nodes in the order they are created.
29722998
"""
29732999
ctx: asyncio.Semaphore | contextlib.nullcontext[None]
29743000

@@ -2979,7 +3005,7 @@ async def create_nodes(
29793005

29803006
create_tasks: list[Coroutine[None, None, str]] = []
29813007
for key, value in nodes.items():
2982-
# transform the key, which is relative to a store_path.path, to a key in the store
3008+
# make the key absolute
29833009
write_prefix = _join_paths([path, key])
29843010
create_tasks.extend(_persist_metadata(store, write_prefix, value))
29853011

0 commit comments

Comments
 (0)