Skip to content

Commit 6336ffb

Browse files
max-sixtyshoyer
andauthored
Complete deprecation cycle for Dataset.update return value (#10717)
* Complete deprecation cycle for Dataset.update return value - Dataset.update() now returns None instead of self - Removes deprecation that was started in v0.17 and scheduled for removal in v0.21 - Updates documentation to remove return value information - Aligns behavior with standard dict.update() which returns None Closes #10167 * Update doc/whats-new.rst Co-authored-by: Stephan Hoyer <[email protected]> --------- Co-authored-by: Stephan Hoyer <[email protected]>
1 parent de953a8 commit 6336ffb

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

doc/whats-new.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ New Features
1717
Breaking changes
1818
~~~~~~~~~~~~~~~~
1919

20+
- :py:meth:`Dataset.update` now returns ``None``, instead of the updated dataset. This
21+
completes the deprecation cycle started in version 0.17. The method still updates the
22+
dataset in-place. (:issue:`10167`)
23+
By `Maximilian Roos <https://github.com/max-sixty>`_.
2024

2125
Deprecations
2226
~~~~~~~~~~~~

xarray/core/dataset.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5592,7 +5592,7 @@ def unstack(
55925592
result = result._unstack_once(d, stacked_indexes[d], fill_value, sparse)
55935593
return result
55945594

5595-
def update(self, other: CoercibleMapping) -> Self:
5595+
def update(self, other: CoercibleMapping) -> None:
55965596
"""Update this dataset's variables with those from another dataset.
55975597
55985598
Just like :py:meth:`dict.update` this is a in-place operation.
@@ -5609,14 +5609,6 @@ def update(self, other: CoercibleMapping) -> Self:
56095609
- mapping {var name: (dimension name, array-like)}
56105610
- mapping {var name: (tuple of dimension names, array-like)}
56115611
5612-
Returns
5613-
-------
5614-
updated : Dataset
5615-
Updated dataset. Note that since the update is in-place this is the input
5616-
dataset.
5617-
5618-
It is deprecated since version 0.17 and scheduled to be removed in 0.21.
5619-
56205612
Raises
56215613
------
56225614
ValueError
@@ -5629,7 +5621,7 @@ def update(self, other: CoercibleMapping) -> Self:
56295621
Dataset.merge
56305622
"""
56315623
merge_result = dataset_update_method(self, other)
5632-
return self._replace(inplace=True, **merge_result._asdict())
5624+
self._replace(inplace=True, **merge_result._asdict())
56335625

56345626
def merge(
56355627
self,

0 commit comments

Comments
 (0)