mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
add random.choices for 3.6 (#1329)
This commit is contained in:
committed by
Guido van Rossum
parent
89f27742ca
commit
6152bad0af
@@ -7,8 +7,9 @@
|
||||
# ----- random classes -----
|
||||
|
||||
import _random
|
||||
import sys
|
||||
from typing import (
|
||||
Any, TypeVar, Sequence, List, Callable, AbstractSet, Union
|
||||
Any, TypeVar, Sequence, List, Callable, AbstractSet, Union, Optional
|
||||
)
|
||||
|
||||
_T = TypeVar('_T')
|
||||
@@ -50,6 +51,8 @@ def getrandbits(k: int) -> int: ...
|
||||
def randrange(start: int, stop: Union[None, int] = ..., step: int = ...) -> int: ...
|
||||
def randint(a: int, b: int) -> int: ...
|
||||
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: ...
|
||||
def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
|
||||
def random() -> float: ...
|
||||
|
||||
Reference in New Issue
Block a user