@@ -25,12 +25,8 @@ NaT: NaTType
2525iNaT : int
2626nat_strings : set [str ]
2727
28- _NaTComparisonTypes : TypeAlias = (
29- datetime | timedelta | Period | np .datetime64 | np .timedelta64
30- )
31-
32- class _NatComparison :
33- def __call__ (self , other : _NaTComparisonTypes ) -> bool : ...
28+ _TimeLike : TypeAlias = datetime | timedelta | Period | np .datetime64 | np .timedelta64
29+ _TimeDelta : TypeAlias = timedelta | np .timedelta64
3430
3531class NaTType :
3632 _value : np .int64
@@ -161,30 +157,30 @@ class NaTType:
161157 @property
162158 def qyear (self ) -> float : ...
163159 # comparisons
164- def __eq__ (self , other : object ) -> bool : ...
165- def __ne__ (self , other : object ) -> bool : ...
166- __lt__ : _NatComparison
167- __le__ : _NatComparison
168- __gt__ : _NatComparison
169- __ge__ : _NatComparison
160+ def __eq__ (self , other : object , / ) -> Literal [ False ] : ...
161+ def __ne__ (self , other : object , / ) -> Literal [ True ] : ...
162+ def __lt__ ( self , other : Self | _TimeLike , / ) -> Literal [ False ]: ...
163+ def __le__ ( self , other : Self | _TimeLike , / ) -> Literal [ False ]: ...
164+ def __gt__ ( self , other : Self | _TimeLike , / ) -> Literal [ False ]: ...
165+ def __ge__ ( self , other : Self | _TimeLike , / ) -> Literal [ False ]: ...
170166 # unary operators
171167 def __pos__ (self ) -> Self : ...
172168 def __neg__ (self ) -> Self : ...
173169 # binary operators
174- def __sub__ (self , other : Self | timedelta | datetime ) -> Self : ...
175- def __rsub__ (self , other : Self | timedelta | datetime ) -> Self : ...
176- def __add__ (self , other : Self | timedelta | datetime ) -> Self : ...
177- def __radd__ (self , other : Self | timedelta | datetime ) -> Self : ...
178- def __mul__ (self , other : float ) -> Self : ... # analogous to timedelta
179- def __rmul__ (self , other : float ) -> Self : ...
170+ def __sub__ (self , other : Self | _TimeLike , / ) -> Self : ...
171+ def __rsub__ (self , other : Self | _TimeLike , / ) -> Self : ...
172+ def __add__ (self , other : Self | _TimeLike , / ) -> Self : ...
173+ def __radd__ (self , other : Self | _TimeLike , / ) -> Self : ...
174+ def __mul__ (self , other : float , / ) -> Self : ... # analogous to timedelta
175+ def __rmul__ (self , other : float , / ) -> Self : ...
180176 @overload # analogous to timedelta
181- def __truediv__ (self , other : Self | timedelta ) -> float : ... # Literal[NaN]
177+ def __truediv__ (self , other : Self | _TimeDelta , / ) -> float : ... # Literal[NaN]
182178 @overload
183- def __truediv__ (self , other : float ) -> Self : ...
179+ def __truediv__ (self , other : float , / ) -> Self : ...
184180 @overload # analogous to timedelta
185- def __floordiv__ (self , other : Self | timedelta ) -> float : ... # Literal[NaN]
181+ def __floordiv__ (self , other : Self | _TimeDelta , / ) -> float : ... # Literal[NaN]
186182 @overload
187- def __floordiv__ (self , other : float ) -> Self : ...
183+ def __floordiv__ (self , other : float , / ) -> Self : ...
188184 # other
189185 def __hash__ (self ) -> int : ...
190186 def as_unit (self , unit : str , round_ok : bool = ...) -> NaTType : ...
0 commit comments