diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2020-08-23 15:36:07 +0200 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2020-08-23 15:36:07 +0200 |
commit | dcb39277c201a418c653a1a98f9a6680fb3d5495 (patch) | |
tree | f2c9a650307da8acf7b52304906ab36b7f0b6e08 /numpy/core/function_base.pyi | |
parent | 97f9fcb599fec377f35be647afdc2d5c2c6ba1f9 (diff) | |
download | numpy-dcb39277c201a418c653a1a98f9a6680fb3d5495.tar.gz |
ENH: Add stubs for `np.core.function_base`
Diffstat (limited to 'numpy/core/function_base.pyi')
-rw-r--r-- | numpy/core/function_base.pyi | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/numpy/core/function_base.pyi b/numpy/core/function_base.pyi new file mode 100644 index 000000000..2edcb88c3 --- /dev/null +++ b/numpy/core/function_base.pyi @@ -0,0 +1,53 @@ +import sys +from typing import overload, Tuple, Union, Sequence, Any + +from numpy import ndarray, floating, number, _NumberLike +from numpy.typing import ArrayLike, DtypeLike, _SupportsArray + +if sys.version_info >= (3, 8): + from typing import SupportsIndex, Literal +else: + from typing_extensions import SupportsIndex, Literal + +# TODO: wait for support for recursive types +_ArrayLikeNested = Sequence[Sequence[Any]] +_ArrayLikeNumber = Union[ + _NumberLike, Sequence[_NumberLike], ndarray, _SupportsArray, _ArrayLikeNested +] +@overload +def linspace( + start: _ArrayLikeNumber, + stop: _ArrayLikeNumber, + num: SupportsIndex = ..., + endpoint: bool = ..., + retstep: Literal[False] = ..., + dtype: DtypeLike = ..., + axis: int = ..., +) -> ndarray: ... +@overload +def linspace( + start: _ArrayLikeNumber, + stop: _ArrayLikeNumber, + num: SupportsIndex = ..., + endpoint: bool = ..., + retstep: Literal[True] = ..., + dtype: DtypeLike = ..., + axis: int = ..., +) -> Tuple[ndarray, floating]: ... +def logspace( + start: _ArrayLikeNumber, + stop: _ArrayLikeNumber, + num: SupportsIndex = ..., + endpoint: bool = ..., + base: _ArrayLikeNumber = ..., + dtype: DtypeLike = ..., + axis: int = ..., +) -> ndarray: ... +def geomspace( + start: _ArrayLikeNumber, + stop: _ArrayLikeNumber, + num: SupportsIndex = ..., + endpoint: bool = ..., + dtype: DtypeLike = ..., + axis: int = ..., +) -> ndarray: ... |