@@ -1270,8 +1270,30 @@ async def array_values(
12701270 async for _ , array in self .arrays ():
12711271 yield array
12721272
1273- async def tree (self , expand : bool = False , level : int | None = None ) -> Any :
1274- raise NotImplementedError
1273+ async def tree (self , expand : bool | None = None , level : int | None = None ) -> Any :
1274+ """
1275+ Return a tree-like representation of a hierarchy.
1276+
1277+ This requires the optional ``rich`` dependency.
1278+
1279+ Parameters
1280+ ----------
1281+ expand : bool, optional
1282+ This keyword is not yet supported. A NotImplementedError is raised if
1283+ it's used.
1284+ level : int, optional
1285+ The maximum depth below this Group to display in the tree.
1286+
1287+ Returns
1288+ -------
1289+ TreeRepr
1290+ A pretty-printable object displaying the hierarchy.
1291+ """
1292+ from zarr ._tree import group_tree_async
1293+
1294+ if expand is not None :
1295+ raise NotImplementedError ("'expanded' is not yet implemented." )
1296+ return await group_tree_async (self , max_depth = level )
12751297
12761298 async def empty (
12771299 self , * , name : str , shape : ChunkCoords , ** kwargs : Any
@@ -1504,7 +1526,25 @@ def array_values(self) -> Generator[Array, None]:
15041526 for _ , array in self .arrays ():
15051527 yield array
15061528
1507- def tree (self , expand : bool = False , level : int | None = None ) -> Any :
1529+ def tree (self , expand : bool | None = None , level : int | None = None ) -> Any :
1530+ """
1531+ Return a tree-like representation of a hierarchy.
1532+
1533+ This requires the optional ``rich`` dependency.
1534+
1535+ Parameters
1536+ ----------
1537+ expand : bool, optional
1538+ This keyword is not yet supported. A NotImplementedError is raised if
1539+ it's used.
1540+ level : int, optional
1541+ The maximum depth below this Group to display in the tree.
1542+
1543+ Returns
1544+ -------
1545+ TreeRepr
1546+ A pretty-printable object displaying the hierarchy.
1547+ """
15081548 return self ._sync (self ._async_group .tree (expand = expand , level = level ))
15091549
15101550 def create_group (self , name : str , ** kwargs : Any ) -> Group :
0 commit comments