1
1
from collections .abc import Callable
2
- from typing import Literal , TypeVar , TypedDict , overload , type_check_only
2
+ from typing import Final , Literal , TypeVar , TypedDict , overload , type_check_only
3
3
4
4
from numpy .random ._generator import Generator
5
5
from numpy .random ._mt19937 import MT19937
@@ -12,13 +12,15 @@ from numpy.random.mtrand import RandomState
12
12
_T = TypeVar ("_T" , bound = BitGenerator )
13
13
14
14
@type_check_only
15
- class BitGenerators (TypedDict ):
15
+ class _BitGenerators (TypedDict ):
16
16
MT19937 : type [MT19937 ]
17
17
PCG64 : type [PCG64 ]
18
18
PCG64DXSM : type [PCG64DXSM ]
19
19
Philox : type [Philox ]
20
20
SFC64 : type [SFC64 ]
21
21
22
+ BitGenerators : Final [_BitGenerators ] = ...
23
+
22
24
@overload
23
25
def __bit_generator_ctor (bit_generator : Literal ["MT19937" ] = "MT19937" ) -> MT19937 : ...
24
26
@overload
@@ -32,10 +34,10 @@ def __bit_generator_ctor(bit_generator: Literal["SFC64"]) -> SFC64: ...
32
34
@overload
33
35
def __bit_generator_ctor (bit_generator : type [_T ]) -> _T : ...
34
36
def __generator_ctor (
35
- bit_generator_name : str | type [BitGenerator ] = "MT19937" ,
37
+ bit_generator_name : str | type [BitGenerator ] | BitGenerator = "MT19937" ,
36
38
bit_generator_ctor : Callable [[str | type [BitGenerator ]], BitGenerator ] = ...,
37
39
) -> Generator : ...
38
40
def __randomstate_ctor (
39
- bit_generator_name : str | type [BitGenerator ] = "MT19937" ,
41
+ bit_generator_name : str | type [BitGenerator ] | BitGenerator = "MT19937" ,
40
42
bit_generator_ctor : Callable [[str | type [BitGenerator ]], BitGenerator ] = ...,
41
43
) -> RandomState : ...
0 commit comments