mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Recommend using PEP 585 (#5055)
* Remove conventions enforced by black Remove old note about optional default arguments (now part of PEP 484 and enforced by CI) * Recommend to use PEP 585 Cf. #4820 * Try out using collections.abc * Reference mypy bug
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import _random
|
||||
import sys
|
||||
from typing import AbstractSet, Any, Callable, Iterable, List, MutableSequence, Optional, Sequence, Tuple, TypeVar, Union
|
||||
from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set
|
||||
from typing import Any, Optional, Tuple, TypeVar, Union
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -22,14 +23,14 @@ class Random(_random.Random):
|
||||
*,
|
||||
cum_weights: Optional[Sequence[float]] = ...,
|
||||
k: int = ...,
|
||||
) -> List[_T]: ...
|
||||
) -> list[_T]: ...
|
||||
def shuffle(self, x: MutableSequence[Any], random: Optional[Callable[[], float]] = ...) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def sample(
|
||||
self, population: Union[Sequence[_T], AbstractSet[_T]], k: int, *, counts: Optional[Iterable[_T]] = ...
|
||||
) -> List[_T]: ...
|
||||
self, population: Union[Sequence[_T], Set[_T]], k: int, *, counts: Optional[Iterable[_T]] = ...
|
||||
) -> list[_T]: ...
|
||||
else:
|
||||
def sample(self, population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
|
||||
def sample(self, population: Union[Sequence[_T], Set[_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: Optional[float] = ...) -> float: ...
|
||||
@@ -64,14 +65,14 @@ def choices(
|
||||
*,
|
||||
cum_weights: Optional[Sequence[float]] = ...,
|
||||
k: int = ...,
|
||||
) -> List[_T]: ...
|
||||
) -> list[_T]: ...
|
||||
def shuffle(x: MutableSequence[Any], random: Optional[Callable[[], float]] = ...) -> 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], Set[_T]], k: int, *, counts: Optional[Iterable[_T]] = ...) -> list[_T]: ...
|
||||
|
||||
else:
|
||||
def sample(population: Union[Sequence[_T], AbstractSet[_T]], k: int) -> List[_T]: ...
|
||||
def sample(population: Union[Sequence[_T], Set[_T]], k: int) -> list[_T]: ...
|
||||
|
||||
def random() -> float: ...
|
||||
def uniform(a: float, b: float) -> float: ...
|
||||
|
||||
Reference in New Issue
Block a user