@@ -407,9 +407,68 @@ pickle.Unpickler.memo # undocumented implementation detail, has different type
407407re.Pattern.scanner # Undocumented and not useful. #6405
408408tempfile._TemporaryFileWrapper.[\w_]+ # Dynamically specified by __getattr__, and thus don't exist on the class
409409
410- # Various classes in typing aren't types at runtime. In addition, mypy thinks some special forms are tautologically defined.
411- typing.[A-Z]\w+
412- typing_extensions\..*
410+ # Details of runtime definition don't need to be in stubs
411+ typing_extensions\._SpecialForm.*
412+ typing_extensions\.TypeVar.*
413+ typing_extensions\.ParamSpec.*
414+ typing\.Generic
415+ typing\.Protocol
416+
417+ # Special primitives
418+ typing_extensions\.Annotated
419+ typing_extensions\.NamedTuple
420+ typing_extensions\.LiteralString
421+ typing_extensions\.Coroutine
422+ typing_extensions\.Awaitable
423+ typing_extensions\.AsyncIterator
424+ typing_extensions\.AsyncIterable
425+ typing_extensions\.AsyncGenerator
426+ typing\.ValuesView
427+ typing\.Sized
428+ typing\.Sequence
429+ typing\.Reversible
430+ typing\.Pattern
431+ typing\.MutableSet
432+ typing\.MutableSequence
433+ typing\.MutableMapping
434+ typing\.Match
435+ typing\.MappingView
436+ typing\.Mapping
437+ typing\.KeysView
438+ typing\.Iterator
439+ typing\.Iterable
440+ typing\.ItemsView
441+ typing\.Hashable
442+ typing\.Generator
443+ typing\.Coroutine
444+ typing\.Collection
445+ typing\.Container
446+ typing\.ByteString
447+ typing\.AwaitableGenerator
448+ typing\.Awaitable
449+ typing\.AsyncIterator
450+ typing\.AsyncIterable
451+ typing\.AsyncGenerator
452+ typing\.AbstractSet
453+
454+ # Internal attributes
455+ .*\.__protocol_attrs__
456+ .*\.__callable_proto_members_only__
457+
458+ # Exist at runtime for internal reasons, no need to put them in the stub
459+ typing_extensions\.TypeAliasType\.__call__
460+ typing_extensions\.TypeAliasType\.__init_subclass__
461+
462+ typing_extensions.NewType.__mro_entries__ # just exists for an error message
463+
464+ # We call them read-only properties, runtime implementation is slightly different
465+ typing_extensions\.TypeAliasType\.__(parameters|type_params|name|module|value)__
466+
467+ # https://github.com/python/mypy/issues/15302
468+ typing_extensions.NewType.__call__
469+ typing_extensions\.deprecated
470+ typing_extensions\.get_original_bases
471+ typing_extensions\.override
413472
414473# These are abstract properties at runtime,
415474# but marking them as such in the stub breaks half the the typed-Python ecosystem (see #8726)
0 commit comments