mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-22 19:13:34 +08:00
stdlib: add argument default values (#9501)
This commit is contained in:
@@ -39,18 +39,18 @@ _T = TypeVar("_T")
|
||||
|
||||
class Random(_random.Random):
|
||||
VERSION: ClassVar[int]
|
||||
def __init__(self, x: Any = ...) -> None: ...
|
||||
def __init__(self, x: Any = None) -> None: ...
|
||||
# Using other `seed` types is deprecated since 3.9 and removed in 3.11
|
||||
# Ignore Y041, since random.seed doesn't treat int like a float subtype. Having an explicit
|
||||
# int better documents conventional usage of random.seed.
|
||||
if sys.version_info >= (3, 9):
|
||||
def seed(self, a: int | float | str | bytes | bytearray | None = ..., version: int = ...) -> None: ... # type: ignore[override] # noqa: Y041
|
||||
def seed(self, a: int | float | str | bytes | bytearray | None = None, version: int = 2) -> None: ... # type: ignore[override] # noqa: Y041
|
||||
else:
|
||||
def seed(self, a: Any = ..., version: int = ...) -> None: ...
|
||||
|
||||
def getstate(self) -> tuple[Any, ...]: ...
|
||||
def setstate(self, state: tuple[Any, ...]) -> None: ...
|
||||
def randrange(self, start: int, stop: int | None = ..., step: int = ...) -> int: ...
|
||||
def randrange(self, start: int, stop: int | None = None, step: int = 1) -> int: ...
|
||||
def randint(self, a: int, b: int) -> int: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def randbytes(self, n: int) -> bytes: ...
|
||||
@@ -59,17 +59,17 @@ class Random(_random.Random):
|
||||
def choices(
|
||||
self,
|
||||
population: SupportsLenAndGetItem[_T],
|
||||
weights: Sequence[float | Fraction] | None = ...,
|
||||
weights: Sequence[float | Fraction] | None = None,
|
||||
*,
|
||||
cum_weights: Sequence[float | Fraction] | None = ...,
|
||||
k: int = ...,
|
||||
cum_weights: Sequence[float | Fraction] | None = None,
|
||||
k: int = 1,
|
||||
) -> list[_T]: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def shuffle(self, x: MutableSequence[Any]) -> None: ...
|
||||
else:
|
||||
def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = ...) -> list[_T]: ...
|
||||
def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = None) -> list[_T]: ...
|
||||
elif sys.version_info >= (3, 9):
|
||||
def sample(
|
||||
self, population: Sequence[_T] | AbstractSet[_T], k: int, *, counts: Iterable[int] | None = ...
|
||||
@@ -78,7 +78,7 @@ class Random(_random.Random):
|
||||
def sample(self, population: Sequence[_T] | AbstractSet[_T], k: int) -> list[_T]: ...
|
||||
|
||||
def uniform(self, a: float, b: float) -> float: ...
|
||||
def triangular(self, low: float = ..., high: float = ..., mode: float | None = ...) -> float: ...
|
||||
def triangular(self, low: float = ..., high: float = ..., mode: float | None = None) -> float: ...
|
||||
def betavariate(self, alpha: float, beta: float) -> float: ...
|
||||
def expovariate(self, lambd: float) -> float: ...
|
||||
def gammavariate(self, alpha: float, beta: float) -> float: ...
|
||||
|
||||
Reference in New Issue
Block a user