summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorKevin Sheppard <kevin.k.sheppard@gmail.com>2021-02-15 08:49:36 +0000
committerKevin Sheppard <kevin.k.sheppard@gmail.com>2021-02-15 08:50:05 +0000
commitcc5fa7e1d3625df831ceef486003fbd84ea5ce20 (patch)
tree29dd884f6ace9f3cc29ea3d6b65272f6b7ed52f8 /numpy
parent95051c27a13d5781d68d9778a83c2795a46ec093 (diff)
downloadnumpy-cc5fa7e1d3625df831ceef486003fbd84ea5ce20.tar.gz
ENH: Update typing
Update with latest suggestions
Diffstat (limited to 'numpy')
-rw-r--r--numpy/random/bit_generator.pyi12
1 files changed, 10 insertions, 2 deletions
diff --git a/numpy/random/bit_generator.pyi b/numpy/random/bit_generator.pyi
index f64d42b78..d67eb1520 100644
--- a/numpy/random/bit_generator.pyi
+++ b/numpy/random/bit_generator.pyi
@@ -12,6 +12,7 @@ from typing import (
Sequence,
Tuple,
Type,
+ TypedDict,
TypeVar,
Union,
overload,
@@ -34,6 +35,12 @@ _DTypeLike = Union[
_SupportsDType[dtype[_UIntType]],
]
+class _SeedSeqState(TypedDict):
+ entropy: Union[None, int, Sequence[int]]
+ spawn_key: Tuple[int, ...]
+ pool_size: int
+ n_children_spawned: int
+
class _Interface(NamedTuple):
state_address: Any
state: Any
@@ -87,11 +94,11 @@ class SeedSequence(ISpawnableSeedSequence):
@property
def state(
self,
- ) -> Dict[str, Union[None, Sequence[int], int, Tuple[int, ...]]]: ...
+ ) -> _SeedSeqState: ...
def generate_state(self, n_words: int, dtype: DTypeLike = ...) -> ndarray[Any, Any]: ...
def spawn(self, n_children: int) -> List[SeedSequence]: ...
-class BitGenerator:
+class BitGenerator(abc.ABC):
lock: Lock
def __init__(self, seed: Union[None, _ArrayLikeInt_co, SeedSequence] = ...) -> None: ...
def __getstate__(self) -> Dict[str, Any]: ...
@@ -99,6 +106,7 @@ class BitGenerator:
def __reduce__(
self,
) -> Tuple[Callable[[str], BitGenerator], Tuple[str], Tuple[Dict[str, Any]]]: ...
+ @abc.abstractmethod
@property
def state(self) -> Mapping[str, Any]: ...
@state.setter