From d84069e78dc6e9d1248ca4259044444fbbbd4e2a Mon Sep 17 00:00:00 2001 From: Jakub Nabaglo Date: Tue, 22 May 2018 12:38:00 +1000 Subject: [PATCH] Add stub for random.Random.choices (#2156) --- stdlib/3/random.pyi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stdlib/3/random.pyi b/stdlib/3/random.pyi index e32f1bb6e..41107fc4f 100644 --- a/stdlib/3/random.pyi +++ b/stdlib/3/random.pyi @@ -23,6 +23,8 @@ class Random(_random.Random): def randrange(self, start: int, stop: Union[int, None] = ..., step: int = ...) -> int: ... def randint(self, a: int, b: int) -> int: ... 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: ... def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ... def random(self) -> float: ...