Skip to content

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

Merged

Conversation

simonjayhawkins
Copy link
Member

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]

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Aug 31, 2020
@@ -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))))
Copy link
Member

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?

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

@simonjayhawkins simonjayhawkins added this to the 1.2 milestone Sep 1, 2020
Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jbrockmendel jbrockmendel merged commit fd6a55f into pandas-dev:master Sep 1, 2020
@jbrockmendel
Copy link
Member

thanks @simonjayhawkins

@simonjayhawkins simonjayhawkins deleted the pandas/core/indexes/multi.py branch September 1, 2020 16:33
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
* TYP: misc typing cleanup in core/indexes/multi.py

* update per comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typing type annotations, mypy/pyright type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants