-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
Using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good to me.
Does this fix #7270?
@@ -2042,7 +2042,7 @@ def test_seaborn_palette_as_cmap(self) -> None: | |||
def test_convenient_facetgrid(self) -> None: | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, nothing we can do about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.