diff --git a/stdlib/2/random.pyi b/stdlib/2/random.pyi index 65d323db1..403d40c78 100644 --- a/stdlib/2/random.pyi +++ b/stdlib/2/random.pyi @@ -7,7 +7,7 @@ # ----- random classes ----- import _random -from typing import AbstractSet, Any, Callable, Iterator, List, Protocol, Sequence, TypeVar, Union, overload +from typing import AbstractSet, Any, Callable, Iterator, List, MutableSequence, Protocol, Sequence, TypeVar, Union, overload _T = TypeVar("_T") _T_co = TypeVar('_T_co', covariant=True) @@ -29,7 +29,7 @@ class Random(_random.Random): def randrange(self, start: int, stop: int, step: int = ...) -> int: ... def randint(self, a: int, b: int) -> int: ... def choice(self, seq: Sequence[_T]) -> _T: ... - def shuffle(self, x: List[Any], random: Callable[[], None] = ...) -> None: ... + def shuffle(self, x: MutableSequence[Any], random: Callable[[], None] = ...) -> None: ... def sample(self, population: _Sampleable[_T], k: int) -> List[_T]: ... def random(self) -> float: ... def uniform(self, a: float, b: float) -> float: ... @@ -60,7 +60,7 @@ def randrange(stop: int) -> int: ... def randrange(start: int, stop: int, step: int = ...) -> int: ... def randint(a: int, b: int) -> int: ... def choice(seq: Sequence[_T]) -> _T: ... -def shuffle(x: List[Any], random: Callable[[], float] = ...) -> None: ... +def shuffle(x: MutableSequence[Any], random: Callable[[], float] = ...) -> None: ... def sample(population: _Sampleable[_T], k: int) -> List[_T]: ... def random() -> float: ... def uniform(a: float, b: float) -> float: ... diff --git a/stdlib/3/random.pyi b/stdlib/3/random.pyi index fab7770a4..fd2b4e94c 100644 --- a/stdlib/3/random.pyi +++ b/stdlib/3/random.pyi @@ -8,7 +8,7 @@ import _random import sys -from typing import Any, TypeVar, Sequence, Iterable, List, Callable, AbstractSet, Union, Optional, Tuple +from typing import Any, TypeVar, Sequence, Iterable, List, MutableSequence, Callable, AbstractSet, Union, Optional, Tuple _T = TypeVar('_T') @@ -25,7 +25,7 @@ class Random(_random.Random): 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 shuffle(self, x: MutableSequence[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]: ... else: @@ -59,7 +59,7 @@ if sys.version_info >= (3, 9): 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 shuffle(x: MutableSequence[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]: ... else: