Remove Python 3.7 branches (#11238)

This commit is contained in:
Sebastian Rittau
2024-01-05 11:39:39 +01:00
committed by GitHub
parent 4e62577002
commit 23604858a6
122 changed files with 1952 additions and 3800 deletions

View File

@@ -1,7 +1,6 @@
from __future__ import annotations
import sys
from functools import wraps
from functools import cached_property, wraps
from typing import Callable, TypeVar
from typing_extensions import ParamSpec, assert_type
@@ -24,26 +23,26 @@ def my_decorator(func: Callable[P, T_co]) -> Callable[P, T_co]:
return wrapper
if sys.version_info >= (3, 8):
from functools import cached_property
class A:
def __init__(self, x: int):
self.x = x
class A:
def __init__(self, x: int):
self.x = x
@cached_property
def x(self) -> int:
return 0
@cached_property
def x(self) -> int:
return 0
assert_type(A(x=1).x, int)
assert_type(A(x=1).x, int)
class B:
@cached_property
def x(self) -> int:
return 0
def check_cached_property_settable(x: int) -> None:
b = B()
assert_type(b.x, int)
b.x = x
assert_type(b.x, int)
class B:
@cached_property
def x(self) -> int:
return 0
def check_cached_property_settable(x: int) -> None:
b = B()
assert_type(b.x, int)
b.x = x
assert_type(b.x, int)

View File

@@ -298,25 +298,23 @@ def polynomial_derivative(coefficients: Sequence[float]) -> list[float]:
return list(map(operator.mul, coefficients, powers))
if sys.version_info >= (3, 8):
def nth_combination(iterable: Iterable[_T], r: int, index: int) -> tuple[_T, ...]:
"Equivalent to list(combinations(iterable, r))[index]"
pool = tuple(iterable)
n = len(pool)
c = math.comb(n, r)
if index < 0:
index += c
if index < 0 or index >= c:
raise IndexError
result: list[_T] = []
while r:
c, n, r = c * r // n, n - 1, r - 1
while index >= c:
index -= c
c, n = c * (n - r) // n, n - 1
result.append(pool[-1 - n])
return tuple(result)
def nth_combination(iterable: Iterable[_T], r: int, index: int) -> tuple[_T, ...]:
"Equivalent to list(combinations(iterable, r))[index]"
pool = tuple(iterable)
n = len(pool)
c = math.comb(n, r)
if index < 0:
index += c
if index < 0 or index >= c:
raise IndexError
result: list[_T] = []
while r:
c, n, r = c * r // n, n - 1, r - 1
while index >= c:
index -= c
c, n = c * (n - r) // n, n - 1
result.append(pool[-1 - n])
return tuple(result)
if sys.version_info >= (3, 10):

View File

@@ -13,5 +13,4 @@ from zipfile import * # noqa: F403
if sys.version_info >= (3, 9):
x: Annotated[int, 42] # noqa: F405
if sys.version_info >= (3, 8):
p: Path # noqa: F405
p: Path # noqa: F405