Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TYP: Modernized numpy.dtypes annotations #27419

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 4 commits into from
Sep 18, 2024

Conversation

jorenham
Copy link
Member

This improves the type-hints of numpy.dtypes for users and static-type checkers, in a backwards-compatible manner:

  • Use Self for self types
  • Ignored some (unavoidable) mypy errors (related to numpy.dtype being @final, and StringDType not having a scalar type)
  • Mark stub-only private helper classes with @type_check_only
  • Allow omitting the "itemsize" type-argument in (Bytes|Str|Void)DType by using type parameter defaults

See #27132 for details on the use of typing_extensions in .pyi stubs

@charris charris merged commit 79bcbca into numpy:main Sep 18, 2024
68 checks passed
@charris
Copy link
Member

charris commented Sep 18, 2024

Thanks @jorenham .

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