Fix typing errors using mypy 1.2#7752
Conversation
|
Before: |
for more information, see https://pre-commit.ci
…into use_newest_mypy
for more information, see https://pre-commit.ci
|
The mypy 3.9 CI keeps installing the old version which hinders installing a new version with DetailsUsing |
| a = easy_array((10, 15, 4)) | ||
| d = DataArray(a, dims=["y", "x", "z"]) | ||
| g = self.plotfunc(d, x="x", y="y", col="z", col_wrap=2) | ||
| g = self.plotfunc(d, x="x", y="y", col="z", col_wrap=2) # type: ignore[arg-type] # https://github.com/python/mypy/issues/15015 |
There was a problem hiding this comment.
This errors with
xarray/tests/test_plot.py:2045: error: Argument "col" has incompatible type "str"; expected "None" [arg-type]
self.plotfunc is a staticmethod and it seems that mypy only chooses one of the overloads for that plotfunc.
Might be related to python/mypy#15015.
There was a problem hiding this comment.
Well, nothing we can do about it.
There was a problem hiding this comment.
Refactoring the tests without the staticmethod trick was an idea I had, but I'm not in the mood for such a large rewrite.
There was a problem hiding this comment.
Haha yes, I also thought about this several times already. Just too large of a refactor with almost no gains...
* main: (34 commits) Update whats-new.rst Fix binning by unsorted array (pydata#7762) Bump codecov/codecov-action from 3.1.1 to 3.1.2 (pydata#7760) Fix typing errors using mypy 1.2 (pydata#7752) [skip-ci] dev whats-new Add whats-new for v2023.04.0 (pydata#7757) remove the `black` hook (pydata#7756) reword the what's new entry for the `pandas` 2.0 dtype changes (pydata#7755) restructure the contributing guide (pydata#7681) Continue to use nanosecond-precision Timestamps in precision-sensitive areas (pydata#7731) minor doc updates to clarify extensions using accessors (pydata#7751) align: Avoid reindexing when join="exact" (pydata#7736) `pandas=2.0` support (pydata#7724) Clarify vectorized indexing documentation (pydata#7747) Avoid recasting a CFTimeIndex (pydata#7735) fix typo (pydata#7746) [pre-commit.ci] pre-commit autoupdate (pydata#7745) Bump pypa/gh-action-pypi-publish from 1.8.4 to 1.8.5 (pydata#7743) preserve boolean dtype in encoding (pydata#7720) [skip-ci] Add alignment benchmarks (pydata#7738) ...
Fixes typing errors when using newest mypy version.