@@ -13,14 +13,12 @@ from typing import (
1313)
1414
1515import numpy as np
16- import pandas as pd
17- from pandas import (
18- DatetimeIndex ,
19- Index ,
20- PeriodIndex ,
21- Series ,
22- TimedeltaIndex ,
23- )
16+ from numpy import typing as npt
17+ from pandas .core .indexes .base import Index
18+ from pandas .core .indexes .datetimes import DatetimeIndex
19+ from pandas .core .indexes .period import PeriodIndex
20+ from pandas .core .indexes .timedeltas import TimedeltaIndex
21+ from pandas .core .series import Series
2422from typing_extensions import Self
2523
2624from pandas ._libs .tslibs import (
@@ -35,7 +33,6 @@ from pandas._typing import (
3533 TimeUnit ,
3634 np_1darray ,
3735 np_ndarray ,
38- npt ,
3936)
4037
4138class Components (NamedTuple ):
@@ -174,17 +171,17 @@ class Timedelta(timedelta):
174171 ) -> np_ndarray [ShapeT , np .datetime64 ]: ...
175172 # Override due to more types supported than timedelta
176173 @overload # type: ignore[override]
177- def __sub__ (self , other : timedelta | Timedelta | np .timedelta64 ) -> Self : ...
174+ def __sub__ (self , other : timedelta | np .timedelta64 | Self ) -> Self : ...
178175 @overload
179176 def __sub__ (self , other : NaTType ) -> NaTType : ...
180177 @overload
181178 def __sub__ (
182179 self , other : np_ndarray [ShapeT , np .timedelta64 ]
183180 ) -> np_ndarray [ShapeT , np .timedelta64 ]: ...
184181 @overload
185- def __sub__ (self , other : pd . TimedeltaIndex ) -> TimedeltaIndex : ...
182+ def __sub__ (self , other : TimedeltaIndex ) -> TimedeltaIndex : ...
186183 @overload
187- def __rsub__ (self , other : timedelta | Timedelta | np .timedelta64 ) -> Self : ...
184+ def __rsub__ (self , other : timedelta | np .timedelta64 | Self ) -> Self : ...
188185 @overload
189186 def __rsub__ (self , other : datetime | Timestamp | np .datetime64 ) -> Timestamp : ... # type: ignore[misc]
190187 @overload
@@ -204,7 +201,7 @@ class Timedelta(timedelta):
204201 self , other : np_ndarray [ShapeT , np .timedelta64 ]
205202 ) -> np_ndarray [ShapeT , np .timedelta64 ]: ...
206203 @overload
207- def __rsub__ (self , other : pd . TimedeltaIndex ) -> pd . TimedeltaIndex : ...
204+ def __rsub__ (self , other : TimedeltaIndex ) -> TimedeltaIndex : ...
208205 def __neg__ (self ) -> Self : ...
209206 def __pos__ (self ) -> Self : ...
210207 def __abs__ (self ) -> Self : ...
@@ -224,7 +221,7 @@ class Timedelta(timedelta):
224221 # Override due to more types supported than timedelta
225222 # error: Signature of "__floordiv__" incompatible with supertype "timedelta"
226223 @overload # type: ignore[override]
227- def __floordiv__ (self , other : timedelta | Timedelta | np .timedelta64 ) -> int : ...
224+ def __floordiv__ (self , other : timedelta | np .timedelta64 | Self ) -> int : ...
228225 @overload
229226 def __floordiv__ (self , other : float ) -> Self : ...
230227 @overload
@@ -275,9 +272,9 @@ class Timedelta(timedelta):
275272 ) -> np_ndarray [ShapeT , np .floating ]: ...
276273 # Override due to more types supported than timedelta
277274 @overload
278- def __eq__ (self , other : timedelta | Timedelta | np .timedelta64 ) -> bool : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
275+ def __eq__ (self , other : timedelta | np .timedelta64 | Self ) -> bool : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
279276 @overload
280- def __eq__ (self , other : Series [pd . Timedelta ]) -> Series [bool ]: ... # type: ignore[overload-overlap]
277+ def __eq__ (self , other : Series [Timedelta ]) -> Series [bool ]: ... # type: ignore[overload-overlap]
281278 @overload
282279 def __eq__ (self , other : Index ) -> np_1darray [np .bool ]: ... # type: ignore[overload-overlap]
283280 @overload
@@ -288,9 +285,9 @@ class Timedelta(timedelta):
288285 def __eq__ (self , other : object ) -> Literal [False ]: ...
289286 # Override due to more types supported than timedelta
290287 @overload
291- def __ne__ (self , other : timedelta | Timedelta | np .timedelta64 ) -> bool : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
288+ def __ne__ (self , other : timedelta | np .timedelta64 | Self ) -> bool : ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
292289 @overload
293- def __ne__ (self , other : Series [pd . Timedelta ]) -> Series [bool ]: ... # type: ignore[overload-overlap]
290+ def __ne__ (self , other : Series [Timedelta ]) -> Series [bool ]: ... # type: ignore[overload-overlap]
294291 @overload
295292 def __ne__ (self , other : Index ) -> np_1darray [np .bool ]: ... # type: ignore[overload-overlap]
296293 @overload
@@ -321,48 +318,48 @@ class Timedelta(timedelta):
321318 # for le, lt ge and gt
322319 # Override due to more types supported than timedelta
323320 @overload # type: ignore[override]
324- def __le__ (self , other : timedelta | Timedelta | np .timedelta64 ) -> bool : ...
321+ def __le__ (self , other : timedelta | np .timedelta64 | Self ) -> bool : ...
325322 @overload
326323 def __le__ (self , other : TimedeltaIndex ) -> np_1darray [np .bool ]: ...
327324 @overload
328325 def __le__ (
329326 self , other : np_ndarray [ShapeT , np .timedelta64 ]
330327 ) -> np_ndarray [ShapeT , np .bool_ ]: ...
331328 @overload
332- def __le__ (self , other : Series [pd . Timedelta ]) -> Series [bool ]: ...
329+ def __le__ (self , other : Series [Timedelta ]) -> Series [bool ]: ...
333330 # Override due to more types supported than timedelta
334331 @overload # type: ignore[override]
335- def __lt__ (self , other : timedelta | Timedelta | np .timedelta64 ) -> bool : ...
332+ def __lt__ (self , other : timedelta | np .timedelta64 | Self ) -> bool : ...
336333 @overload
337334 def __lt__ (self , other : TimedeltaIndex ) -> np_1darray [np .bool ]: ...
338335 @overload
339336 def __lt__ (
340337 self , other : np_ndarray [ShapeT , np .timedelta64 ]
341338 ) -> np_ndarray [ShapeT , np .bool_ ]: ...
342339 @overload
343- def __lt__ (self , other : Series [pd . Timedelta ]) -> Series [bool ]: ...
340+ def __lt__ (self , other : Series [Timedelta ]) -> Series [bool ]: ...
344341 # Override due to more types supported than timedelta
345342 @overload # type: ignore[override]
346- def __ge__ (self , other : timedelta | Timedelta | np .timedelta64 ) -> bool : ...
343+ def __ge__ (self , other : timedelta | np .timedelta64 | Self ) -> bool : ...
347344 @overload
348345 def __ge__ (self , other : TimedeltaIndex ) -> np_1darray [np .bool ]: ...
349346 @overload
350347 def __ge__ (
351348 self , other : np_ndarray [ShapeT , np .timedelta64 ]
352349 ) -> np_ndarray [ShapeT , np .bool_ ]: ...
353350 @overload
354- def __ge__ (self , other : Series [pd . Timedelta ]) -> Series [bool ]: ...
351+ def __ge__ (self , other : Series [Timedelta ]) -> Series [bool ]: ...
355352 # Override due to more types supported than timedelta
356353 @overload # type: ignore[override]
357- def __gt__ (self , other : timedelta | Timedelta | np .timedelta64 ) -> bool : ...
354+ def __gt__ (self , other : timedelta | np .timedelta64 | Self ) -> bool : ...
358355 @overload
359356 def __gt__ (self , other : TimedeltaIndex ) -> np_1darray [np .bool ]: ...
360357 @overload
361358 def __gt__ (
362359 self , other : np_ndarray [ShapeT , np .timedelta64 ]
363360 ) -> np_ndarray [ShapeT , np .bool_ ]: ...
364361 @overload
365- def __gt__ (self , other : Series [pd . Timedelta ]) -> Series [bool ]: ...
362+ def __gt__ (self , other : Series [Timedelta ]) -> Series [bool ]: ...
366363 def __hash__ (self ) -> int : ...
367364 def isoformat (self ) -> str : ...
368365 def to_numpy (self ) -> np .timedelta64 : ...
0 commit comments