diff options
| author | SimonAltrogge <8720147+SimonAltrogge@users.noreply.github.com> | 2023-01-26 14:47:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-26 14:47:28 +0100 |
| commit | 1c190405eacd0d7d3861042bb4c25bc24e30ff4d (patch) | |
| tree | 2265187361073f8d4a02e58d5dd06c769ef01912 /numpy/random | |
| parent | 2289292db6a19f2bbfddd3dea3790ffa19955333 (diff) | |
| download | numpy-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.pyi | 3 |
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 = ... |
