Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

API: No timedelta/datetimes are not integers and do not promote #22568

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
Loading
from
Open
Prev Previous commit
TYP: Fixup typing and typing tests
  • Loading branch information
seberg committed May 15, 2023
commit cd87a7814a596ea74d1c79cd0e864540dab3b79f
16 changes: 8 additions & 8 deletions 16 numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@overload
def __lt__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> NDArray[bool_]: ...
@overload
def __lt__(self: _ArrayTD64_co, other: _ArrayLikeTD64_comp_co) -> NDArray[bool_]: ...
def __lt__(self: _ArrayLikeTD64_comp_co, other: _ArrayLikeTD64_comp_co) -> NDArray[bool_]: ...
@overload
def __lt__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[bool_]: ...
@overload
Expand All @@ -1861,7 +1861,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@overload
def __le__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> NDArray[bool_]: ...
@overload
def __le__(self: _ArrayTD64_co, other: _ArrayLikeTD64_comp_co) -> NDArray[bool_]: ...
def __le__(self: _ArrayLikeTD64_comp_co, other: _ArrayLikeTD64_comp_co) -> NDArray[bool_]: ...
@overload
def __le__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[bool_]: ...
@overload
Expand All @@ -1872,7 +1872,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@overload
def __gt__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> NDArray[bool_]: ...
@overload
def __gt__(self: _ArrayTD64_co, other: _ArrayLikeTD64_comp_co) -> NDArray[bool_]: ...
def __gt__(self: _ArrayLikeTD64_comp_co, other: _ArrayLikeTD64_comp_co) -> NDArray[bool_]: ...
@overload
def __gt__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[bool_]: ...
@overload
Expand All @@ -1883,7 +1883,7 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeType, _DType_co]):
@overload
def __ge__(self: _ArrayNumber_co, other: _ArrayLikeNumber_co) -> NDArray[bool_]: ...
@overload
def __ge__(self: _ArrayTD64_co, other: _ArrayLikeTD64_comp_co) -> NDArray[bool_]: ...
def __ge__(self: _ArrayLikeTD64_comp_co, other: _ArrayLikeTD64_comp_co) -> NDArray[bool_]: ...
@overload
def __ge__(self: NDArray[datetime64], other: _ArrayLikeDT64_co) -> NDArray[bool_]: ...
@overload
Expand Down Expand Up @@ -2927,10 +2927,10 @@ class timedelta64(generic):
def __rmod__(self, other: timedelta64) -> timedelta64: ...
def __divmod__(self, other: timedelta64) -> tuple[int64, timedelta64]: ...
def __rdivmod__(self, other: timedelta64) -> tuple[int64, timedelta64]: ...
__lt__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_comp_co]
__le__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_comp_co]
__gt__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_comp_co]
__ge__: _ComparisonOp[_TD64Like_co, _ArrayLikeTD64_comp_co]
__lt__: _ComparisonOp[timedelta64, _ArrayLikeTD64_comp_co]
__le__: _ComparisonOp[timedelta64, _ArrayLikeTD64_comp_co]
__gt__: _ComparisonOp[timedelta64, _ArrayLikeTD64_comp_co]
__ge__: _ComparisonOp[timedelta64, _ArrayLikeTD64_comp_co]

class unsignedinteger(integer[_NBit1]):
# NOTE: `uint64 + signedinteger -> float64`
Expand Down
8 changes: 0 additions & 8 deletions 8 numpy/typing/tests/data/reveal/comparisons.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,9 @@ reveal_type(i8 > [decimal.Decimal("1.5")]) # E: Any
# Time structures

reveal_type(dt > dt) # E: bool_

reveal_type(td > td) # E: bool_
reveal_type(td > i) # E: bool_
reveal_type(td > i4) # E: bool_
reveal_type(td > i8) # E: bool_

reveal_type(td > AR) # E: ndarray[Any, dtype[bool_]]
reveal_type(td > SEQ) # E: ndarray[Any, dtype[bool_]]
reveal_type(AR > SEQ) # E: ndarray[Any, dtype[bool_]]
reveal_type(AR > td) # E: ndarray[Any, dtype[bool_]]
reveal_type(SEQ > td) # E: ndarray[Any, dtype[bool_]]
reveal_type(SEQ > AR) # E: ndarray[Any, dtype[bool_]]

# boolean
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.