Skip to content

Commit 90f4f73

Browse files
committed
add notes to empty() and empty_like()
1 parent c688c06 commit 90f4f73

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

src/zarr/api/asynchronous.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,12 @@ async def empty(
10741074
Shape of the empty array.
10751075
**kwargs
10761076
Keyword arguments passed to :func:`zarr.api.asynchronous.create`.
1077+
1078+
Notes
1079+
-----
1080+
The contents of an empty Zarr array are not defined. On attempting to
1081+
retrieve data from an empty Zarr array, any values may be returned,
1082+
and these are not guaranteed to be stable from one access to the next.
10771083
"""
10781084

10791085
return await create(shape=shape, fill_value=None, **kwargs)
@@ -1096,6 +1102,12 @@ async def empty_like(
10961102
-------
10971103
Array
10981104
The new array.
1105+
1106+
Notes
1107+
-----
1108+
The contents of an empty Zarr array are not defined. On attempting to
1109+
retrieve data from an empty Zarr array, any values may be returned,
1110+
and these are not guaranteed to be stable from one access to the next.
10991111
"""
11001112
like_kwargs = _like_args(a, kwargs)
11011113
return await empty(**like_kwargs)

src/zarr/api/synchronous.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,12 @@ def empty(shape: ChunkCoords, **kwargs: Any) -> Array:
916916
-------
917917
Array
918918
The new array.
919+
920+
Notes
921+
-----
922+
The contents of an empty Zarr array are not defined. On attempting to
923+
retrieve data from an empty Zarr array, any values may be returned,
924+
and these are not guaranteed to be stable from one access to the next.
919925
"""
920926
return Array(sync(async_api.empty(shape, **kwargs)))
921927

@@ -937,6 +943,12 @@ def empty_like(a: ArrayLike, **kwargs: Any) -> Array:
937943
-------
938944
Array
939945
The new array.
946+
947+
Notes
948+
-----
949+
The contents of an empty Zarr array are not defined. On attempting to
950+
retrieve data from an empty Zarr array, any values may be returned,
951+
and these are not guaranteed to be stable from one access to the next.
940952
"""
941953
return Array(sync(async_api.empty_like(a, **kwargs)))
942954

src/zarr/core/group.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,6 @@ async def empty(
15161516
retrieve data from an empty Zarr array, any values may be returned,
15171517
and these are not guaranteed to be stable from one access to the next.
15181518
"""
1519-
15201519
return await async_api.empty(shape=shape, store=self.store_path, path=name, **kwargs)
15211520

15221521
async def zeros(
@@ -2456,6 +2455,11 @@ def empty(self, *, name: str, shape: ChunkCoords, **kwargs: Any) -> Array:
24562455
**kwargs
24572456
Keyword arguments passed to :func:`zarr.api.asynchronous.create`.
24582457
2458+
Notes
2459+
-----
2460+
The contents of an empty Zarr array are not defined. On attempting to
2461+
retrieve data from an empty Zarr array, any values may be returned,
2462+
and these are not guaranteed to be stable from one access to the next.
24592463
"""
24602464
return Array(self._sync(self._async_group.empty(name=name, shape=shape, **kwargs)))
24612465

@@ -2545,6 +2549,12 @@ def empty_like(self, *, name: str, data: async_api.ArrayLike, **kwargs: Any) ->
25452549
-------
25462550
Array
25472551
The new array.
2552+
2553+
Notes
2554+
-----
2555+
The contents of an empty Zarr array are not defined. On attempting to
2556+
retrieve data from an empty Zarr array, any values may be returned,
2557+
and these are not guaranteed to be stable from one access to the next.
25482558
"""
25492559
return Array(self._sync(self._async_group.empty_like(name=name, data=data, **kwargs)))
25502560

0 commit comments

Comments
 (0)