@@ -25,12 +25,9 @@ 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
- )
28
+ _TimeLike : TypeAlias = datetime | timedelta | Period | np .datetime64 | np .timedelta64
29
+ _TimeDelta : TypeAlias = timedelta | np .timedelta64
31
30
32
- class _NatComparison :
33
- def __call__ (self , other : _NaTComparisonTypes ) -> bool : ...
34
31
35
32
class NaTType :
36
33
_value : np .int64
@@ -161,30 +158,30 @@ class NaTType:
161
158
@property
162
159
def qyear (self ) -> float : ...
163
160
# 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
161
+ def __eq__ (self , other : object , / ) -> bool : ...
162
+ def __ne__ (self , other : object , / ) -> bool : ...
163
+ def __lt__ ( self , other : Self | _TimeLike , / ) -> Literal [ False ]: ...
164
+ def __le__ ( self , other : Self | _TimeLike , / ) -> Literal [ False ]: ...
165
+ def __gt__ ( self , other : Self | _TimeLike , / ) -> Literal [ False ]: ...
166
+ def __ge__ ( self , other : Self | _TimeLike , / ) -> Literal [ False ]: ...
170
167
# unary operators
171
168
def __pos__ (self ) -> Self : ...
172
169
def __neg__ (self ) -> Self : ...
173
170
# 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 : ...
171
+ def __sub__ (self , other : Self | _TimeLike , / ) -> Self : ...
172
+ def __rsub__ (self , other : Self | _TimeLike , / ) -> Self : ...
173
+ def __add__ (self , other : Self | _TimeLike , / ) -> Self : ...
174
+ def __radd__ (self , other : Self | _TimeLike , / ) -> Self : ...
175
+ def __mul__ (self , other : float , / ) -> Self : ... # analogous to timedelta
176
+ def __rmul__ (self , other : float , / ) -> Self : ...
180
177
@overload # analogous to timedelta
181
- def __truediv__ (self , other : Self | timedelta ) -> float : ... # Literal[NaN]
178
+ def __truediv__ (self , other : Self | _TimeDelta , / ) -> float : ... # Literal[NaN]
182
179
@overload
183
- def __truediv__ (self , other : float ) -> Self : ...
180
+ def __truediv__ (self , other : float , / ) -> Self : ...
184
181
@overload # analogous to timedelta
185
- def __floordiv__ (self , other : Self | timedelta ) -> float : ... # Literal[NaN]
182
+ def __floordiv__ (self , other : Self | _TimeDelta , / ) -> float : ... # Literal[NaN]
186
183
@overload
187
- def __floordiv__ (self , other : float ) -> Self : ...
184
+ def __floordiv__ (self , other : float , / ) -> Self : ...
188
185
# other
189
186
def __hash__ (self ) -> int : ...
190
187
def as_unit (self , unit : str , round_ok : bool = ...) -> NaTType : ...
0 commit comments