diff options
author | Bas van Beek <b.f.van.beek@vu.nl> | 2021-02-04 19:05:08 +0100 |
---|---|---|
committer | Bas van Beek <b.f.van.beek@vu.nl> | 2021-02-09 15:14:57 +0100 |
commit | edf2d0045220c5edc78d9c450a90b018c4967697 (patch) | |
tree | ccaa55a49627981f13c860ccbeb2a612a0bd44c7 | |
parent | 7b085eac10d08c49453541a896297f42f09ddfe7 (diff) | |
download | numpy-edf2d0045220c5edc78d9c450a90b018c4967697.tar.gz |
ENH: Add annotations for `np.lib.ufunclike`
-rw-r--r-- | numpy/lib/ufunclike.pyi | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/numpy/lib/ufunclike.pyi b/numpy/lib/ufunclike.pyi new file mode 100644 index 000000000..3443fa7ae --- /dev/null +++ b/numpy/lib/ufunclike.pyi @@ -0,0 +1,50 @@ +from typing import Any, overload, TypeVar, List, Union + +from numpy import floating, bool_, ndarray +from numpy.typing import ( + _ArrayLikeFloat_co, + _ArrayLikeObject_co, + _ArrayOrScalar, +) + +_ArrayType = TypeVar("_ArrayType", bound=ndarray[Any, Any]) + +__all__: List[str] + +@overload +def fix( + x: _ArrayLikeFloat_co, + out: None = ..., +) -> _ArrayOrScalar[floating[Any]]: ... +@overload +def fix( + x: _ArrayLikeObject_co, + out: None = ..., +) -> Any: ... +@overload +def fix( + x: Union[_ArrayLikeFloat_co, _ArrayLikeObject_co], + out: _ArrayType, +) -> _ArrayType: ... + +@overload +def isposinf( + x: _ArrayLikeFloat_co, + out: None = ..., +) -> _ArrayOrScalar[bool_]: ... +@overload +def isposinf( + x: _ArrayLikeFloat_co, + out: _ArrayType, +) -> _ArrayType: ... + +@overload +def isneginf( + x: _ArrayLikeFloat_co, + out: None = ..., +) -> _ArrayOrScalar[bool_]: ... +@overload +def isneginf( + x: _ArrayLikeFloat_co, + out: _ArrayType, +) -> _ArrayType: ... |