mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 19:01:15 +08:00
Change argument type in random.shuffle (python/typeshed#4255) (#4260)
Fixes #4255
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user