Skip to content

Commit b2b29d1

Browse files
committed
🩹 refactor type hint imports in numpy.random._pickle.pyi
1 parent 4c8b650 commit b2b29d1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

‎src/numpy-stubs/random/_pickle.pyi

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
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
33

44
from numpy.random._generator import Generator
55
from numpy.random._mt19937 import MT19937
@@ -12,13 +12,15 @@ from numpy.random.mtrand import RandomState
1212
_T = TypeVar("_T", bound=BitGenerator)
1313

1414
@type_check_only
15-
class BitGenerators(TypedDict):
15+
class _BitGenerators(TypedDict):
1616
MT19937: type[MT19937]
1717
PCG64: type[PCG64]
1818
PCG64DXSM: type[PCG64DXSM]
1919
Philox: type[Philox]
2020
SFC64: type[SFC64]
2121

22+
BitGenerators: Final[_BitGenerators] = ...
23+
2224
@overload
2325
def __bit_generator_ctor(bit_generator: Literal["MT19937"] = "MT19937") -> MT19937: ...
2426
@overload
@@ -32,10 +34,10 @@ def __bit_generator_ctor(bit_generator: Literal["SFC64"]) -> SFC64: ...
3234
@overload
3335
def __bit_generator_ctor(bit_generator: type[_T]) -> _T: ...
3436
def __generator_ctor(
35-
bit_generator_name: str | type[BitGenerator] = "MT19937",
37+
bit_generator_name: str | type[BitGenerator] | BitGenerator = "MT19937",
3638
bit_generator_ctor: Callable[[str | type[BitGenerator]], BitGenerator] = ...,
3739
) -> Generator: ...
3840
def __randomstate_ctor(
39-
bit_generator_name: str | type[BitGenerator] = "MT19937",
41+
bit_generator_name: str | type[BitGenerator] | BitGenerator = "MT19937",
4042
bit_generator_ctor: Callable[[str | type[BitGenerator]], BitGenerator] = ...,
4143
) -> RandomState: ...

0 commit comments

Comments
 (0)