Skip to content

TYP: overriding of final methods #42926

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
twoertwein opened this issue Aug 7, 2021 · 3 comments
Closed

TYP: overriding of final methods #42926

twoertwein opened this issue Aug 7, 2021 · 3 comments
Labels
Bug Typing type annotations, mypy/pyright type checking

Comments

@twoertwein
Copy link
Member

pyright says that a few methods that are marked with typing.Final are overridden:

pandas/core/frame.py:4552:9 - error: Method "_reindex_axes" cannot override final method defined in class "NDFrame"
pandas/core/frame.py:10727:9 - error: Method "mask" cannot override final method defined in class "NDFrame"
pandas/core/series.py:5446:9 - error: Method "mask" cannot override final method defined in class "NDFrame"
pandas/core/groupby/generic.py:676:9 - error: Method "describe" cannot override final method defined in class "GroupBy"
pandas/core/groupby/generic.py:856:9 - error: Method "pct_change" cannot override final method defined in class "GroupBy"
@twoertwein twoertwein added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 7, 2021
@jbrockmendel
Copy link
Member

why isn't mypy catching these?

@lithomas1 lithomas1 added Typing type annotations, mypy/pyright type checking and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 11, 2021
@lithomas1 lithomas1 added this to the Contributions Welcome milestone Aug 11, 2021
@simonjayhawkins
Copy link
Member

why isn't mypy catching these?

see python/mypy#9618

if indeed we add types to _reindex_axes in pandas/core/frame.py we get pandas/core/frame.py:4552: error: Cannot override final attribute "_reindex_axes" (previously declared in base class "NDFrame") [misc]

@twoertwein
Copy link
Member Author

I think this has quietly been fixed :)

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

No branches or pull requests

4 participants