Skip to content

Commit 4bea042

Browse files
authored
TYP: NaTType comparisons (#41621)
1 parent a68f67f commit 4bea042

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

pandas/_libs/tslibs/nattype.pyi

+35-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11

2-
from datetime import datetime
2+
from datetime import (
3+
datetime,
4+
timedelta,
5+
)
6+
from typing import Any
37

48
import numpy as np
59

10+
from pandas._libs.tslibs.period import Period
11+
612
NaT: NaTType
713
iNaT: int
814
nat_strings: set[str]
@@ -133,3 +139,31 @@ class NaTType(datetime):
133139
# inject Period properties
134140
@property
135141
def qyear(self) -> float: ...
142+
143+
def __eq__(self, other: Any) -> bool: ...
144+
def __ne__(self, other: Any) -> bool: ...
145+
# https://github.com/python/mypy/issues/9015
146+
# error: Argument 1 of "__lt__" is incompatible with supertype "date";
147+
# supertype defines the argument type as "date"
148+
def __lt__( # type: ignore[override]
149+
self,
150+
other: datetime | timedelta | Period | np.datetime64 | np.timedelta64
151+
) -> bool: ...
152+
# error: Argument 1 of "__le__" is incompatible with supertype "date";
153+
# supertype defines the argument type as "date"
154+
def __le__( # type: ignore[override]
155+
self,
156+
other: datetime | timedelta | Period | np.datetime64 | np.timedelta64
157+
) -> bool: ...
158+
# error: Argument 1 of "__gt__" is incompatible with supertype "date";
159+
# supertype defines the argument type as "date"
160+
def __gt__( # type: ignore[override]
161+
self,
162+
other: datetime | timedelta | Period | np.datetime64 | np.timedelta64
163+
) -> bool: ...
164+
# error: Argument 1 of "__ge__" is incompatible with supertype "date";
165+
# supertype defines the argument type as "date"
166+
def __ge__( # type: ignore[override]
167+
self,
168+
other: datetime | timedelta | Period | np.datetime64 | np.timedelta64
169+
) -> bool: ...

0 commit comments

Comments
 (0)