8000 TYP: fix stubtest errors in ``timedelta64`` and ``object_`` · charris/numpy@79b8c26 · GitHub
[go: up one dir, main page]

Skip to content

Commit 79b8c26

Browse files
jorenhamcharris
authored andcommitted
TYP: fix stubtest errors in timedelta64 and object_
Ported from numpy/numtype#228 --- the following methods were missing according to stubtest: - `numpy.object_.__call__` - `numpy.timedelta64.__class_getitem__`
1 parent 2992933 commit 79b8c26

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

numpy/__init__.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3990,7 +3990,7 @@ bool_ = bool
39903990
# NOTE: Because mypy has some long-standing bugs related to `__new__`, `object_` can't
39913991
# be made generic.
39923992
@final
3993-
class object_(_RealMixin, generic):
3993+
class object_(_RealMixin, generic[Any]):
39943994
@overload
39953995
def __new__(cls, nothing_to_see_here: None = None, /) -> None: ... # type: ignore[misc]
39963996
@overload
@@ -4004,6 +4004,8 @@ class object_(_RealMixin, generic):
40044004
@overload # catch-all
40054005
def __new__(cls, value: Any = ..., /) -> object | NDArray[Self]: ... # type: ignore[misc]
40064006
def __init__(self, value: object = ..., /) -> None: ...
4007+
def __hash__(self, /) -> int: ...
4008+
def __call__(self, /, *args: object, **kwargs: object) -> Any: ...
40074009

40084010
if sys.version_info >= (3, 12):
40094011
def __release_buffer__(self, buffer: memoryview, /) -> None: ...
@@ -4466,6 +4468,9 @@ class timedelta64(_IntegralMixin, generic[_TD64ItemT_co], Generic[_TD64ItemT_co]
44664468
@overload
44674469
def __init__(self, value: _ConvertibleToTD64, format: _TimeUnitSpec = ..., /) -> None: ...
44684470

4471+
# inherited at runtime from `signedinteger`
4472+
def __class_getitem__(cls, type_arg: type | object, /) -> GenericAlias: ...
4473+
44694474
# NOTE: Only a limited number of units support conversion
44704475
# to builtin scalar types: `Y`, `M`, `ns`, `ps`, `fs`, `as`
44714476
def __int__(self: timedelta64[int], /) -> int: ...

0 commit comments

Comments
 (0)
0