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

Skip to content

Commit d571cca

Browse files
committed
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 82610b4 commit d571cca

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
@@ -3970,7 +3970,7 @@ bool_ = bool
39703970
# NOTE: Because mypy has some long-standing bugs related to `__new__`, `object_` can't
39713971
# be made generic.
39723972
@final
3973-
class object_(_RealMixin, generic):
3973+
class object_(_RealMixin, generic[Any]):
39743974
@overload
39753975
def __new__(cls, nothing_to_see_here: None = None, /) -> None: ... # type: ignore[misc]
39763976
@overload
@@ -3984,6 +3984,8 @@ class object_(_RealMixin, generic):
39843984
@overload # catch-all
39853985
def __new__(cls, value: Any = ..., /) -> object | NDArray[Self]: ... # type: ignore[misc]
39863986
def __init__(self, value: object = ..., /) -> None: ...
3987+
def __hash__(self, /) -> int: ...
3988+
def __call__(self, /, *args: object, **kwargs: object) -> Any: ...
39873989

39883990
if sys.version_info >= (3, 12):
39893991
def __release_buffer__(self, buffer: memoryview, /) -> None: ...
@@ -4440,6 +4442,9 @@ class timedelta64(_IntegralMixin, generic[_TD64ItemT_co], Generic[_TD64ItemT_co]
44404442
@overload
44414443
def __init__(self, value: _ConvertibleToTD64, format: _TimeUnitSpec = ..., /) -> None: ...
44424444

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

0 commit comments

Comments
 (0)
0