Skip to content
Merged
Show file tree
Hide file tree
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
TYP: Fix false rejection of NDArray[object_].__abs__()
  • Loading branch information
jorenham committed Apr 14, 2025
commit 0cfa08f969806aee66524ae078268953db045d26
1 change: 1 addition & 0 deletions numpy/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3953,6 +3953,7 @@ class object_(_RealMixin, generic[Any]):
def __new__(cls, value: Any = ..., /) -> object | NDArray[Self]: ... # type: ignore[misc]
def __init__(self, value: object = ..., /) -> None: ...
def __hash__(self, /) -> int: ...
def __abs__(self, /) -> object_: ... # this affects NDArray[object_].__abs__
def __call__(self, /, *args: object, **kwargs: object) -> Any: ...

if sys.version_info >= (3, 12):
Expand Down
1 change: 1 addition & 0 deletions numpy/typing/tests/data/reveal/arithmetic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ assert_type(abs(m8_none), np.timedelta64[None])
assert_type(abs(m8_int), np.timedelta64[int])
assert_type(abs(m8_delta), np.timedelta64[dt.timedelta])
assert_type(abs(b_), np.bool)
assert_type(abs(AR_O), npt.NDArray[np.object_])

# Time structures

Expand Down