-
Notifications
You must be signed in to change notification settings - Fork 18
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 - chunk_reduce #154
Conversation
dict | ||
""" | ||
|
||
if not (isinstance(func, str) or callable(func)): |
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.
I llike this but we shoudl do this at the groupby_reduce
level. Otherwise for dask stuff it will only raise at compute time. Unless you're checking that we've created Aggregation
objects correctly.
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 is to make sure funcs
is always a sequence. chunk_reduce
is used on too many places though, it would require too many unrelated typing changes. I think it's for another PR once the mypy CI is active.
dtypes = dtype | ||
else: | ||
dtypes = (dtype,) * nfuncs | ||
assert len(dtypes) >= nfuncs |
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.
assert len(dtypes) >= nfuncs | |
assert len(dtypes) == nfuncs |
IMO we should be more strict here. This looseness has resulted in bugs/confusions before
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.
Agreed.
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.
Ok, I tried it out and some parts of the code actually relies on this behaviour. >=
was in the original code so I'm going to leave it the same in this PR.
Splitting up #150 as I had trouble finding typos.