Skip to content

Commit 4b7d866

Browse files
committed
Run pre-commit
1 parent 808b8a5 commit 4b7d866

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

xarray/core/weighted.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, Generic, Hashable, Iterable, Optional, Union
1+
from typing import TYPE_CHECKING, Generic, Hashable, Iterable, Optional, Union, cast
22

33
import numpy as np
44

@@ -237,7 +237,7 @@ def _weighted_std(
237237
) -> "DataArray":
238238
"""Reduce a DataArray by a weighted ``std`` along some dimension(s)."""
239239

240-
return np.sqrt(self._weighted_var(da, dim, skipna))
240+
return cast("DataArray", np.sqrt(self._weighted_var(da, dim, skipna)))
241241

242242
def _implementation(self, func, dim, **kwargs):
243243

xarray/tests/test_weighted.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,9 @@ def test_weighted_operations_different_shapes(
503503
check_weighted_operations(data, weights, None, skipna)
504504

505505

506-
@pytest.mark.parametrize("operation", ("sum_of_weights", "sum", "mean", "sum_of_squares", "var", "std"))
506+
@pytest.mark.parametrize(
507+
"operation", ("sum_of_weights", "sum", "mean", "sum_of_squares", "var", "std")
508+
)
507509
@pytest.mark.parametrize("as_dataset", (True, False))
508510
@pytest.mark.parametrize("keep_attrs", (True, False, None))
509511
def test_weighted_operations_keep_attr(operation, as_dataset, keep_attrs):
@@ -530,7 +532,9 @@ def test_weighted_operations_keep_attr(operation, as_dataset, keep_attrs):
530532
assert not result.attrs
531533

532534

533-
@pytest.mark.parametrize("operation", ("sum_of_weights", "sum", "mean", "sum_of_squares", "var", "std"))
535+
@pytest.mark.parametrize(
536+
"operation", ("sum_of_weights", "sum", "mean", "sum_of_squares", "var", "std")
537+
)
534538
def test_weighted_operations_keep_attr_da_in_ds(operation):
535539
# GH #3595
536540

0 commit comments

Comments
 (0)