Skip to content

Commit 39a3540

Browse files
committed
update docstrings
1 parent dc36812 commit 39a3540

File tree

3 files changed

+16
-25
lines changed

3 files changed

+16
-25
lines changed

src/zarr/api/asynchronous.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,20 +1065,15 @@ async def create(
10651065
async def empty(
10661066
shape: ChunkCoords, **kwargs: Any
10671067
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
1068-
"""Create an empty array.
1068+
"""Create an empty array with the specified shape. The contents will be filled with the
1069+
array's fill value or zeros if no fill value is provided.
10691070
10701071
Parameters
10711072
----------
10721073
shape : int or tuple of int
10731074
Shape of the empty array.
10741075
**kwargs
10751076
Keyword arguments passed to :func:`zarr.api.asynchronous.create`.
1076-
1077-
Notes
1078-
-----
1079-
The contents of an empty Zarr array are not defined. On attempting to
1080-
retrieve data from an empty Zarr array, any values may be returned,
1081-
and these are not guaranteed to be stable from one access to the next.
10821077
"""
10831078

10841079
return await create(shape=shape, fill_value=None, **kwargs)
@@ -1087,7 +1082,8 @@ async def empty(
10871082
async def empty_like(
10881083
a: ArrayLike, **kwargs: Any
10891084
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
1090-
"""Create an empty array like `a`.
1085+
"""Create an empty array like `a`. The contents will be filled with the
1086+
array's fill value or zeros if no fill value is provided.
10911087
10921088
Parameters
10931089
----------

src/zarr/api/synchronous.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,8 @@ def create_array(
895895

896896
# TODO: add type annotations for kwargs
897897
def empty(shape: ChunkCoords, **kwargs: Any) -> Array:
898-
"""Create an empty array.
898+
"""Create an empty array with the specified shape. The contents will be filled with the
899+
array's fill value or zeros if no fill value is provided.
899900
900901
Parameters
901902
----------
@@ -908,20 +909,15 @@ def empty(shape: ChunkCoords, **kwargs: Any) -> Array:
908909
-------
909910
Array
910911
The new array.
911-
912-
Notes
913-
-----
914-
The contents of an empty Zarr array are not defined. On attempting to
915-
retrieve data from an empty Zarr array, any values may be returned,
916-
and these are not guaranteed to be stable from one access to the next.
917912
"""
918913
return Array(sync(async_api.empty(shape, **kwargs)))
919914

920915

921916
# TODO: move ArrayLike to common module
922917
# TODO: add type annotations for kwargs
923918
def empty_like(a: ArrayLike, **kwargs: Any) -> Array:
924-
"""Create an empty array like another array.
919+
"""Create an empty array like another array. The contents will be filled with the
920+
array's fill value or zeros if no fill value is provided.
925921
926922
Parameters
927923
----------

src/zarr/core/group.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,8 @@ async def tree(self, expand: bool | None = None, level: int | None = None) -> An
14981498
async def empty(
14991499
self, *, name: str, shape: ChunkCoords, **kwargs: Any
15001500
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
1501-
"""Create an empty array in this Group.
1501+
"""Create an empty array with the specified shape in this Group. The contents will
1502+
be filled with the array's fill value or zeros if no fill value is provided.
15021503
15031504
Parameters
15041505
----------
@@ -1592,7 +1593,8 @@ async def full(
15921593
async def empty_like(
15931594
self, *, name: str, data: async_api.ArrayLike, **kwargs: Any
15941595
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
1595-
"""Create an empty sub-array like `data`.
1596+
"""Create an empty sub-array like `data`. The contents will be filled with
1597+
the array's fill value or zeros if no fill value is provided.
15961598
15971599
Parameters
15981600
----------
@@ -2442,7 +2444,8 @@ def require_array(self, name: str, *, shape: ShapeLike, **kwargs: Any) -> Array:
24422444

24432445
@_deprecate_positional_args
24442446
def empty(self, *, name: str, shape: ChunkCoords, **kwargs: Any) -> Array:
2445-
"""Create an empty array in this Group.
2447+
"""Create an empty array with the specified shape in this Group. The contents will be filled with
2448+
the array's fill value or zeros if no fill value is provided.
24462449
24472450
Parameters
24482451
----------
@@ -2453,11 +2456,6 @@ def empty(self, *, name: str, shape: ChunkCoords, **kwargs: Any) -> Array:
24532456
**kwargs
24542457
Keyword arguments passed to :func:`zarr.api.asynchronous.create`.
24552458
2456-
Notes
2457-
-----
2458-
The contents of an empty Zarr array are not defined. On attempting to
2459-
retrieve data from an empty Zarr array, any values may be returned,
2460-
and these are not guaranteed to be stable from one access to the next.
24612459
"""
24622460
return Array(self._sync(self._async_group.empty(name=name, shape=shape, **kwargs)))
24632461

@@ -2531,7 +2529,8 @@ def full(
25312529

25322530
@_deprecate_positional_args
25332531
def empty_like(self, *, name: str, data: async_api.ArrayLike, **kwargs: Any) -> Array:
2534-
"""Create an empty sub-array like `data`.
2532+
"""Create an empty sub-array like `data`. The contents will be filled
2533+
with the array's fill value or zeros if no fill value is provided.
25352534
25362535
Parameters
25372536
----------

0 commit comments

Comments
 (0)