-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYP: annotate core.algorithms #33944
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
Conversation
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.
lgtm. Like the dtype changes for sure
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 @jbrockmendel generally lgtm. comments not blockers
def _reconstruct_data(values, dtype, original): | ||
def _reconstruct_data( | ||
values: ArrayLike, dtype: DtypeObj, original: AnyArrayLike | ||
) -> ArrayLike: |
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.
ArrayLike is a typevar. is the return type here always the same as the type of values? or dependant on dtype.
maybe just expand on the prose in the docstring till this bites us.
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.
ArrayLike is a typevar. is the return type here always the same as the type of values? or dependant on dtype.
Yikes, I think I've been using it incorrectly in a lot of places then. Ive been using it as a synonym for Union[np.ndarray, ExtensionArray]
. I guess I'll do a dedicated pass through the code to weed out those mis-usages
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.
Ive been using it as a synonym for
Union[np.ndarray, ExtensionArray]
This is OK if the alias only appears once in the function signature/return.
once it appears twice, then they are bound.
original : ndarray-like | ||
values : np.ndarray or ExtensionArray | ||
dtype : np.ndtype or ExtensionDtype | ||
original : AnyArrayLike |
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.
nitpick, values and dtype are 'expanded' aliases, do the same for AnyArrayLike?
again maybe more prose, is Index only allowed with bool_dtype? what about Series?
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.
AFAICT it can be Index or Series regardless of dtype, whatever was passed to the top-level fucntion
I'd like to push this through and handle comments in the next pass, since this is green and the CI is currently failing. (ditto for #33935) |
Thanks @jbrockmendel |
No description provided.