-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: misc typing cleanup in core/indexes/multi.py #36007
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: misc typing cleanup in core/indexes/multi.py #36007
Conversation
pandas/core/indexes/multi.py
Outdated
@@ -2435,7 +2453,7 @@ def _get_partial_string_timestamp_match_key(self, key): | |||
if isinstance(key, str) and self.levels[0]._supports_partial_string_indexing: | |||
# Convert key '2016-01-01' to | |||
# ('2016-01-01'[, slice(None, None, None)]+) | |||
key = tuple([key] + [slice(None)] * (len(self.levels) - 1)) | |||
key = tuple((key, *([slice(None)] * (len(self.levels) - 1)))) |
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 find this less clear than the status quo. what about (key,) + (slice(None),) * num
?
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.
Yea I agree here; if there's a way to do this without unpacking would read a lot more clearly
Alternately can be split into separate lines
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.
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
thanks @simonjayhawkins |
* TYP: misc typing cleanup in core/indexes/multi.py * update per comments
pandas\core\indexes\multi.py:496: error: Need type annotation for 'arrays' [var-annotated]
pandas\core\indexes\multi.py:722: error: Incompatible types in assignment (expression has type "List[Any]", variable has type "FrozenList") [assignment]
pandas\core\indexes\multi.py:893: error: Incompatible types in assignment (expression has type "List[Any]", variable has type "FrozenList") [assignment]
pandas\core\indexes\multi.py:2438: error: List item 0 has incompatible type "slice"; expected "str" [list-item]
pandas\core\indexes\multi.py:3095: error: Unsupported left operand type for | ("None") [operator]