@@ -4,18 +4,9 @@ from collections.abc import Iterator, Mapping, Sequence
44from typing import Any , ClassVar , Final , Literal , SupportsIndex , TypeAlias , overload
55from typing_extensions import Self , TypeIs , TypeVar , override
66
7+ import _numtype as _nt
78import numpy as np
89import numpy .typing as npt
9- from _numtype import (
10- Array1D ,
11- CoComplex_0d ,
12- CoComplex_1d ,
13- CoComplex_1nd ,
14- CoInteger_0d ,
15- CoInteger_1d ,
16- ToObject_0d ,
17- ToObject_1nd ,
18- )
1910from numpy ._typing import _FloatLike_co
2011
2112from .polynomial import _ToNumeric_0d , _ToNumeric_nd
@@ -24,9 +15,11 @@ __all__: Final[Sequence[str]] = ("ABCPolyBase",)
2415
2516###
2617
18+ _T = TypeVar ("_T" )
2719_PolyT = TypeVar ("_PolyT" , bound = ABCPolyBase )
2820
29- _AnyOther : TypeAlias = ABCPolyBase | _ToNumeric_0d | CoComplex_1d
21+ _Tuple2 : TypeAlias = tuple [_T , _T ]
22+ _AnyOther : TypeAlias = ABCPolyBase | _ToNumeric_0d | _nt .CoComplex_1d
3023_Hundred : TypeAlias = Literal [100 ]
3124
3225###
@@ -41,7 +34,7 @@ class ABCPolyBase(abc.ABC):
4134 _use_unicode : ClassVar [bool ]
4235 _symbol : str
4336
44- coef : Array1D [np .inexact | np .object_ ]
37+ coef : _nt . Array1D [np .inexact | np .object_ ]
4538
4639 @property
4740 def symbol (self , / ) -> str : ...
@@ -52,32 +45,32 @@ class ABCPolyBase(abc.ABC):
5245 def basis_name (self , / ) -> str | None : ...
5346 @property
5447 @abc .abstractmethod
55- def domain (self , / ) -> Array1D [np .inexact ]: ...
48+ def domain (self , / ) -> _nt . Array1D [np .inexact ]: ...
5649 @property
5750 @abc .abstractmethod
58- def window (self , / ) -> Array1D [np .inexact ]: ...
51+ def window (self , / ) -> _nt . Array1D [np .inexact ]: ...
5952
6053 #
6154 def __init__ (
6255 self ,
6356 / ,
64- coef : CoComplex_1d ,
65- domain : CoComplex_1d | None = None ,
66- window : CoComplex_1d | None = None ,
57+ coef : _nt . CoComplex_1d ,
58+ domain : _nt . CoComplex_1d | None = None ,
59+ window : _nt . CoComplex_1d | None = None ,
6760 symbol : str = "x" ,
6861 ) -> None : ...
6962
7063 #
7164 @overload
7265 def __call__ (self , / , arg : _PolyT ) -> _PolyT : ...
7366 @overload
74- def __call__ (self , / , arg : CoComplex_0d ) -> np . float64 | np . complex128 : ...
67+ def __call__ (self , / , arg : _nt . CoComplex_0d ) -> _nt . inexact64 : ...
7568 @overload
76- def __call__ (self , / , arg : CoComplex_1nd ) -> npt .NDArray [np . float64 | np . complex128 ]: ...
69+ def __call__ (self , / , arg : _nt . CoComplex_1nd ) -> npt .NDArray [_nt . inexact64 ]: ...
7770 @overload
78- def __call__ (self , / , arg : ToObject_0d ) -> Any : ...
71+ def __call__ (self , / , arg : _nt . ToObject_0d ) -> Any : ...
7972 @overload
80- def __call__ (self , / , arg : ToObject_1nd ) -> npt .NDArray [np .object_ ]: ...
73+ def __call__ (self , / , arg : _nt . ToObject_1nd ) -> npt .NDArray [np .object_ ]: ...
8174
8275 #
8376 @override
@@ -132,78 +125,90 @@ class ABCPolyBase(abc.ABC):
132125 #
133126 @overload
134127 def convert (
135- self , / , domain : CoComplex_1d | None = None , kind : None = None , window : CoComplex_1d | None = None
128+ self ,
129+ / ,
130+ domain : _nt .CoComplex_1d | None = None ,
131+ kind : None = None ,
132+ window : _nt .CoComplex_1d | None = None ,
136133 ) -> Self : ...
137134 @overload
138135 def convert (
139- self , / , domain : CoComplex_1d | None , kind : type [_PolyT ], window : CoComplex_1d | None = None
136+ self ,
137+ / ,
138+ domain : _nt .CoComplex_1d | None ,
139+ kind : type [_PolyT ],
140+ window : _nt .CoComplex_1d | None = None ,
140141 ) -> _PolyT : ...
141142 @overload
142143 def convert (
143144 self ,
144145 / ,
145- domain : CoComplex_1d | None = None ,
146+ domain : _nt . CoComplex_1d | None = None ,
146147 * ,
147148 kind : type [_PolyT ],
148- window : CoComplex_1d | None = None ,
149+ window : _nt . CoComplex_1d | None = None ,
149150 ) -> _PolyT : ...
150151
151152 #
152153 def mapparms (self , / ) -> tuple [Any , Any ]: ...
153154 def integ (
154- self , / , m : SupportsIndex = 1 , k : _ToNumeric_0d | CoComplex_1d = [], lbnd : _ToNumeric_0d | None = None
155+ self ,
156+ / ,
157+ m : SupportsIndex = 1 ,
158+ k : _ToNumeric_0d | _nt .CoComplex_1d = [],
159+ lbnd : _ToNumeric_0d | None = None ,
155160 ) -> Self : ...
156161 def deriv (self , / , m : SupportsIndex = 1 ) -> Self : ...
157- def roots (self , / ) -> Array1D [ np . float64 ] | Array1D [np . complex128 ]: ...
162+ def roots (self , / ) -> _nt . Array1D [_nt . inexact64 ]: ...
158163 def linspace (
159164 self ,
160165 / ,
161166 n : SupportsIndex = 100 ,
162- domain : CoComplex_1d | None = None ,
163- ) -> tuple [ Array1D [ np . float64 | np . complex128 ], Array1D [np . float64 | np . complex128 ]]: ...
167+ domain : _nt . CoComplex_1d | None = None ,
168+ ) -> _Tuple2 [ _nt . Array1D [_nt . inexact64 ]]: ...
164169
165170 #
166171 @overload
167172 @classmethod
168173 def fit (
169174 cls ,
170- x : CoComplex_1d ,
171- y : CoComplex_1d ,
172- deg : CoInteger_0d | CoInteger_1d ,
173- domain : CoComplex_1d | None = None ,
175+ x : _nt . CoComplex_1d ,
176+ y : _nt . CoComplex_1d ,
177+ deg : _nt . CoInteger_0d | _nt . CoInteger_1d ,
178+ domain : _nt . CoComplex_1d | None = None ,
174179 rcond : _FloatLike_co | None = None ,
175180 full : Literal [False ] = False ,
176- w : CoComplex_1d | None = None ,
177- window : CoComplex_1d | None = None ,
181+ w : _nt . CoComplex_1d | None = None ,
182+ window : _nt . CoComplex_1d | None = None ,
178183 symbol : str = "x" ,
179184 ) -> Self : ...
180185 @overload
181186 @classmethod
182187 def fit (
183188 cls ,
184- x : CoComplex_1d ,
185- y : CoComplex_1d ,
186- deg : CoInteger_0d | CoInteger_1d ,
187- domain : CoComplex_1d | None ,
189+ x : _nt . CoComplex_1d ,
190+ y : _nt . CoComplex_1d ,
191+ deg : _nt . CoInteger_0d | _nt . CoInteger_1d ,
192+ domain : _nt . CoComplex_1d | None ,
188193 rcond : _FloatLike_co | None ,
189194 full : Literal [True ],
190- w : CoComplex_1d | None = None ,
191- window : CoComplex_1d | None = None ,
195+ w : _nt . CoComplex_1d | None = None ,
196+ window : _nt . CoComplex_1d | None = None ,
192197 symbol : str = "x" ,
193198 ) -> tuple [Self , Sequence [np .inexact | np .int32 ]]: ...
194199 @overload
195200 @classmethod
196201 def fit (
197202 cls ,
198- x : CoComplex_1d ,
199- y : CoComplex_1d ,
200- deg : CoInteger_0d | CoInteger_1d ,
201- domain : CoComplex_1d | None = None ,
203+ x : _nt . CoComplex_1d ,
204+ y : _nt . CoComplex_1d ,
205+ deg : _nt . CoInteger_0d | _nt . CoInteger_1d ,
206+ domain : _nt . CoComplex_1d | None = None ,
202207 rcond : _FloatLike_co | None = None ,
203208 * ,
204209 full : Literal [True ],
205- w : CoComplex_1d | None = None ,
206- window : CoComplex_1d | None = None ,
210+ w : _nt . CoComplex_1d | None = None ,
211+ window : _nt . CoComplex_1d | None = None ,
207212 symbol : str = "x" ,
208213 ) -> tuple [Self , Sequence [np .inexact | np .int32 ]]: ...
209214
@@ -212,31 +217,31 @@ class ABCPolyBase(abc.ABC):
212217 def fromroots (
213218 cls ,
214219 roots : _ToNumeric_nd ,
215- domain : CoComplex_1d | None = [],
216- window : CoComplex_1d | None = None ,
220+ domain : _nt . CoComplex_1d | None = [],
221+ window : _nt . CoComplex_1d | None = None ,
217222 symbol : str = "x" ,
218223 ) -> Self : ...
219224 @classmethod
220225 def identity (
221226 cls ,
222- domain : CoComplex_1d | None = None ,
223- window : CoComplex_1d | None = None ,
227+ domain : _nt . CoComplex_1d | None = None ,
228+ window : _nt . CoComplex_1d | None = None ,
224229 symbol : str = "x" ,
225230 ) -> Self : ...
226231 @classmethod
227232 def basis (
228233 cls ,
229234 deg : SupportsIndex ,
230- domain : CoComplex_1d | None = None ,
231- window : CoComplex_1d | None = None ,
235+ domain : _nt . CoComplex_1d | None = None ,
236+ window : _nt . CoComplex_1d | None = None ,
232237 symbol : str = "x" ,
233238 ) -> Self : ...
234239 @classmethod
235240 def cast (
236241 cls ,
237242 series : ABCPolyBase ,
238- domain : CoComplex_1d | None = None ,
239- window : CoComplex_1d | None = None ,
243+ domain : _nt . CoComplex_1d | None = None ,
244+ window : _nt . CoComplex_1d | None = None ,
240245 ) -> Self : ...
241246
242247 #
0 commit comments