random: add VERSION, SystemRandom.getrandbits is not pos only (#6419)

Co-authored-by: Akuli <akuviljanen17@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Shantanu
2021-12-05 06:52:34 -08:00
committed by GitHub
parent 2610c5ee37
commit 2a1ef3735d
3 changed files with 3 additions and 4 deletions

View File

@@ -2,11 +2,12 @@ import _random
import sys
from collections.abc import Callable, Iterable, MutableSequence, Sequence
from fractions import Fraction
from typing import Any, NoReturn, Tuple, TypeVar
from typing import Any, ClassVar, NoReturn, Tuple, TypeVar
_T = TypeVar("_T")
class Random(_random.Random):
VERSION: ClassVar[int]
def __init__(self, x: Any = ...) -> None: ...
def seed(self, a: Any = ..., version: int = ...) -> None: ...
def getstate(self) -> Tuple[Any, ...]: ...
@@ -45,6 +46,7 @@ class Random(_random.Random):
# SystemRandom is not implemented for all OS's; good on Windows & Linux
class SystemRandom(Random):
def getrandbits(self, k: int) -> int: ... # k can be passed by keyword
def getstate(self, *args: Any, **kwds: Any) -> NoReturn: ...
def setstate(self, *args: Any, **kwds: Any) -> NoReturn: ...