-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: Annotated pandas/core/indexing.py #29908
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
return True | ||
|
||
def _has_valid_positional_setitem_indexer(self, indexer): | ||
def _has_valid_positional_setitem_indexer(self, indexer) -> bool: |
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.
it looks like this always either raises or returns True; is that accurate? if so, maybe get rid of the return value altogether (might need to update 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.
I don't feel confident enough in reformatting this function, I'll leave it for someone else who will probably won't break the package.
@@ -2523,7 +2523,7 @@ def _maybe_numeric_slice(df, slice_, include_bool=False): | |||
return slice_ | |||
|
|||
|
|||
def _can_do_equal_len(labels, value, plane_indexer, lplane_indexer, obj): | |||
def _can_do_equal_len(labels, value, plane_indexer, lplane_indexer, obj) -> bool: |
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.
can any of the args here be typed?
# select a label or row | ||
return not isinstance(key, slice) and not is_list_like_indexer(key) | ||
|
||
|
||
def need_slice(obj): | ||
def need_slice(obj) -> bool: |
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.
seems like obj will be a slice?
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. I think additional types as proposed by @jbrockmendel would be nice if not too much extra effort
The problem is that I don't know how to annotate them:( |
OK thanks @MomIsBestFriend . Sure can always add more types as you get more familiar with code base |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff