py312: Fix stubtest nits in typing/typing_extensions (#10659)

This commit is contained in:
Alex Waygood
2023-09-04 15:39:11 +01:00
committed by GitHub
parent d868dad76b
commit 433204fb8f
7 changed files with 30 additions and 16 deletions

View File

@@ -126,6 +126,9 @@ if sys.version_info >= (3, 11):
"reveal_type",
]
if sys.version_info >= (3, 12):
__all__ += ["TypeAliasType", "override"]
ContextManager = AbstractContextManager
AsyncContextManager = AbstractAsyncContextManager
@@ -323,7 +326,9 @@ AnyStr = TypeVar("AnyStr", str, bytes) # noqa: Y001
# Technically in 3.7 this inherited from GenericMeta. But let's not reflect that, since
# type checkers tend to assume that Protocols all have the ABCMeta metaclass.
class _ProtocolMeta(ABCMeta): ...
class _ProtocolMeta(ABCMeta):
if sys.version_info >= (3, 12):
def __init__(cls, *args: Any, **kwargs: Any) -> None: ...
# Abstract base classes.
@@ -945,7 +950,7 @@ if sys.version_info >= (3, 10):
def _type_repr(obj: object) -> str: ...
if sys.version_info >= (3, 12):
def override(__arg: _F) -> _F: ...
def override(__method: _F) -> _F: ...
@_final
class TypeAliasType:
def __init__(

View File

@@ -162,3 +162,6 @@ pkgutil.ImpImporter\..*
pkgutil.ImpLoader\..*
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
# https://github.com/python/mypy/issues/15302
typing_extensions\.override

View File

@@ -123,3 +123,6 @@ asynchat.async_chat.use_encoding
asynchat.find_prefix_at_end
pkgutil.ImpImporter\..*
pkgutil.ImpLoader\..*
# https://github.com/python/mypy/issues/15302
typing_extensions\.override

View File

@@ -18,19 +18,6 @@ importlib.metadata._meta.SimplePath.parent
poplib.POP3_SSL.__init__
smtplib.SMTP.starttls
smtplib.SMTP_SSL.__init__
typing.ParamSpec.__mro_entries__
typing.ParamSpecArgs.__mro_entries__
typing.ParamSpecKwargs.__mro_entries__
typing.SupportsAbs.__type_params__
typing.SupportsRound.__type_params__
typing.TypeVar.__mro_entries__
typing.TypeVarTuple.__mro_entries__
typing._ProtocolMeta.__init__
typing.__all__
typing.override
typing_extensions.Protocol
typing_extensions.SupportsAbs.__type_params__
typing_extensions.SupportsRound.__type_params__
urllib.request.AbstractHTTPHandler.__init__
urllib.request.HTTPSHandler.__init__
@@ -135,6 +122,21 @@ typing\._SpecialForm.*
typing\.NamedTuple
typing\.LiteralString
typing\.Annotated
typing_extensions\.Protocol
# These only exist to give a better error message if you try to subclass an instance
typing.ParamSpec.__mro_entries__
typing.ParamSpecArgs.__mro_entries__
typing.ParamSpecKwargs.__mro_entries__
typing.TypeVar.__mro_entries__
typing.TypeVarTuple.__mro_entries__
# TODO: mypy should infer that this attribute is inherited from builtins.type;
# why doesn't it infer this?
typing.SupportsAbs.__type_params__
typing.SupportsRound.__type_params__
typing_extensions.SupportsAbs.__type_params__
typing_extensions.SupportsRound.__type_params__
# These two should be removable after 3.12rc2 is released:
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime

View File

@@ -144,6 +144,7 @@ types.WrapperDescriptorType.__get__
typing_extensions\.assert_never
typing_extensions\.assert_type
typing_extensions\.reveal_type
typing_extensions\.override
# We lie about the existence of these methods
.*.__buffer__

View File

@@ -131,6 +131,7 @@ types.WrapperDescriptorType.__get__
typing_extensions\.assert_never
typing_extensions\.assert_type
typing_extensions\.reveal_type
typing_extensions\.override
# Super-special typing primitives
typing\.NamedTuple

View File

@@ -463,7 +463,6 @@ typing_extensions.NewType.__mro_entries__ # just exists for an error message
# https://github.com/python/mypy/issues/15302
typing_extensions.NewType.__call__
typing_extensions\.deprecated
typing_extensions\.override
typing_extensions\.get_protocol_members
typing_extensions\.is_protocol