Skip to content

Commit

Permalink
remove the deprecated return value of Dataset.update
Browse files Browse the repository at this point in the history
  • Loading branch information
keewis committed Jul 22, 2021
1 parent c6b33e6 commit ac97a75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
12 changes: 2 additions & 10 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4157,7 +4157,7 @@ def unstack(
result = result._unstack_once(dim, fill_value)
return result

def update(self, other: "CoercibleMapping") -> "Dataset":
def update(self, other: "CoercibleMapping") -> None:
"""Update this dataset's variables with those from another dataset.
Just like :py:meth:`dict.update` this is a in-place operation.
Expand All @@ -4173,14 +4173,6 @@ def update(self, other: "CoercibleMapping") -> "Dataset":
- mapping {var name: (dimension name, array-like)}
- mapping {var name: (tuple of dimension names, array-like)}
Returns
-------
updated : Dataset
Updated dataset. Note that since the update is in-place this is the input
dataset.
It is deprecated since version 0.17 and scheduled to be removed in 0.19.
Raises
------
ValueError
Expand All @@ -4192,7 +4184,7 @@ def update(self, other: "CoercibleMapping") -> "Dataset":
Dataset.assign
"""
merge_result = dataset_update_method(self, other)
return self._replace(inplace=True, **merge_result._asdict())
self._replace(inplace=True, **merge_result._asdict())

def merge(
self,
Expand Down
6 changes: 3 additions & 3 deletions xarray/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3191,13 +3191,13 @@ def test_update(self):
data = create_test_data(seed=0)
expected = data.copy()
var2 = Variable("dim1", np.arange(8))
actual = data.update({"var2": var2})
actual = data.copy()
actual.update({"var2": var2})
expected["var2"] = var2
assert_identical(expected, actual)

actual = data.copy()
actual_result = actual.update(data)
assert actual_result is actual
actual.update(data)
assert_identical(expected, actual)

other = Dataset(attrs={"new": "attr"})
Expand Down

0 comments on commit ac97a75

Please sign in to comment.