@@ -11,7 +11,7 @@ from typing import (
11
11
overload ,
12
12
)
13
13
14
- import numpy as np
14
+ import numpy . typing as npt
15
15
import pandas as pd
16
16
from pandas import (
17
17
DataFrame ,
@@ -21,9 +21,13 @@ from pandas import (
21
21
)
22
22
from pandas .core .base import NoNewAttributesMixin
23
23
24
+ from pandas ._libs .tslibs .nattype import NaTType
24
25
from pandas ._typing import (
25
26
JoinHow ,
27
+ Scalar ,
26
28
T ,
29
+ UnknownIndex ,
30
+ UnknownSeries ,
27
31
np_ndarray_bool ,
28
32
)
29
33
@@ -58,7 +62,7 @@ class StringMethods(NoNewAttributesMixin, Generic[T, _TS, _TM, _TS2]):
58
62
@overload
59
63
def cat (
60
64
self ,
61
- others : Series | pd .Index | pd . DataFrame | np . ndarray | list [Any ],
65
+ others : UnknownIndex | pd .DataFrame | npt . NDArray [ Any ] | list [Any ],
62
66
sep : str = ...,
63
67
na_rep : str | None = ...,
64
68
join : JoinHow = ...,
@@ -106,10 +110,10 @@ class StringMethods(NoNewAttributesMixin, Generic[T, _TS, _TM, _TS2]):
106
110
def join (self , sep : str ) -> T : ...
107
111
def contains (
108
112
self ,
109
- pat : str | re .Pattern ,
113
+ pat : str | re .Pattern [ str ] ,
110
114
case : bool = ...,
111
115
flags : int = ...,
112
- na = ...,
116
+ na : Scalar | NaTType | None = ...,
113
117
regex : bool = ...,
114
118
) -> Series [bool ]: ...
115
119
def match (
@@ -118,7 +122,7 @@ class StringMethods(NoNewAttributesMixin, Generic[T, _TS, _TM, _TS2]):
118
122
def replace (
119
123
self ,
120
124
pat : str ,
121
- repl : str | Callable [[re .Match ], str ],
125
+ repl : str | Callable [[re .Match [ str ] ], str ],
122
126
n : int = ...,
123
127
case : bool | None = ...,
124
128
flags : int = ...,
@@ -160,7 +164,7 @@ class StringMethods(NoNewAttributesMixin, Generic[T, _TS, _TM, _TS2]):
160
164
def count (self , pat : str , flags : int = ...) -> Series [int ]: ...
161
165
def startswith (self , pat : str | tuple [str , ...], na : Any = ...) -> Series [bool ]: ...
162
166
def endswith (self , pat : str | tuple [str , ...], na : Any = ...) -> Series [bool ]: ...
163
- def findall (self , pat : str , flags : int = ...) -> Series : ...
167
+ def findall (self , pat : str , flags : int = ...) -> UnknownSeries : ...
164
168
@overload
165
169
def extract (
166
170
self , pat : str , flags : int = ..., * , expand : Literal [True ] = ...
0 commit comments