@@ -25,12 +25,8 @@ NaT: NaTType
25
25
iNaT : int
26
26
nat_strings : set [str ]
27
27
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
34
30
35
31
class NaTType :
36
32
_value : np .int64
@@ -161,30 +157,30 @@ class NaTType:
161
157
@property
162
158
def qyear (self ) -> float : ...
163
159
# 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 ]: ...
170
166
# unary operators
171
167
def __pos__ (self ) -> Self : ...
172
168
def __neg__ (self ) -> Self : ...
173
169
# 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 : ...
180
176
@overload # analogous to timedelta
181
- def __truediv__ (self , other : Self | timedelta ) -> float : ... # Literal[NaN]
177
+ def __truediv__ (self , other : Self | _TimeDelta , / ) -> float : ... # Literal[NaN]
182
178
@overload
183
- def __truediv__ (self , other : float ) -> Self : ...
179
+ def __truediv__ (self , other : float , / ) -> Self : ...
184
180
@overload # analogous to timedelta
185
- def __floordiv__ (self , other : Self | timedelta ) -> float : ... # Literal[NaN]
181
+ def __floordiv__ (self , other : Self | _TimeDelta , / ) -> float : ... # Literal[NaN]
186
182
@overload
187
- def __floordiv__ (self , other : float ) -> Self : ...
183
+ def __floordiv__ (self , other : float , / ) -> Self : ...
188
184
# other
189
185
def __hash__ (self ) -> int : ...
190
186
def as_unit (self , unit : str , round_ok : bool = ...) -> NaTType : ...
0 commit comments