8000 ENH: Type the `like` parameter via a `__array_function__` protocol · rjeb/numpy@fc30b21 · GitHub
[go: up one dir, main page]

Skip to content

Commit fc30b21

Browse files
committed
ENH: Type the like parameter via a __array_function__ protocol
1 parent d2df8c6 commit fc30b21

File tree

7 files changed

+89
-77
lines changed

7 files changed

+89
-77
lines changed

numpy/core/_asarray.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from collections.abc import Iterable
22
from typing import TypeVar, Union, overload, Literal
33

44
from numpy import ndarray
5-
from numpy.typing import ArrayLike, DTypeLike
5+
from numpy.typing import DTypeLike, _SupportsArrayFunc
66

77
_ArrayType = TypeVar("_ArrayType", bound=ndarray)
88

@@ -22,21 +22,21 @@ def require(
2222
dtype: None = ...,
2323
requirements: None | _Requirements | Iterable[_Requirements] = ...,
2424
*,
25-
like: ArrayLike = ...
25+
like: _SupportsArrayFunc = ...
2626
) -> _ArrayType: ...
2727
@overload
2828
def require(
2929
a: object,
3030
dtype: DTypeLike = ...,
3131
requirements: _E | Iterable[_RequirementsWithE] = ...,
3232
*,
33-
like: ArrayLike = ...
33+
like: _SupportsArrayFunc = ...
3434
) -> ndarray: ...
3535
@overload
3636
def require(
3737
a: object,
3838
dtype: DTypeLike = ...,
3939
requirements: None | _Requirements | Iterable[_Requirements] = ...,
4040
*,
41-
like: ArrayLike = ...
41+
like: _SupportsArrayFunc = ...
4242
) -> ndarray: ...

0 commit comments

Comments
 (0)
0