Update functools.pyi for Python3.12 (#10269)

This commit is contained in:
Nikita Sobolev
2023-06-07 00:48:36 +03:00
committed by GitHub
parent 70d8d059a0
commit e347af1d59
2 changed files with 39 additions and 17 deletions

View File

@@ -72,9 +72,19 @@ if sys.version_info >= (3, 8):
else:
def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
WRAPPER_ASSIGNMENTS: tuple[
Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"]
]
if sys.version_info >= (3, 12):
WRAPPER_ASSIGNMENTS: tuple[
Literal["__module__"],
Literal["__name__"],
Literal["__qualname__"],
Literal["__doc__"],
Literal["__annotations__"],
Literal["__type_params__"],
]
else:
WRAPPER_ASSIGNMENTS: tuple[
Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"]
]
WRAPPER_UPDATES: tuple[Literal["__dict__"]]
class _Wrapped(Generic[_PWrapped, _RWrapped, _PWrapper, _RWapper]):
@@ -87,17 +97,32 @@ class _Wrapped(Generic[_PWrapped, _RWrapped, _PWrapper, _RWapper]):
class _Wrapper(Generic[_PWrapped, _RWrapped]):
def __call__(self, f: Callable[_PWrapper, _RWapper]) -> _Wrapped[_PWrapped, _RWrapped, _PWrapper, _RWapper]: ...
def update_wrapper(
wrapper: Callable[_PWrapper, _RWapper],
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapped[_PWrapped, _RWrapped, _PWrapper, _RWapper]: ...
def wraps(
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapper[_PWrapped, _RWrapped]: ...
if sys.version_info >= (3, 12):
def update_wrapper(
wrapper: Callable[_PWrapper, _RWapper],
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__", "__type_params__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapped[_PWrapped, _RWrapped, _PWrapper, _RWapper]: ...
def wraps(
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__", "__type_params__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapper[_PWrapped, _RWrapped]: ...
else:
def update_wrapper(
wrapper: Callable[_PWrapper, _RWapper],
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapped[_PWrapped, _RWrapped, _PWrapper, _RWapper]: ...
def wraps(
wrapped: Callable[_PWrapped, _RWrapped],
assigned: Sequence[str] = ("__module__", "__name__", "__qualname__", "__doc__", "__annotations__"),
updated: Sequence[str] = ("__dict__",),
) -> _Wrapper[_PWrapped, _RWrapped]: ...
def total_ordering(cls: type[_T]) -> type[_T]: ...
def cmp_to_key(mycmp: Callable[[_T, _T], int]) -> Callable[[_T], SupportsAllComparisons]: ...