Skip to content

Add typing to test_groupby.py - #8890

Merged
dcherian merged 21 commits into
pydata:mainfrom
Illviljan:test_groupby_typing
Mar 29, 2024
Merged

Add typing to test_groupby.py#8890
dcherian merged 21 commits into
pydata:mainfrom
Illviljan:test_groupby_typing

Conversation

@Illviljan

@IllviljanIllviljan commented Mar 29, 2024

Copy link
Copy Markdown
Contributor

Enforce typing on all tests in test_groupby.py and add the remaining type hints.

@dcherian

Copy link
Copy Markdown
Contributor

(suggest deleting ci.yaml and then reverting that so only mypy runs)

@Illviljan
Illviljan marked this pull request as ready for review March 29, 2024 15:37
Comment threadxarray/tests/test_groupby.py
array = self.da
grouped = array.groupby("abc")
actual = grouped.map(np.asarray)
actual = grouped.map(np.asarray) # type: ignore[arg-type] # TODO: Not sure using np.asarray like this makes sense with array api

@IllviljanIllviljanMar 29, 2024

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think mypy is correct to complain here.

Maybe it's this particular example but xp.asarray is always converted to a xp array according to array api, haven't tried it myself but probably numpy 2.0 as well.

The particular issue: #326, #327

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I bet we need to adapt to the new apis here.

Comment threadxarray/tests/test_groupby.py
@dcherian
dcherian merged commit 47ff159 into pydata:mainMar 29, 2024
dcherian added a commit to dcherian/xarray that referenced this pull request Apr 2, 2024
* main: (26 commits)
[pre-commit.ci] pre-commit autoupdate (pydata#8900)
Bump the actions group with 1 update (pydata#8896)
New empty whatsnew entry (pydata#8899)
Update reference to 'Weighted quantile estimators' (pydata#8898)
2024.03.0: Add whats-new (pydata#8891)
Add typing to test_groupby.py (pydata#8890)
Avoid in-place multiplication of a large value to an array with small integer dtype (pydata#8867)
Check for aligned chunks when writing to existing variables (pydata#8459)
Add dt.date to plottable types (pydata#8873)
Optimize writes to existing Zarr stores. (pydata#8875)
Allow multidimensional variable with same name as dim when constructing dataset via coords (pydata#8886)
Don't allow overwriting indexes with region writes (pydata#8877)
Migrate datatree.py module into xarray.core. (pydata#8789)
warn and return bytes undecoded in case of UnicodeDecodeError in h5netcdf-backend (pydata#8874)
groupby: Dispatch quantile to flox. (pydata#8720)
Opt out of auto creating index variables (pydata#8711)
Update docs on view / copies (pydata#8744)
Handle .oindex and .vindex for the PandasMultiIndexingAdapter and PandasIndexingAdapter (pydata#8869)
numpy 2.0 copy-keyword and trapz vs trapezoid (pydata#8865)
upstream-dev CI: Fix interp and cumtrapz (pydata#8861)
...
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Illviljan@dcherian