From f98980cfe22bfb292d06a4a66e7269e7214f70e4 Mon Sep 17 00:00:00 2001 From: Virgile Andreani Date: Mon, 16 Sep 2024 21:44:36 -0400 Subject: [PATCH] Fix formatting mistakes moving mypy comments --- xarray/core/resample.py | 8 ++++---- xarray/namedarray/_array_api.py | 8 ++++---- xarray/tests/test_coordinates.py | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/xarray/core/resample.py b/xarray/core/resample.py index de502d4c6e8..9dd91d86a47 100644 --- a/xarray/core/resample.py +++ b/xarray/core/resample.py @@ -188,9 +188,9 @@ def _interpolate(self, kind="linear", **kwargs) -> T_Xarray: # https://github.com/python/mypy/issues/9031 -class DataArrayResample( +class DataArrayResample( # type: ignore[misc] Resample["DataArray"], DataArrayGroupByBase, DataArrayResampleAggregations -): # type: ignore[misc] +): """DataArrayGroupBy object specialized to time resampling operations over a specified dimension """ @@ -331,9 +331,9 @@ def asfreq(self) -> DataArray: # https://github.com/python/mypy/issues/9031 -class DatasetResample( +class DatasetResample( # type: ignore[misc] Resample["Dataset"], DatasetGroupByBase, DatasetResampleAggregations -): # type: ignore[misc] +): """DatasetGroupBy object specialized to resampling a specified dimension""" def map( diff --git a/xarray/namedarray/_array_api.py b/xarray/namedarray/_array_api.py index a8126fe81e1..9cd064b110e 100644 --- a/xarray/namedarray/_array_api.py +++ b/xarray/namedarray/_array_api.py @@ -79,8 +79,8 @@ def astype( def imag( - x: NamedArray[_ShapeType, np.dtype[_SupportsImag[_ScalarType]]], - /, # type: ignore[type-var] + x: NamedArray[_ShapeType, np.dtype[_SupportsImag[_ScalarType]]], # type: ignore[type-var] + /, ) -> NamedArray[_ShapeType, np.dtype[_ScalarType]]: """ Returns the imaginary component of a complex number for each element x_i of the @@ -112,8 +112,8 @@ def imag( def real( - x: NamedArray[_ShapeType, np.dtype[_SupportsReal[_ScalarType]]], - /, # type: ignore[type-var] + x: NamedArray[_ShapeType, np.dtype[_SupportsReal[_ScalarType]]], # type: ignore[type-var] + /, ) -> NamedArray[_ShapeType, np.dtype[_ScalarType]]: """ Returns the real component of a complex number for each element x_i of the diff --git a/xarray/tests/test_coordinates.py b/xarray/tests/test_coordinates.py index 939ff56ebe9..91cb9754f9a 100644 --- a/xarray/tests/test_coordinates.py +++ b/xarray/tests/test_coordinates.py @@ -65,8 +65,9 @@ def test_init_index_error(self) -> None: with pytest.raises(TypeError, match=".* is not an `xarray.indexes.Index`"): Coordinates( - coords={"x": ("x", [1, 2, 3])}, indexes={"x": "not_an_xarray_index"} - ) # type: ignore[dict-item] + coords={"x": ("x", [1, 2, 3])}, + indexes={"x": "not_an_xarray_index"}, # type: ignore[dict-item] + ) def test_init_dim_sizes_conflict(self) -> None: with pytest.raises(ValueError):