Skip to content

TYP: @final for some Index methods #36232

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

Closed
wants to merge 3 commits into from

Conversation

jbrockmendel
Copy link
Member

cc @simonjayhawkins

Tangential question: when I run flake8 it passes, but the pre-commit hook often gives me a bunch of messages like pandas/core/indexes/base.py:956:51: F821 undefined name 'ignore'. Is this something I can fix by pinning a version or something?

@simonjayhawkins
Copy link
Member

Tangential question: when I run flake8 it passes, but the pre-commit hook often gives me a bunch of messages like pandas/core/indexes/base.py:956:51: F821 undefined name 'ignore'. Is this something I can fix by pinning a version or something?

not sure. I don't have pre-comit setup. (One thing that maybe relevant is that pyflakes is currently installed in the dev environment separately to allow mypy error codes #35311 since we have flake8 pinned <3.8.0 #34150)

@simonjayhawkins simonjayhawkins added the Typing type annotations, mypy/pyright type checking label Sep 9, 2020
@simonjayhawkins simonjayhawkins added this to the 1.2 milestone Sep 9, 2020
@simonjayhawkins
Copy link
Member

before we have a dependence on pandas._vendored.typing_extensions, I think we need some sort of tests, see #36000 (comment)

When trying to use Literal and Final types, i'm getting errors like

error: Variable "pandas._vendored.typing_extensions.Final" is not valid as a type  [valid-type]

not sure what i'm doing wrong.

@WillAyd
Copy link
Member

WillAyd commented Sep 9, 2020

Lgtm - I think this is nice to do

@jbrockmendel
Copy link
Member Author

Adding @final incorrectly to get_loc and running mypy, it isn't flagging it as incorrect. It gets flagged correctly if I import final from typing directlyinstead ofpandas._vendored.typing_extensions`. Also if I import from a non-vendored typing_extensions it seems to work.

It also isn't flagging private methods with incorrect final tag, regardless of where i get final from

@jbrockmendel
Copy link
Member Author

since this doesnt appear to have the desired effects, closing to clear the queue

@jbrockmendel jbrockmendel deleted the final branch September 11, 2020 23:01
@jbrockmendel
Copy link
Member Author

@WillAyd @simonjayhawkins do the problems this had have any impact on the original decision to vendor vs depend?

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