Skip to content

TYP: Fix the annotations of ndarray.real and ndarray.imag #27753

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
merged 1 commit into from
Nov 14, 2024

Conversation

jorenham
Copy link
Member

This fixes the incorrect getter annotations of the ndarray.real and ndarray.imag properties using the same trick as in #27750.
For some reason this wasn't causing issues with mypy before, but pyright wasn't able to properly infer their return types.


I combined the (private & type-check-only) _supportsReal and _supportsItem because in practice, real and imag always go hand in hand. And if they don't; then it's probably not what want anyway.

@charris charris merged commit e0eee7f into numpy:main Nov 14, 2024
70 checks passed
@charris
Copy link
Member

charris commented Nov 14, 2024

Thanks Joren.

@jorenham jorenham deleted the typing/ndarray.real-imag branch November 14, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants