Skip to content
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 mypy errors in core.py #150

Merged
merged 46 commits into from
Oct 6, 2022
Merged

Conversation

Illviljan
Copy link
Contributor

@Illviljan Illviljan commented Sep 23, 2022

  • Closes Fix typing #96

  • Fix mypy errors in core.py

  • Activate mypy now that it passes

Illviljan and others added 30 commits September 23, 2022 17:23
@Illviljan
Copy link
Contributor Author

WOW, finally passing! :)

@Illviljan Illviljan marked this pull request as ready for review September 27, 2022 17:30
Copy link
Collaborator

@dcherian dcherian left a comment

Choose a reason for hiding this comment

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

👏🏾 👏🏾 👏🏾

flox/core.py Outdated
)
groups = (results["groups"],)
result = results[agg.name]

else:
if TYPE_CHECKING:
assert isinstance(array, DaskArray) # TODO: How else to narrow that .chunk is there?
Copy link
Collaborator

Choose a reason for hiding this comment

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

agg should always have chunk defined? I don't understand your comment.

This code path is only if theere are dask arrays present, so adding the typecheck seems OK to me (but does it actually help?)

Copy link
Contributor Author

@Illviljan Illviljan Sep 28, 2022

Choose a reason for hiding this comment

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

array is still np.array | dask.array at this point, mypy doesn't understand that has_dask implies that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't the daks arrays chunks property. It's chunk on Aggregation. It will exist regardless of array type.

Copy link
Contributor Author

@Illviljan Illviljan Sep 28, 2022

Choose a reason for hiding this comment

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

See line 1636, there's the array.chunks.

I'll fix the typo in the TODO.

flox/core.py Outdated Show resolved Hide resolved
flox/core.py Outdated Show resolved Hide resolved
flox/core.py Show resolved Hide resolved
flox/core.py Show resolved Hide resolved
flox/core.py Show resolved Hide resolved
flox/core.py Show resolved Hide resolved
flox/core.py Show resolved Hide resolved
flox/core.py Outdated Show resolved Hide resolved
flox/core.py Outdated Show resolved Hide resolved
@Illviljan
Copy link
Contributor Author

What say you @dcherian, time to merge?

@dcherian dcherian merged commit 91b6e19 into xarray-contrib:main Oct 6, 2022
@dcherian
Copy link
Collaborator

dcherian commented Oct 6, 2022

Thanks @Illviljan massive effort!

dcherian added a commit that referenced this pull request Oct 9, 2022
* main:
  Update ci-additional.yaml (#167)
  Refactor before redoing cohorts (#164)
  Fix mypy errors in core.py (#150)
  Add link to numpy_groupies (#160)
  Bump codecov/codecov-action from 3.1.0 to 3.1.1 (#159)
  Use math.prod instead of np.prod (#157)
  Remove None output from _get_expected_groups (#152)
  Fix mypy errors in xarray.py, xrutils.py, cache.py (#144)
  Raise error if multiple by's are used with Ellipsis (#149)
  pre-commit autoupdate (#148)
  Add mypy ignores (#146)
  Get pre commit bot to update (#145)
  Remove duplicate examples headers (#147)
  Add ci additional (#143)
  Bump mamba-org/provision-with-micromamba from 12 to 13 (#141)
  Add ASV benchmark CI workflow (#139)
  Fix func count for dtype O with numpy and numba (#138)
dcherian added a commit that referenced this pull request Oct 17, 2022
* main: (29 commits)
  Major fix to subset_to_blocks (#173)
  Performance improvements for cohorts detection (#172)
  Remove split_out (#170)
  Deprecate resample_reduce (#169)
  More efficient cohorts. (#165)
  Allow specifying output dtype (#131)
  Add a dtype check for numpy arrays in assert_equal (#158)
  Update ci-additional.yaml (#167)
  Refactor before redoing cohorts (#164)
  Fix mypy errors in core.py (#150)
  Add link to numpy_groupies (#160)
  Bump codecov/codecov-action from 3.1.0 to 3.1.1 (#159)
  Use math.prod instead of np.prod (#157)
  Remove None output from _get_expected_groups (#152)
  Fix mypy errors in xarray.py, xrutils.py, cache.py (#144)
  Raise error if multiple by's are used with Ellipsis (#149)
  pre-commit autoupdate (#148)
  Add mypy ignores (#146)
  Get pre commit bot to update (#145)
  Remove duplicate examples headers (#147)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix typing
2 participants