Clean up stubtest allowlist for typing (#10205)

This commit is contained in:
Jelle Zijlstra
2023-05-24 12:33:46 -07:00
committed by GitHub
parent e4dcfccbd5
commit 185adf01a9
8 changed files with 124 additions and 9 deletions

View File

@@ -172,3 +172,14 @@ dataclasses.KW_ONLY
# We pretend it's a read-only property for forward compatibility with 3.12
typing.ParamSpec(Args|Kwargs).__origin__
# https://github.com/python/mypy/issues/15302
typing_extensions\.assert_never
typing_extensions\.assert_type
typing_extensions\.reveal_type
typing.NewType.__call__
# Super-special typing primitives
typing_extensions\.Final
typing\.NamedTuple
typing\.Annotated

View File

@@ -126,7 +126,7 @@ contextlib.AbstractAsyncContextManager.__class_getitem__
contextlib.AbstractContextManager.__class_getitem__
# Super-special typing primitives
typing._SpecialForm.__mro_entries__
typing\._SpecialForm.*
typing._TypedDict.__delitem__
typing._TypedDict.__ior__
typing._TypedDict.__or__
@@ -137,6 +137,10 @@ typing._TypedDict.pop
typing._TypedDict.setdefault
typing._TypedDict.update
typing._TypedDict.values
typing_extensions\.Final
typing\.NamedTuple
typing\.LiteralString
typing\.Annotated
# White lies around defaults
dataclasses.KW_ONLY

View File

@@ -151,3 +151,11 @@ types.GetSetDescriptorType.__get__
types.MemberDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
# https://github.com/python/mypy/issues/15302
typing_extensions\.assert_never
typing_extensions\.assert_type
typing_extensions\.reveal_type
# Doesn't exist at runtime
typing\.Protocol

View File

@@ -169,3 +169,11 @@ types.GetSetDescriptorType.__get__
types.MemberDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
# https://github.com/python/mypy/issues/15302
typing_extensions\.assert_never
typing_extensions\.assert_type
typing_extensions\.reveal_type
# Super-special typing primitives
typing_extensions\.Final

View File

@@ -165,3 +165,13 @@ types.GetSetDescriptorType.__get__
types.MemberDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
# https://github.com/python/mypy/issues/15302
typing_extensions\.assert_never
typing_extensions\.assert_type
typing_extensions\.reveal_type
# Super-special typing primitives
typing_extensions\.Final
typing\.NamedTuple
typing\.Annotated

View File

@@ -407,9 +407,68 @@ pickle.Unpickler.memo # undocumented implementation detail, has different type
re.Pattern.scanner # Undocumented and not useful. #6405
tempfile._TemporaryFileWrapper.[\w_]+ # Dynamically specified by __getattr__, and thus don't exist on the class
# Various classes in typing aren't types at runtime. In addition, mypy thinks some special forms are tautologically defined.
typing.[A-Z]\w+
typing_extensions\..*
# Details of runtime definition don't need to be in stubs
typing_extensions\._SpecialForm.*
typing_extensions\.TypeVar.*
typing_extensions\.ParamSpec.*
typing\.Generic
typing\.Protocol
# Special primitives
typing_extensions\.Annotated
typing_extensions\.NamedTuple
typing_extensions\.LiteralString
typing_extensions\.Coroutine
typing_extensions\.Awaitable
typing_extensions\.AsyncIterator
typing_extensions\.AsyncIterable
typing_extensions\.AsyncGenerator
typing\.ValuesView
typing\.Sized
typing\.Sequence
typing\.Reversible
typing\.Pattern
typing\.MutableSet
typing\.MutableSequence
typing\.MutableMapping
typing\.Match
typing\.MappingView
typing\.Mapping
typing\.KeysView
typing\.Iterator
typing\.Iterable
typing\.ItemsView
typing\.Hashable
typing\.Generator
typing\.Coroutine
typing\.Collection
typing\.Container
typing\.ByteString
typing\.AwaitableGenerator
typing\.Awaitable
typing\.AsyncIterator
typing\.AsyncIterable
typing\.AsyncGenerator
typing\.AbstractSet
# Internal attributes
.*\.__protocol_attrs__
.*\.__callable_proto_members_only__
# Exist at runtime for internal reasons, no need to put them in the stub
typing_extensions\.TypeAliasType\.__call__
typing_extensions\.TypeAliasType\.__init_subclass__
typing_extensions.NewType.__mro_entries__ # just exists for an error message
# We call them read-only properties, runtime implementation is slightly different
typing_extensions\.TypeAliasType\.__(parameters|type_params|name|module|value)__
# https://github.com/python/mypy/issues/15302
typing_extensions.NewType.__call__
typing_extensions\.deprecated
typing_extensions\.get_original_bases
typing_extensions\.override
# These are abstract properties at runtime,
# but marking them as such in the stub breaks half the the typed-Python ecosystem (see #8726)