Skip to content

TYP: annotate strings.slice #29048

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
May 25, 2025
Merged

Conversation

jorenham
Copy link
Member

@jorenham jorenham commented May 25, 2025

The new numpy.strings.slice function (#27789) was missing from the typing stubs. So here it is.

@jorenham jorenham added 09 - Backport-Candidate PRs tagged should be backported 41 - Static typing labels May 25, 2025
@jorenham jorenham added this to the 2.3.0 release milestone May 25, 2025
@jorenham
Copy link
Member Author

It would be nice if this could be smuggled into the 2.3 branch before the grand premiere :)


#
@overload
def slice(a: U_co, start: i_co | None = None, stop: i_co | None = None, step: i_co | None = None, /) -> NDArray[np.str_]: ... # type: ignore[overload-overlap]
Copy link
Member Author

@jorenham jorenham May 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I # type: ignore'd this mypy error because I believe that it's a false positive. This seems to be in line with what pyright believes, because it doesn't report an error here.

@jorenham jorenham force-pushed the typing/strings.slice branch 2 times, most recently from ea61465 to 89cf1fa Compare May 25, 2025 01:20
@jorenham jorenham force-pushed the typing/strings.slice branch from 89cf1fa to 4c1eb70 Compare May 25, 2025 01:23
@charris charris merged commit 3c995e7 into numpy:main May 25, 2025
76 checks passed
@charris
Copy link
Member

charris commented May 25, 2025

Thanks Joren.

@jorenham jorenham deleted the typing/strings.slice branch May 25, 2025 20:32
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label May 27, 2025
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy