mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 12:14:27 +08:00
random: various fixes (#4128)
* random.sample: make counts keyword-only * random: mark positional-only args * random.triangular: fix type of mode * random: add randbytes Co-authored-by: hauntsaninja <>
This commit is contained in:
@@ -17,20 +17,22 @@ class Random(_random.Random):
|
||||
def seed(self, a: Any = ..., version: int = ...) -> None: ...
|
||||
def getstate(self) -> Tuple[Any, ...]: ...
|
||||
def setstate(self, state: Tuple[Any, ...]) -> None: ...
|
||||
def getrandbits(self, k: int) -> int: ...
|
||||
def getrandbits(self, __k: int) -> int: ...
|
||||
def randrange(self, start: int, stop: Union[int, None] = ..., step: int = ...) -> int: ...
|
||||
def randint(self, a: int, b: int) -> int: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def randbytes(self, n: int) -> bytes: ...
|
||||
def choice(self, seq: Sequence[_T]) -> _T: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def choices(self, population: Sequence[_T], weights: Optional[Sequence[float]] = ..., *, cum_weights: Optional[Sequence[float]] = ..., k: int = ...) -> List[_T]: ...
|
||||
def shuffle(self, x: List[Any], random: Union[Callable[[], float], None] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int, counts: Optional[Iterable[_T]] = ...) -> List[_T]: ...
|
||||
def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int, *, counts: Optional[Iterable[_T]] = ...) -> List[_T]: ...
|
||||
else:
|
||||
def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
|
||||
def random(self) -> float: ...
|
||||
def uniform(self, a: float, b: float) -> float: ...
|
||||
def triangular(self, low: float = ..., high: float = ..., mode: float = ...) -> float: ...
|
||||
def triangular(self, low: float = ..., high: float = ..., mode: Optional[float] = ...) -> float: ...
|
||||
def betavariate(self, alpha: float, beta: float) -> float: ...
|
||||
def expovariate(self, lambd: float) -> float: ...
|
||||
def gammavariate(self, alpha: float, beta: float) -> float: ...
|
||||
@@ -49,21 +51,23 @@ class SystemRandom(Random):
|
||||
def seed(a: Any = ..., version: int = ...) -> None: ...
|
||||
def getstate() -> object: ...
|
||||
def setstate(state: object) -> None: ...
|
||||
def getrandbits(k: int) -> int: ...
|
||||
def getrandbits(__k: int) -> int: ...
|
||||
def randrange(start: int, stop: Union[None, int] = ..., step: int = ...) -> int: ...
|
||||
def randint(a: int, b: int) -> int: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def randbytes(n: int) -> bytes: ...
|
||||
def choice(seq: Sequence[_T]) -> _T: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
def choices(population: Sequence[_T], weights: Optional[Sequence[float]] = ..., *, cum_weights: Optional[Sequence[float]] = ..., k: int = ...) -> List[_T]: ...
|
||||
def shuffle(x: List[Any], random: Union[Callable[[], float], None] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int, counts: Optional[Iterable[_T]] = ...) -> List[_T]: ...
|
||||
def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int, *, counts: Optional[Iterable[_T]] = ...) -> List[_T]: ...
|
||||
else:
|
||||
def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
|
||||
def random() -> float: ...
|
||||
def uniform(a: float, b: float) -> float: ...
|
||||
def triangular(low: float = ..., high: float = ...,
|
||||
mode: float = ...) -> float: ...
|
||||
mode: Optional[float] = ...) -> float: ...
|
||||
def betavariate(alpha: float, beta: float) -> float: ...
|
||||
def expovariate(lambd: float) -> float: ...
|
||||
def gammavariate(alpha: float, beta: float) -> float: ...
|
||||
|
||||
@@ -166,11 +166,9 @@ profile.Profile.runcall
|
||||
pwd.getpwnam
|
||||
pwd.getpwuid
|
||||
queue.SimpleQueue.__init__
|
||||
random.Random.getrandbits
|
||||
random.Random.sample
|
||||
random.getrandbits
|
||||
random.sample
|
||||
random.SystemRandom.getrandbits
|
||||
secrets.SystemRandom.getstate
|
||||
secrets.SystemRandom.getrandbits
|
||||
secrets.compare_digest
|
||||
signal.sigtimedwait
|
||||
signal.sigwaitinfo
|
||||
|
||||
@@ -381,10 +381,8 @@ pydoc.TextDoc.docother
|
||||
pydoc.TextDoc.docproperty
|
||||
pydoc.TextDoc.docroutine
|
||||
random.Random.randrange
|
||||
random.Random.triangular
|
||||
random.SystemRandom.getstate
|
||||
random.randrange
|
||||
random.triangular
|
||||
re.error.__init__
|
||||
runpy.run_path
|
||||
sched.Event.__doc__
|
||||
|
||||
Reference in New Issue
Block a user