Skip to content

TYP: RangeIndex._constructor #43387

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 Sep 3, 2021 · 1 comment · Fixed by #43828
Closed

TYP: RangeIndex._constructor #43387

twoertwein opened this issue Sep 3, 2021 · 1 comment · Fixed by #43828
Labels
Typing type annotations, mypy/pyright type checking
Milestone

Comments

@twoertwein
Copy link
Member

RangeIndex._constructor returns Type[Int64Index] but it is supposed to return the current type of the class itself (Type[RangeIndex]) .

pandas/core/indexes/range.py:179: error: Return type "Type[Int64Index]" of "_constructor" incompatible with return type "Type[RangeIndex]" in supertype "Index" [override]

Found by declaring cache_readonly = property.

@twoertwein twoertwein added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 3, 2021
@twoertwein
Copy link
Member Author

Very similar issue here again:
pandas/core/indexes/multi.py:1098: error: Return type "Callable[..., MultiIndex]" of "_constructor" incompatible with return type "Type[MultiIndex]" in supertype "Index" [override]

Probably need to change Index._constructor or ignore these two cases.

@simonjayhawkins simonjayhawkins added Typing type annotations, mypy/pyright type checking and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 4, 2021
@simonjayhawkins simonjayhawkins added this to the Contributions Welcome milestone Sep 4, 2021
@simonjayhawkins simonjayhawkins modified the milestones: Contributions Welcome, 1.4 Oct 21, 2021
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 a pull request may close this issue.

2 participants