Skip to content

Typing: Added missing methods to NaTType stub #59995

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 1 commit into from
Oct 7, 2024
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
17 changes: 17 additions & 0 deletions pandas/_libs/tslibs/nattype.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ from typing import (
Literal,
NoReturn,
TypeAlias,
overload,
)

import numpy as np
Expand Down Expand Up @@ -159,15 +160,31 @@ class NaTType:
# inject Period properties
@property
def qyear(self) -> float: ...
# comparisons
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
__lt__: _NatComparison
__le__: _NatComparison
__gt__: _NatComparison
__ge__: _NatComparison
# unary operators
def __pos__(self) -> Self: ...
def __neg__(self) -> Self: ...
# binary operators
def __sub__(self, other: Self | timedelta | datetime) -> Self: ...
def __rsub__(self, other: Self | timedelta | datetime) -> Self: ...
def __add__(self, other: Self | timedelta | datetime) -> Self: ...
def __radd__(self, other: Self | timedelta | datetime) -> Self: ...
def __mul__(self, other: float) -> Self: ... # analogous to timedelta
def __rmul__(self, other: float) -> Self: ...
@overload # analogous to timedelta
def __truediv__(self, other: Self | timedelta) -> float: ... # Literal[NaN]
@overload
def __truediv__(self, other: float) -> Self: ...
@overload # analogous to timedelta
def __floordiv__(self, other: Self | timedelta) -> float: ... # Literal[NaN]
@overload
def __floordiv__(self, other: float) -> Self: ...
# other
def __hash__(self) -> int: ...
def as_unit(self, unit: str, round_ok: bool = ...) -> NaTType: ...