Skip to content

Commit 07ddb58

Browse files
committed
Fix formatting mistakes moving mypy comments
1 parent 492c0d6 commit 07ddb58

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

xarray/core/groupby.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,9 @@ def factorize(self) -> EncodedGroups:
461461
# NaNs; as well as values outside the bins are coded by -1
462462
# Restore these after the raveling
463463
mask = functools.reduce(
464-
np.logical_or, [(code == -1) for code in broadcasted_codes]
465-
) # type: ignore[arg-type]
464+
np.logical_or, # type: ignore[arg-type]
465+
[(code == -1) for code in broadcasted_codes],
466+
)
466467
_flatcodes[mask] = -1
467468

468469
midx = pd.MultiIndex.from_product(

xarray/core/resample.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ def _interpolate(self, kind="linear", **kwargs) -> T_Xarray:
188188

189189

190190
# https://github.com/python/mypy/issues/9031
191-
class DataArrayResample(
191+
class DataArrayResample( # type: ignore[misc]
192192
Resample["DataArray"], DataArrayGroupByBase, DataArrayResampleAggregations
193-
): # type: ignore[misc]
193+
):
194194
"""DataArrayGroupBy object specialized to time resampling operations over a
195195
specified dimension
196196
"""
@@ -331,9 +331,9 @@ def asfreq(self) -> DataArray:
331331

332332

333333
# https://github.com/python/mypy/issues/9031
334-
class DatasetResample(
334+
class DatasetResample( # type: ignore[misc]
335335
Resample["Dataset"], DatasetGroupByBase, DatasetResampleAggregations
336-
): # type: ignore[misc]
336+
):
337337
"""DatasetGroupBy object specialized to resampling a specified dimension"""
338338

339339
def map(

xarray/namedarray/_array_api.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ def astype(
7979

8080

8181
def imag(
82-
x: NamedArray[_ShapeType, np.dtype[_SupportsImag[_ScalarType]]],
83-
/, # type: ignore[type-var]
82+
x: NamedArray[_ShapeType, np.dtype[_SupportsImag[_ScalarType]]], # type: ignore[type-var]
83+
/,
8484
) -> NamedArray[_ShapeType, np.dtype[_ScalarType]]:
8585
"""
8686
Returns the imaginary component of a complex number for each element x_i of the
@@ -112,8 +112,8 @@ def imag(
112112

113113

114114
def real(
115-
x: NamedArray[_ShapeType, np.dtype[_SupportsReal[_ScalarType]]],
116-
/, # type: ignore[type-var]
115+
x: NamedArray[_ShapeType, np.dtype[_SupportsReal[_ScalarType]]], # type: ignore[type-var]
116+
/,
117117
) -> NamedArray[_ShapeType, np.dtype[_ScalarType]]:
118118
"""
119119
Returns the real component of a complex number for each element x_i of the

xarray/tests/test_coordinates.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,9 @@ def test_init_index_error(self) -> None:
6565

6666
with pytest.raises(TypeError, match=".* is not an `xarray.indexes.Index`"):
6767
Coordinates(
68-
coords={"x": ("x", [1, 2, 3])}, indexes={"x": "not_an_xarray_index"}
69-
) # type: ignore[dict-item]
68+
coords={"x": ("x", [1, 2, 3])},
69+
indexes={"x": "not_an_xarray_index"}, # type: ignore[dict-item]
70+
)
7071

7172
def test_init_dim_sizes_conflict(self) -> None:
7273
with pytest.raises(ValueError):

0 commit comments

Comments
 (0)