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

@@ -20,5 +20,5 @@ stubdefaulter==0.1.0
termcolor>=2.3
tomli==2.0.1
tomlkit==0.12.4
typing_extensions>=4.9.0rc1
typing_extensions>=4.12.0rc1
uv==0.1.27

View File

@@ -58,6 +58,9 @@ if sys.version_info >= (3, 10):
if sys.version_info >= (3, 12):
__all__ += ["get_original_bases"]
if sys.version_info >= (3, 13):
__all__ += ["CapsuleType"]
# Note, all classes "defined" here require special handling.
_T1 = TypeVar("_T1")
@@ -607,3 +610,7 @@ if sys.version_info >= (3, 10):
def __ror__(self, value: Any, /) -> UnionType: ...
def __eq__(self, value: object, /) -> bool: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 13):
@final
class CapsuleType: ...

View File

@@ -128,6 +128,9 @@ if sys.version_info >= (3, 11):
if sys.version_info >= (3, 12):
__all__ += ["TypeAliasType", "override"]
if sys.version_info >= (3, 13):
__all__ += ["get_protocol_members", "is_protocol", "NoDefault"]
Any = object()
def final(f: _T) -> _T: ...
@@ -985,3 +988,7 @@ if sys.version_info >= (3, 12):
if sys.version_info >= (3, 13):
def is_protocol(tp: type, /) -> bool: ...
def get_protocol_members(tp: type, /) -> frozenset[str]: ...
@final
class _NoDefaultType: ...
NoDefault: _NoDefaultType

View File

@@ -95,6 +95,7 @@ __all__ = [
"Coroutine",
"AsyncGenerator",
"AsyncContextManager",
"CapsuleType",
"ChainMap",
"ContextManager",
"Counter",
@@ -166,6 +167,7 @@ __all__ = [
"MutableMapping",
"MutableSequence",
"MutableSet",
"NoDefault",
"Optional",
"Pattern",
"Reversible",
@@ -452,13 +454,6 @@ class TypeVarTuple:
def __init__(self, name: str, *, default: Any | None = None) -> None: ...
def __iter__(self) -> Any: ... # Unpack[Self]
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: ...
if sys.version_info >= (3, 12):
from collections.abc import Buffer as Buffer
from types import get_original_bases as get_original_bases
@@ -494,10 +489,25 @@ else:
def __buffer__(self, flags: int, /) -> memoryview: ...
if sys.version_info >= (3, 13):
from typing import get_protocol_members as get_protocol_members, is_protocol as is_protocol
from types import CapsuleType as CapsuleType
from typing import NoDefault as NoDefault, get_protocol_members as get_protocol_members, is_protocol as is_protocol
from warnings import deprecated as deprecated
else:
def is_protocol(tp: type, /) -> bool: ...
def get_protocol_members(tp: type, /) -> frozenset[str]: ...
@final
class _NoDefaultType: ...
NoDefault: _NoDefaultType
@final
class CapsuleType: ...
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: ...
class Doc:
documentation: str

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: ...