-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYP: assorted annotations #39798
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
TYP: assorted annotations #39798
Conversation
pandas/core/algorithms.py
Outdated
def _take_2d_multi_object(arr, indexer, out, fill_value, mask_info): | ||
def _take_2d_multi_object( | ||
arr: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value, mask_info | ||
): |
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.
): | |
): -> None |
(and similarly for some others, while we're here?)
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.
im ambivalent about the -> None
pattern
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.
why these are easy to annotate
and make it super obvious what is happening
we should always type void
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.
Updated + green
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.
looks fine. small comments can be in a followon.
cc @simonjayhawkins for typing
@@ -263,7 +263,7 @@ def _reconstruct_data( | |||
return values | |||
|
|||
|
|||
def _ensure_arraylike(values): | |||
def _ensure_arraylike(values) -> 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.
is_array_like is True for Series and Index so the return type should probably be AnyArrayLike
Also avoid passing unnecesary arg to libreduction, and use a lower-level sanitize function in sanitize_index