Skip to content

Commit 86f9414

Browse files
committed
👽️ add strings.slice
1 parent 83aa3b2 commit 86f9414

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/numpy-stubs/_core/strings.pyi

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ __all__ = [
6262
"rjust",
6363
"rpartition",
6464
"rstrip",
65+
"slice",
6566
"startswith",
6667
"str_len",
6768
"strip",
@@ -239,6 +240,32 @@ def translate(a: _nt.ToBytes_nd, table: str, deletechars: str | None = None) ->
239240
@overload
240241
def translate(a: _nt.ToString_nd, table: str, deletechars: str | None = None) -> _nt.StringArray: ...
241242

243+
#
244+
@overload
245+
def slice(
246+
a: _nt.ToStr_nd,
247+
start: _nt.ToInteger_nd | None = None,
248+
stop: _nt.ToInteger_nd | None = None,
249+
step: _nt.ToInteger_nd | None = None,
250+
/,
251+
) -> _StrND: ...
252+
@overload
253+
def slice(
254+
a: _nt.ToBytes_nd,
255+
start: _nt.ToInteger_nd | None = None,
256+
stop: _nt.ToInteger_nd | None = None,
257+
step: _nt.ToInteger_nd | None = None,
258+
/,
259+
) -> _BytesND: ...
260+
@overload
261+
def slice(
262+
a: _nt.ToString_nd,
263+
start: _nt.ToInteger_nd | None = None,
264+
stop: _nt.ToInteger_nd | None = None,
265+
step: _nt.ToInteger_nd | None = None,
266+
/,
267+
) -> _nt.StringArray: ...
268+
242269
#
243270
@overload
244271
def lstrip(a: _nt.ToStr_nd, chars: _nt.ToStr_nd | None = None) -> _StrND: ...

src/numpy-stubs/strings/__init__.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ from numpy._core.strings import (
3636
rjust,
3737
rpartition,
3838
rstrip,
39+
slice,
3940
startswith,
4041
str_len,
4142
strip,
@@ -84,6 +85,7 @@ __all__ = [
8485
"rjust",
8586
"rpartition",
8687
"rstrip",
88+
"slice",
8789
"startswith",
8890
"str_len",
8991
"strip",

0 commit comments

Comments
 (0)