1+ import abc
12import sys
23from collections .abc import Iterator , Mapping , Sequence
34from typing import (
@@ -15,18 +16,24 @@ from typing import (
1516
1617import numpy as np
1718import numpy .typing as npt
18- from numpy ._typing import _ArrayLikeInt_co
1919
2020from ._polytypes import (
21- _AnyInt ,
21+ _AnyComplexSeries1D ,
22+ _AnyIntArg ,
2223 _AnyComplexScalar ,
2324 _AnyComplexSeriesND ,
25+ _AnyIntSeries1D ,
26+ _AnyObjectSeries1D ,
2427 _AnyObjectSeriesND ,
28+ _AnyRealScalar ,
29+ _AnyRealSeries1D ,
2530 _AnyScalar ,
2631 _AnySeries1D ,
2732 _AnySeriesND ,
33+ _Array1D ,
2834 _Array2 ,
2935 _CoefArray1D ,
36+ _ComplexArrayND ,
3037 _SupportsLenAndGetItem ,
3138 _Tuple2 ,
3239)
@@ -43,12 +50,11 @@ __all__ = ["ABCPolyBase"]
4350
4451_NameCo = TypeVar ("_NameCo" , bound = None | LiteralString , covariant = True )
4552_Self = TypeVar ("_Self" , bound = "ABCPolyBase" )
46- _Size = TypeVar ("_Size" , bound = int )
4753
4854_AnyOther : TypeAlias = ABCPolyBase | _AnyScalar | _AnySeries1D
4955_Hundred : TypeAlias = Literal [100 ]
5056
51- class ABCPolyBase (Generic [_NameCo ]):
57+ class ABCPolyBase (Generic [_NameCo ], metaclass = abc . ABCMeta ):
5258 __hash__ : ClassVar [None ] # type: ignore[assignment]
5359 __array_ufunc__ : ClassVar [None ]
5460
@@ -67,8 +73,7 @@ class ABCPolyBase(Generic[_NameCo]):
6773 def symbol (self , / ) -> LiteralString : ...
6874
6975 def __init__ (
70- self ,
71- / ,
76+ self , / ,
7277 coef : _AnySeries1D ,
7378 domain : None | _AnySeries1D = ...,
7479 window : None | _AnySeries1D = ...,
@@ -132,35 +137,35 @@ class ABCPolyBase(Generic[_NameCo]):
132137 def has_samecoef (self , / , other : ABCPolyBase ) -> bool : ...
133138 def has_samedomain (self , / , other : ABCPolyBase ) -> bool : ...
134139 def has_samewindow (self , / , other : ABCPolyBase ) -> bool : ...
135- def has_sametype (self : _Self , / , other : object ) -> TypeGuard [_Self ]: ...
140+ @overload
141+ def has_sametype (self : _Self , / , other : ABCPolyBase ) -> TypeGuard [_Self ]: ...
142+ @overload
143+ def has_sametype (self , / , other : object ) -> Literal [False ]: ...
136144
137145 def copy (self : _Self , / ) -> _Self : ...
138146 def degree (self , / ) -> int : ...
139147 def cutdeg (self : _Self , / ) -> _Self : ...
140- def trim (self : _Self , / , tol : float = ...) -> _Self : ...
141- def truncate (self : _Self , / , size : _AnyInt ) -> _Self : ...
148+ def trim (self : _Self , / , tol : _AnyRealScalar = ...) -> _Self : ...
149+ def truncate (self : _Self , / , size : _AnyIntArg ) -> _Self : ...
142150
143151 @overload
144152 def convert (
145153 self ,
146154 domain : None | _AnySeries1D ,
147- kind : type [_Self ],
148- / ,
155+ kind : type [_Self ], / ,
149156 window : None | _AnySeries1D = ...,
150157 ) -> _Self : ...
151158 @overload
152159 def convert (
153- self ,
154- / ,
160+ self , / ,
155161 domain : None | _AnySeries1D = ...,
156162 * ,
157163 kind : type [_Self ],
158164 window : None | _AnySeries1D = ...,
159165 ) -> _Self : ...
160166 @overload
161167 def convert (
162- self : _Self ,
163- / ,
168+ self : _Self , / ,
164169 domain : None | _AnySeries1D = ...,
165170 kind : type [_Self ] = ...,
166171 window : None | _AnySeries1D = ...,
@@ -169,8 +174,7 @@ class ABCPolyBase(Generic[_NameCo]):
169174 def mapparms (self , / ) -> _Tuple2 [Any ]: ...
170175
171176 def integ (
172- self: _Self ,
173- / ,
177+ self : _Self , / ,
174178 m : SupportsIndex = ...,
175179 k : _AnyComplexScalar | _SupportsLenAndGetItem [_AnyComplexScalar ] = ...,
176180 lbnd : None | _AnyComplexScalar = ...,
@@ -180,37 +184,21 @@ class ABCPolyBase(Generic[_NameCo]):
180184
181185 def roots (self , / ) -> _CoefArray1D : ...
182186
183- @overload
184187 def linspace (
185- self ,
186- / ,
187- n : _Size ,
188- domain : None | _AnySeries1D = ...,
189- ) -> tuple [
190- np .ndarray [tuple [_Size ], np .dtype [np .float64 ]],
191- np .ndarray [tuple [_Size ], np .dtype [np .float64 | np .complex128 ]],
192- ]: ...
193- @overload
194- def linspace (
195- self ,
196- / ,
197- n : _Hundred = ...,
188+ self , / ,
189+ n : SupportsIndex = ...,
198190 domain : None | _AnySeries1D = ...,
199- ) -> tuple [
200- np .ndarray [tuple [_Hundred ], np .dtype [np .float64 ]],
201- np .ndarray [tuple [_Hundred ], np .dtype [np .float64 | np .complex128 ]],
202- ]: ...
191+ ) -> _Tuple2 [_Array1D [np .float64 | np .complex128 ]]: ...
203192
204193 @overload
205194 @classmethod
206195 def fit (
207- cls : type [_Self ],
208- / ,
196+ cls : type [_Self ], / ,
209197 x : _AnySeries1D ,
210198 y : _AnySeries1D ,
211- deg : _ArrayLikeInt_co ,
199+ deg : int | _AnyIntSeries1D ,
212200 domain : None | _AnySeries1D = ...,
213- rcond : float = ...,
201+ rcond : _AnyRealScalar = ...,
214202 full : Literal [False ] = ...,
215203 w : None | _AnySeries1D = ...,
216204 window : None | _AnySeries1D = ...,
@@ -222,9 +210,9 @@ class ABCPolyBase(Generic[_NameCo]):
222210 cls : type [_Self ], / ,
223211 x : _AnySeries1D ,
224212 y : _AnySeries1D ,
225- deg : _ArrayLikeInt_co ,
213+ deg : int | _AnyIntSeries1D ,
226214 domain : None | _AnySeries1D = ...,
227- rcond : float = ...,
215+ rcond : _AnyRealScalar = ...,
228216 * ,
229217 full : Literal [True ],
230218 w : None | _AnySeries1D = ...,
@@ -237,46 +225,44 @@ class ABCPolyBase(Generic[_NameCo]):
237225 cls : type [_Self ],
238226 x : _AnySeries1D ,
239227 y : _AnySeries1D ,
240- deg : _ArrayLikeInt_co ,
228+ deg : int | _AnyIntSeries1D ,
241229 domain : None | _AnySeries1D ,
242- rcond : float ,
243- full : Literal [True ],
244- / ,
230+ rcond : _AnyRealScalar ,
231+ full : Literal [True ], / ,
245232 w : None | _AnySeries1D = ...,
246233 window : None | _AnySeries1D = ...,
247234 symbol : str = ...,
248235 ) -> tuple [_Self , Sequence [np .inexact [Any ] | np .int32 ]]: ...
249236
250237 @classmethod
251238 def fromroots (
252- cls : type [_Self ],
253- / ,
239+ cls : type [_Self ], / ,
254240 roots : _AnySeriesND ,
255241 domain : None | _AnySeries1D = ...,
256242 window : None | _AnySeries1D = ...,
243+ symbol : str = ...,
257244 ) -> _Self : ...
258245
259246 @classmethod
260247 def identity (
261- cls : type [_Self ],
262- / ,
248+ cls : type [_Self ], / ,
263249 domain : None | _AnySeries1D = ...,
264250 window : None | _AnySeries1D = ...,
251+ symbol : str = ...,
265252 ) -> _Self : ...
266253
267254 @classmethod
268255 def basis (
269- cls : type [_Self ],
270- / ,
<
908D
/tr>271- deg : int ,
256+ cls : type [_Self ], / ,
257+ deg : _AnyIntArg ,
272258 domain : None | _AnySeries1D = ...,
273259 window : None | _AnySeries1D = ...,
260+ symbol : str = ...,
274261 ) -> _Self : ...
275262
276263 @classmethod
277264 def cast (
278- cls : type [_Self ],
279- / ,
265+ cls : type [_Self ], / ,
280266 series : ABCPolyBase ,
281267 domain : None | _AnySeries1D = ...,
282268 window : None | _AnySeries1D = ...,
0 commit comments