Skip to content

Commit

Permalink
Upgrade mypy to 1.15 (#10041)
Browse files Browse the repository at this point in the history
Seems easy locally; maybe too easy and something will break in CI...
  • Loading branch information
max-sixty authored Feb 10, 2025
1 parent 1873874 commit c8f7dc6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-additional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
python xarray/util/print_versions.py
- name: Install mypy
run: |
python -m pip install "mypy==1.13" --force-reinstall
python -m pip install "mypy==1.15" --force-reinstall
- name: Run mypy
run: |
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:
python xarray/util/print_versions.py
- name: Install mypy
run: |
python -m pip install "mypy==1.13" --force-reinstall
python -m pip install "mypy==1.15" --force-reinstall
- name: Run mypy
run: |
Expand Down
6 changes: 2 additions & 4 deletions xarray/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,8 +1606,7 @@ def reduce_array(ar: DataArray) -> DataArray:
return self.map(reduce_array, shortcut=shortcut)


# https://github.com/python/mypy/issues/9031
class DataArrayGroupBy( # type: ignore[misc]
class DataArrayGroupBy(
DataArrayGroupByBase,
DataArrayGroupByAggregations,
ImplementsArrayReduce,
Expand Down Expand Up @@ -1774,8 +1773,7 @@ def assign(self, **kwargs: Any) -> Dataset:
return self.map(lambda ds: ds.assign(**kwargs))


# https://github.com/python/mypy/issues/9031
class DatasetGroupBy( # type: ignore[misc]
class DatasetGroupBy(
DatasetGroupByBase,
DatasetGroupByAggregations,
ImplementsDatasetReduce,
Expand Down
2 changes: 1 addition & 1 deletion xarray/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def __init__(self, key: tuple[slice | np.ndarray[Any, np.dtype[np.generic]], ...
)
if ndim is None:
ndim = k.ndim # type: ignore[union-attr]
elif ndim != k.ndim:
elif ndim != k.ndim: # type: ignore[union-attr]
ndims = [k.ndim for k in key if isinstance(k, np.ndarray)]
raise ValueError(
"invalid indexer key: ndarray arguments "
Expand Down
6 changes: 2 additions & 4 deletions xarray/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@ def _interpolate(self, kind="linear", **kwargs) -> T_Xarray:
)


# https://github.com/python/mypy/issues/9031
class DataArrayResample( # type: ignore[misc]
class DataArrayResample(
Resample["DataArray"], DataArrayGroupByBase, DataArrayResampleAggregations
):
"""DataArrayGroupBy object specialized to time resampling operations over a
Expand Down Expand Up @@ -375,8 +374,7 @@ def asfreq(self) -> DataArray:
return self.mean(None if self._dim is None else [self._dim])


# https://github.com/python/mypy/issues/9031
class DatasetResample( # type: ignore[misc]
class DatasetResample(
Resample["Dataset"], DatasetGroupByBase, DatasetResampleAggregations
):
"""DatasetGroupBy object specialized to resampling a specified dimension"""
Expand Down

0 comments on commit c8f7dc6

Please sign in to comment.