From 94afff792d5d86ac819539e3b332f31d0dc6876e Mon Sep 17 00:00:00 2001 From: Fabricio Arend Torres Date: Sun, 30 Mar 2025 10:43:26 +0200 Subject: [PATCH] docs: Clarified laziness of create_hierarchy (#2938) --- src/zarr/core/sync_group.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/zarr/core/sync_group.py b/src/zarr/core/sync_group.py index 39d8a17992..f7ba8d29e9 100644 --- a/src/zarr/core/sync_group.py +++ b/src/zarr/core/sync_group.py @@ -55,14 +55,15 @@ def create_hierarchy( overwrite: bool = False, ) -> Iterator[tuple[str, Group | Array]]: """ - Create a complete zarr hierarchy from a collection of metadata objects. + Lazily create a complete zarr hierarchy from a collection of metadata objects. This function will parse its input to ensure that the hierarchy is complete. Any implicit groups will be inserted as needed. For example, an input like ```{'a/b': GroupMetadata}``` will be parsed to ```{'': GroupMetadata, 'a': GroupMetadata, 'b': Groupmetadata}``` - After input parsing, this function then creates all the nodes in the hierarchy concurrently. + This function returns a generator that will create the nodes in the hierarchy + when consumed. After input parsing, this function then creates all the nodes in the hierarchy concurrently. Arrays and Groups are yielded in the order they are created. This order is not stable and should not be relied on.