Fix stdlib stubtest after latest typing-extensions release (#11923)

This commit is contained in:
Alex Waygood
2024-05-16 16:53:19 -04:00
committed by GitHub
parent 77d6947479
commit 5b0816e784
5 changed files with 46 additions and 10 deletions

View File

@@ -3,7 +3,7 @@ from _warnings import warn as warn, warn_explicit as warn_explicit
from collections.abc import Sequence
from types import ModuleType, TracebackType
from typing import Any, Generic, Literal, TextIO, TypeVar, overload
from typing_extensions import TypeAlias
from typing_extensions import LiteralString, TypeAlias
__all__ = [
"warn",
@@ -16,6 +16,10 @@ __all__ = [
"catch_warnings",
]
if sys.version_info >= (3, 13):
__all__ += ["deprecated"]
_T = TypeVar("_T")
_W = TypeVar("_W", bound=list[WarningMessage] | None)
_ActionKind: TypeAlias = Literal["default", "error", "ignore", "always", "module", "once"]
@@ -110,3 +114,11 @@ class catch_warnings(Generic[_W]):
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
if sys.version_info >= (3, 13):
class deprecated:
message: LiteralString
category: type[Warning] | None
stacklevel: int
def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
def __call__(self, arg: _T, /) -> _T: ...