Drop Python 3.8 branches (#13776)

This commit is contained in:
Sebastian Rittau
2025-04-03 10:35:36 +02:00
committed by GitHub
parent 1e43190554
commit 30b16c168d
117 changed files with 1023 additions and 2639 deletions
+6 -19
View File
@@ -30,10 +30,9 @@ __all__ = [
"getrandbits",
"choices",
"SystemRandom",
"randbytes",
]
if sys.version_info >= (3, 9):
__all__ += ["randbytes"]
if sys.version_info >= (3, 12):
__all__ += ["binomialvariate"]
@@ -41,25 +40,16 @@ _T = TypeVar("_T")
class Random(_random.Random):
VERSION: ClassVar[int]
if sys.version_info >= (3, 9):
def __init__(self, x: int | float | str | bytes | bytearray | None = None) -> None: ... # noqa: Y041
else:
def __init__(self, x: Any = None) -> None: ...
def __init__(self, x: int | float | str | bytes | bytearray | None = None) -> None: ... # noqa: Y041
# 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 = None, version: int = 2) -> None: ... # type: ignore[override] # noqa: Y041
else:
def seed(self, a: Any = None, version: int = 2) -> None: ...
def seed(self, a: int | float | str | bytes | bytearray | None = None, version: int = 2) -> None: ... # type: ignore[override] # noqa: Y041
def getstate(self) -> tuple[Any, ...]: ...
def setstate(self, state: tuple[Any, ...]) -> None: ...
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: ...
def randbytes(self, n: int) -> bytes: ...
def choice(self, seq: SupportsLenAndGetItem[_T]) -> _T: ...
def choices(
self,
@@ -75,12 +65,10 @@ class Random(_random.Random):
def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = None) -> None: ...
if sys.version_info >= (3, 11):
def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = None) -> list[_T]: ...
elif sys.version_info >= (3, 9):
else:
def sample(
self, population: Sequence[_T] | AbstractSet[_T], k: int, *, counts: Iterable[int] | None = None
) -> list[_T]: ...
else:
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 = 0.0, high: float = 1.0, mode: float | None = None) -> float: ...
@@ -137,5 +125,4 @@ weibullvariate = _inst.weibullvariate
getstate = _inst.getstate
setstate = _inst.setstate
getrandbits = _inst.getrandbits
if sys.version_info >= (3, 9):
randbytes = _inst.randbytes
randbytes = _inst.randbytes