Skip to content

TYP: NaTType comparisons #41621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion pandas/_libs/tslibs/nattype.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@

from datetime import datetime
from datetime import (
datetime,
timedelta,
)
from typing import Any

import numpy as np

from pandas._libs.tslibs.period import Period

NaT: NaTType
iNaT: int
nat_strings: set[str]
Expand Down Expand Up @@ -133,3 +139,31 @@ class NaTType(datetime):
# inject Period properties
@property
def qyear(self) -> float: ...

def __eq__(self, other: Any) -> bool: ...
def __ne__(self, other: Any) -> bool: ...
# https://github.com/python/mypy/issues/9015
# error: Argument 1 of "__lt__" is incompatible with supertype "date";
# supertype defines the argument type as "date"
def __lt__( # type: ignore[override]
self,
other: datetime | timedelta | Period | np.datetime64 | np.timedelta64
) -> bool: ...
# error: Argument 1 of "__le__" is incompatible with supertype "date";
# supertype defines the argument type as "date"
def __le__( # type: ignore[override]
self,
other: datetime | timedelta | Period | np.datetime64 | np.timedelta64
) -> bool: ...
# error: Argument 1 of "__gt__" is incompatible with supertype "date";
# supertype defines the argument type as "date"
def __gt__( # type: ignore[override]
self,
other: datetime | timedelta | Period | np.datetime64 | np.timedelta64
) -> bool: ...
# error: Argument 1 of "__ge__" is incompatible with supertype "date";
# supertype defines the argument type as "date"
def __ge__( # type: ignore[override]
self,
other: datetime | timedelta | Period | np.datetime64 | np.timedelta64
) -> bool: ...