Skip to content

Commit 2f96fad

Browse files
authored
Remove deprecated allow_lazy (#4499)
* Remove deprecated allow_lazy * more cleanup
1 parent 026bc0b commit 2f96fad

File tree

3 files changed

+2
-19
lines changed

3 files changed

+2
-19
lines changed

xarray/core/dataset.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4271,7 +4271,6 @@ def reduce(
42714271
keep_attrs: bool = None,
42724272
keepdims: bool = False,
42734273
numeric_only: bool = False,
4274-
allow_lazy: bool = None,
42754274
**kwargs: Any,
42764275
) -> "Dataset":
42774276
"""Reduce this dataset by applying `func` along some dimension(s).
@@ -4346,7 +4345,6 @@ def reduce(
43464345
dim=reduce_dims,
43474346
keep_attrs=keep_attrs,
43484347
keepdims=keepdims,
4349-
allow_lazy=allow_lazy,
43504348
**kwargs,
43514349
)
43524350

xarray/core/variable.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,6 @@ def reduce(
15821582
axis=None,
15831583
keep_attrs=None,
15841584
keepdims=False,
1585-
allow_lazy=None,
15861585
**kwargs,
15871586
):
15881587
"""Reduce this array by applying `func` along some dimension(s).
@@ -1624,24 +1623,14 @@ def reduce(
16241623
if dim is not None:
16251624
axis = self.get_axis_num(dim)
16261625

1627-
if allow_lazy is not None:
1628-
warnings.warn(
1629-
"allow_lazy is deprecated and will be removed in version 0.16.0. It is now True by default.",
1630-
DeprecationWarning,
1631-
)
1632-
else:
1633-
allow_lazy = True
1634-
1635-
input_data = self.data if allow_lazy else self.values
1636-
16371626
with warnings.catch_warnings():
16381627
warnings.filterwarnings(
16391628
"ignore", r"Mean of empty slice", category=RuntimeWarning
16401629
)
16411630
if axis is not None:
1642-
data = func(input_data, axis=axis, **kwargs)
1631+
data = func(self.data, axis=axis, **kwargs)
16431632
else:
1644-
data = func(input_data, **kwargs)
1633+
data = func(self.data, **kwargs)
16451634

16461635
if getattr(data, "shape", ()) == self.shape:
16471636
dims = self.dims

xarray/tests/test_variable.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,10 +1570,6 @@ def test_reduce(self):
15701570

15711571
with raises_regex(ValueError, "cannot supply both"):
15721572
v.mean(dim="x", axis=0)
1573-
with pytest.warns(DeprecationWarning, match="allow_lazy is deprecated"):
1574-
v.mean(dim="x", allow_lazy=True)
1575-
with pytest.warns(DeprecationWarning, match="allow_lazy is deprecated"):
1576-
v.mean(dim="x", allow_lazy=False)
15771573

15781574
@pytest.mark.parametrize("skipna", [True, False])
15791575
@pytest.mark.parametrize("q", [0.25, [0.50], [0.25, 0.75]])

0 commit comments

Comments
 (0)