Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -2,7 +2,7 @@ import _random
import sys
from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set
from fractions import Fraction
from typing import Any, NoReturn, Optional, Tuple, TypeVar, Union
from typing import Any, NoReturn, Tuple, TypeVar
_T = TypeVar("_T")
@@ -12,7 +12,7 @@ class Random(_random.Random):
def getstate(self) -> Tuple[Any, ...]: ...
def setstate(self, state: Tuple[Any, ...]) -> None: ...
def getrandbits(self, __k: int) -> int: ...
def randrange(self, start: int, stop: Optional[int] = ..., step: int = ...) -> int: ...
def randrange(self, start: int, stop: int | None = ..., step: int = ...) -> int: ...
def randint(self, a: int, b: int) -> int: ...
if sys.version_info >= (3, 9):
def randbytes(self, n: int) -> bytes: ...
@@ -20,21 +20,19 @@ class Random(_random.Random):
def choices(
self,
population: Sequence[_T],
weights: Optional[Sequence[Union[float, Fraction]]] = ...,
weights: Sequence[float | Fraction] | None = ...,
*,
cum_weights: Optional[Sequence[Union[float, Fraction]]] = ...,
cum_weights: Sequence[float | Fraction] | None = ...,
k: int = ...,
) -> list[_T]: ...
def shuffle(self, x: MutableSequence[Any], random: Optional[Callable[[], float]] = ...) -> None: ...
def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ...
if sys.version_info >= (3, 9):
def sample(
self, population: Union[Sequence[_T], Set[_T]], k: int, *, counts: Optional[Iterable[_T]] = ...
) -> list[_T]: ...
def sample(self, population: Sequence[_T] | Set[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ...
else:
def sample(self, population: Union[Sequence[_T], Set[_T]], k: int) -> list[_T]: ...
def sample(self, population: 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: ...
def triangular(self, low: float = ..., high: float = ..., mode: float | None = ...) -> float: ...
def betavariate(self, alpha: float, beta: float) -> float: ...
def expovariate(self, lambd: float) -> float: ...
def gammavariate(self, alpha: float, beta: float) -> float: ...
@@ -55,7 +53,7 @@ def seed(a: Any = ..., version: int = ...) -> None: ...
def getstate() -> object: ...
def setstate(state: object) -> None: ...
def getrandbits(__k: int) -> int: ...
def randrange(start: int, stop: Union[None, int] = ..., step: int = ...) -> int: ...
def randrange(start: int, stop: None | int = ..., step: int = ...) -> int: ...
def randint(a: int, b: int) -> int: ...
if sys.version_info >= (3, 9):
@@ -63,23 +61,19 @@ if sys.version_info >= (3, 9):
def choice(seq: Sequence[_T]) -> _T: ...
def choices(
population: Sequence[_T],
weights: Optional[Sequence[float]] = ...,
*,
cum_weights: Optional[Sequence[float]] = ...,
k: int = ...,
population: Sequence[_T], weights: Sequence[float] | None = ..., *, cum_weights: Sequence[float] | None = ..., k: int = ...
) -> list[_T]: ...
def shuffle(x: MutableSequence[Any], random: Optional[Callable[[], float]] = ...) -> None: ...
def shuffle(x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ...
if sys.version_info >= (3, 9):
def sample(population: Union[Sequence[_T], Set[_T]], k: int, *, counts: Optional[Iterable[_T]] = ...) -> list[_T]: ...
def sample(population: Sequence[_T] | Set[_T], k: int, *, counts: Iterable[_T] | None = ...) -> list[_T]: ...
else:
def sample(population: Union[Sequence[_T], Set[_T]], k: int) -> list[_T]: ...
def sample(population: Sequence[_T] | Set[_T], k: int) -> list[_T]: ...
def random() -> float: ...
def uniform(a: float, b: float) -> float: ...
def triangular(low: float = ..., high: float = ..., mode: Optional[float] = ...) -> float: ...
def triangular(low: float = ..., high: float = ..., mode: float | None = ...) -> float: ...
def betavariate(alpha: float, beta: float) -> float: ...
def expovariate(lambd: float) -> float: ...
def gammavariate(alpha: float, beta: float) -> float: ...