Skip to content

Commit d4ec607

Browse files
committed
Move deprecation notices to the top of docstrings
1 parent 38953e3 commit d4ec607

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

src/zarr/api/asynchronous.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ async def save_group(
508508
async def tree(grp: AsyncGroup, expand: bool | None = None, level: int | None = None) -> Any:
509509
"""Provide a rich display of the hierarchy.
510510
511+
.. deprecated:: 3.0.0
512+
`zarr.tree()` is deprecated and will be removed in a future release.
513+
Use `group.tree()` instead.
514+
511515
Parameters
512516
----------
513517
grp : Group
@@ -521,10 +525,6 @@ async def tree(grp: AsyncGroup, expand: bool | None = None, level: int | None =
521525
-------
522526
TreeRepr
523527
A pretty-printable object displaying the hierarchy.
524-
525-
.. deprecated:: 3.0.0
526-
`zarr.tree()` is deprecated and will be removed in a future release.
527-
Use `group.tree()` instead.
528528
"""
529529
return await grp.tree(expand=expand, level=level)
530530

src/zarr/api/synchronous.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ def save_group(
334334
def tree(grp: Group, expand: bool | None = None, level: int | None = None) -> Any:
335335
"""Provide a rich display of the hierarchy.
336336
337+
.. deprecated:: 3.0.0
338+
`zarr.tree()` is deprecated and will be removed in a future release.
339+
Use `group.tree()` instead.
340+
337341
Parameters
338342
----------
339343
grp : Group
@@ -347,10 +351,6 @@ def tree(grp: Group, expand: bool | None = None, level: int | None = None) -> An
347351
-------
348352
TreeRepr
349353
A pretty-printable object displaying the hierarchy.
350-
351-
.. deprecated:: 3.0.0
352-
`zarr.tree()` is deprecated and will be removed in a future release.
353-
Use `group.tree()` instead.
354354
"""
355355
return sync(async_api.tree(grp._async_group, expand=expand, level=level))
356356

src/zarr/core/array.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ async def create(
432432
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
433433
"""Method to create a new asynchronous array instance.
434434
435+
.. deprecated:: 3.0.0
436+
Deprecated in favor of :func:`zarr.api.asynchronous.create_array`.
437+
435438
Parameters
436439
----------
437440
store : StoreLike
@@ -509,9 +512,6 @@ async def create(
509512
-------
510513
AsyncArray
511514
The created asynchronous array instance.
512-
513-
.. deprecated:: 3.0.0
514-
Deprecated in favor of :func:`zarr.api.asynchronous.create_array`.
515515
"""
516516
return await cls._create(
517517
store,
@@ -1637,6 +1637,9 @@ def create(
16371637
) -> Array:
16381638
"""Creates a new Array instance from an initialized store.
16391639
1640+
.. deprecated:: 3.0.0
1641+
Deprecated in favor of :func:`zarr.create_array`.
1642+
16401643
Parameters
16411644
----------
16421645
store : StoreLike
@@ -1704,9 +1707,6 @@ def create(
17041707
-------
17051708
Array
17061709
Array created from the store.
1707-
1708-
.. deprecated:: 3.0.0
1709-
Deprecated in favor of :func:`zarr.create_array`.
17101710
"""
17111711
return cls._create(
17121712
store,

src/zarr/core/group.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,6 +1148,9 @@ async def create_dataset(
11481148
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
11491149
"""Create an array.
11501150
1151+
.. deprecated:: 3.0.0
1152+
The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.create_array` instead.
1153+
11511154
Arrays are known as "datasets" in HDF5 terminology. For compatibility
11521155
with h5py, Zarr groups also implement the :func:`zarr.AsyncGroup.require_dataset` method.
11531156
@@ -1161,9 +1164,6 @@ async def create_dataset(
11611164
Returns
11621165
-------
11631166
a : AsyncArray
1164-
1165-
.. deprecated:: 3.0.0
1166-
The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.create_array` instead.
11671167
"""
11681168
return await self.create_array(name, shape=shape, **kwargs)
11691169

@@ -1179,6 +1179,9 @@ async def require_dataset(
11791179
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
11801180
"""Obtain an array, creating if it doesn't exist.
11811181
1182+
.. deprecated:: 3.0.0
1183+
The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.require_dataset` instead.
1184+
11821185
Arrays are known as "datasets" in HDF5 terminology. For compatibility
11831186
with h5py, Zarr groups also implement the :func:`zarr.AsyncGroup.create_dataset` method.
11841187
@@ -1199,9 +1202,6 @@ async def require_dataset(
11991202
Returns
12001203
-------
12011204
a : AsyncArray
1202-
1203-
.. deprecated:: 3.0.0
1204-
The h5py compatibility methods will be removed in 3.1.0. Use `AsyncGroup.require_dataset` instead.
12051205
"""
12061206
return await self.require_array(name, shape=shape, dtype=dtype, exact=exact, **kwargs)
12071207

@@ -2393,6 +2393,10 @@ def create_array(
23932393
def create_dataset(self, name: str, **kwargs: Any) -> Array:
23942394
"""Create an array.
23952395
2396+
.. deprecated:: 3.0.0
2397+
The h5py compatibility methods will be removed in 3.1.0. Use `Group.create_array` instead.
2398+
2399+
23962400
Arrays are known as "datasets" in HDF5 terminology. For compatibility
23972401
with h5py, Zarr groups also implement the :func:`zarr.Group.require_dataset` method.
23982402
@@ -2406,16 +2410,16 @@ def create_dataset(self, name: str, **kwargs: Any) -> Array:
24062410
Returns
24072411
-------
24082412
a : Array
2409-
2410-
.. deprecated:: 3.0.0
2411-
The h5py compatibility methods will be removed in 3.1.0. Use `Group.create_array` instead.
24122413
"""
24132414
return Array(self._sync(self._async_group.create_dataset(name, **kwargs)))
24142415

24152416
@deprecated("Use Group.require_array instead.")
24162417
def require_dataset(self, name: str, *, shape: ShapeLike, **kwargs: Any) -> Array:
24172418
"""Obtain an array, creating if it doesn't exist.
24182419
2420+
.. deprecated:: 3.0.0
2421+
The h5py compatibility methods will be removed in 3.1.0. Use `Group.require_array` instead.
2422+
24192423
Arrays are known as "datasets" in HDF5 terminology. For compatibility
24202424
with h5py, Zarr groups also implement the :func:`zarr.Group.create_dataset` method.
24212425
@@ -2431,9 +2435,6 @@ def require_dataset(self, name: str, *, shape: ShapeLike, **kwargs: Any) -> Arra
24312435
Returns
24322436
-------
24332437
a : Array
2434-
2435-
.. deprecated:: 3.0.0
2436-
The h5py compatibility methods will be removed in 3.1.0. Use `Group.require_array` instead.
24372438
"""
24382439
return Array(self._sync(self._async_group.require_array(name, shape=shape, **kwargs)))
24392440

@@ -2660,6 +2661,9 @@ def array(
26602661
) -> Array:
26612662
"""Create an array within this group.
26622663
2664+
.. deprecated:: 3.0.0
2665+
Use `Group.create_array` instead.
2666+
26632667
This method lightly wraps :func:`zarr.core.array.create_array`.
26642668
26652669
Parameters

0 commit comments

Comments
 (0)