Skip to content

Commit abd2068

Browse files
authored
Update to mypy1.7 (#8501)
* fix mypy1.7 errors * pin mypy to <1.8 * add entry to whats-new
1 parent 4550a01 commit abd2068

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

.github/workflows/ci-additional.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
python xarray/util/print_versions.py
118118
- name: Install mypy
119119
run: |
120-
python -m pip install "mypy<1.7" --force-reinstall
120+
python -m pip install "mypy<1.8" --force-reinstall
121121
122122
- name: Run mypy
123123
run: |
@@ -171,7 +171,7 @@ jobs:
171171
python xarray/util/print_versions.py
172172
- name: Install mypy
173173
run: |
174-
python -m pip install "mypy<1.7" --force-reinstall
174+
python -m pip install "mypy<1.8" --force-reinstall
175175
176176
- name: Run mypy
177177
run: |

doc/whats-new.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ Internal Changes
7979
- :py:meth:`DataArray.bfill` & :py:meth:`DataArray.ffill` now use numbagg by
8080
default, which is up to 5x faster where parallelization is possible. (:pull:`8339`)
8181
By `Maximilian Roos <https://github.com/max-sixty>`_.
82+
- Update mypy version to 1.7 (:issue:`8448`, :pull:`8501`).
83+
By `Michael Niklas <https://github.com/headtr1ck>`_.
8284

8385
.. _whats-new.2023.11.0:
8486

xarray/core/alignment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,7 @@ def align(
681681
...
682682

683683

684-
def align( # type: ignore[misc]
684+
def align(
685685
*objects: T_Alignable,
686686
join: JoinOptions = "inner",
687687
copy: bool = True,
@@ -1153,7 +1153,7 @@ def broadcast(
11531153
...
11541154

11551155

1156-
def broadcast( # type: ignore[misc]
1156+
def broadcast(
11571157
*args: T_Alignable, exclude: str | Iterable[Hashable] | None = None
11581158
) -> tuple[T_Alignable, ...]:
11591159
"""Explicitly broadcast any number of DataArray or Dataset objects against

xarray/core/dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7979,8 +7979,8 @@ def sortby(
79797979
variables = variables
79807980
arrays = [v if isinstance(v, DataArray) else self[v] for v in variables]
79817981
aligned_vars = align(self, *arrays, join="left")
7982-
aligned_self = aligned_vars[0]
7983-
aligned_other_vars: tuple[DataArray, ...] = aligned_vars[1:]
7982+
aligned_self = cast("Self", aligned_vars[0])
7983+
aligned_other_vars = cast(tuple[DataArray, ...], aligned_vars[1:])
79847984
vars_by_dim = defaultdict(list)
79857985
for data_array in aligned_other_vars:
79867986
if data_array.ndim != 1:

0 commit comments

Comments
 (0)