Skip to content

Commit 02267e5

Browse files
Typing: Added missing methods to NaTType stub (#59995)
added missing methods to NaTType stub
1 parent b3d0b96 commit 02267e5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pandas/_libs/tslibs/nattype.pyi

+17
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ from typing import (
99
Literal,
1010
NoReturn,
1111
TypeAlias,
12+
overload,
1213
)
1314

1415
import numpy as np
@@ -159,15 +160,31 @@ class NaTType:
159160
# inject Period properties
160161
@property
161162
def qyear(self) -> float: ...
163+
# comparisons
162164
def __eq__(self, other: object) -> bool: ...
163165
def __ne__(self, other: object) -> bool: ...
164166
__lt__: _NatComparison
165167
__le__: _NatComparison
166168
__gt__: _NatComparison
167169
__ge__: _NatComparison
170+
# unary operators
171+
def __pos__(self) -> Self: ...
172+
def __neg__(self) -> Self: ...
173+
# binary operators
168174
def __sub__(self, other: Self | timedelta | datetime) -> Self: ...
169175
def __rsub__(self, other: Self | timedelta | datetime) -> Self: ...
170176
def __add__(self, other: Self | timedelta | datetime) -> Self: ...
171177
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: ...
180+
@overload # analogous to timedelta
181+
def __truediv__(self, other: Self | timedelta) -> float: ... # Literal[NaN]
182+
@overload
183+
def __truediv__(self, other: float) -> Self: ...
184+
@overload # analogous to timedelta
185+
def __floordiv__(self, other: Self | timedelta) -> float: ... # Literal[NaN]
186+
@overload
187+
def __floordiv__(self, other: float) -> Self: ...
188+
# other
172189
def __hash__(self) -> int: ...
173190
def as_unit(self, unit: str, round_ok: bool = ...) -> NaTType: ...

0 commit comments

Comments
 (0)