summaryrefslogtreecommitdiff
path: root/numpy/random
diff options
context:
space:
mode:
authorSimonAltrogge <8720147+SimonAltrogge@users.noreply.github.com>2023-01-26 14:47:28 +0100
committerGitHub <noreply@github.com>2023-01-26 14:47:28 +0100
commit1c190405eacd0d7d3861042bb4c25bc24e30ff4d (patch)
tree2265187361073f8d4a02e58d5dd06c769ef01912 /numpy/random
parent2289292db6a19f2bbfddd3dea3790ffa19955333 (diff)
downloadnumpy-1c190405eacd0d7d3861042bb4c25bc24e30ff4d.tar.gz
TYP: Fix return type to float on _FloatLike_co arguments
Currently, `rng.exponential(scale=np.sum(np.arange(10.0)))` indicates its return value as `np.ndarray[Any, dtype[float64]]` even though a `float` is returned on `_FloatLike_co` values of the `scale` argument. This commit fixes this problem such that `rng.exponential` indicates the correct return type on `_FloatLike_co` inputs.
Diffstat (limited to 'numpy/random')
-rw-r--r--numpy/random/_generator.pyi3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/random/_generator.pyi b/numpy/random/_generator.pyi
index f0d814fef..393c6725c 100644
--- a/numpy/random/_generator.pyi
+++ b/numpy/random/_generator.pyi
@@ -29,6 +29,7 @@ from numpy._typing import (
_DTypeLikeUInt,
_Float32Codes,
_Float64Codes,
+ _FloatLike_co,
_Int8Codes,
_Int16Codes,
_Int32Codes,
@@ -193,7 +194,7 @@ class Generator:
self, a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, size: None | _ShapeLike = ...
) -> ndarray[Any, dtype[float64]]: ...
@overload
- def exponential(self, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc]
+ def exponential(self, scale: _FloatLike_co = ..., size: None = ...) -> float: ... # type: ignore[misc]
@overload
def exponential(
self, scale: _ArrayLikeFloat_co = ..., size: None | _ShapeLike = ...