Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 84b230f

Browse files
committed
fixup! Generate random typestubs
1 parent 69a64ef commit 84b230f

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

numpy-stubs/random/__init__.pyi

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import builtins
2-
from typing import Any, overload, Optional, Sequence, Tuple, TypeVar, Union
3-
2+
from typing import (
3+
Any,
4+
List,
5+
overload,
6+
Optional,
7+
Sequence,
8+
Tuple,
9+
TypeVar,
10+
Union,
11+
)
412
from numpy import ndarray
513

614
_Size = Union[int, Sequence[int]]
@@ -444,7 +452,7 @@ def rayleigh(scale: float, size: None = ...) -> float: ...
444452
def rayleigh(scale: _ScalarOrArray[float], size: _Size) -> ndarray: ...
445453
@overload
446454
def rayleigh(scale: _ArrayLike[float], size: None = ...) -> ndarray: ...
447-
def seed(seed: Union[None, int, ndarray] = ...) -> None: ...
455+
def seed(seed: Union[None, int, Tuple[int], List[int]] = ...) -> None: ...
448456
def set_state(state: Tuple[str, ndarray, int, int, float]) -> None: ...
449457
def shuffle(x: _ArrayLike[Any]) -> None: ...
450458
@overload

numpy-stubs/random/mtrand.pyi

+16-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import builtins
2-
from typing import Any, overload, Optional, Sequence, Tuple, TypeVar, Union
3-
2+
from typing import (
3+
Any,
4+
List,
5+
overload,
6+
Optional,
7+
Sequence,
8+
Tuple,
9+
TypeVar,
10+
Union,
11+
)
412
from numpy import ndarray
513

614
_Size = Union[int, Sequence[int]]
@@ -9,7 +17,9 @@ _ArrayLike = Union[Sequence[_T], ndarray]
917
_ScalarOrArray = Union[_T, Sequence[_T], ndarray]
1018

1119
class RandomState:
12-
def __init__(self, state: Optional[Union[int, ndarray]] = ...) -> None: ...
20+
def __init__(
21+
self, state: Union[None, int, List[int], Tuple[int]] = ...
22+
) -> None: ...
1323
@overload
1424
def beta(self, a: float, b: float, size: None = ...) -> float: ...
1525
@overload
@@ -544,7 +554,9 @@ class RandomState:
544554
def rayleigh(
545555
self, scale: _ArrayLike[float], size: None = ...
546556
) -> ndarray: ...
547-
def seed(self, seed: Union[None, int, ndarray] = ...) -> None: ...
557+
def seed(
558+
self, seed: Union[None, int, Tuple[int], List[int]] = ...
559+
) -> None: ...
548560
def set_state(
549561
self, state: Tuple[str, ndarray, int, int, float]
550562
) -> None: ...

0 commit comments

Comments
 (0)