Simplify __all__ for modules beginning with 'm' to 't' (#8028)

This commit is contained in:
Alex Waygood
2022-06-07 20:14:15 +01:00
committed by GitHub
parent b88ea4a499
commit 591593c85f
15 changed files with 620 additions and 1626 deletions

View File

@@ -20,149 +20,46 @@ from importlib.machinery import ModuleSpec
from typing import Any, ClassVar, Generic, Mapping, TypeVar, overload # noqa: Y027
from typing_extensions import Literal, ParamSpec, final
__all__ = [
"FunctionType",
"LambdaType",
"CodeType",
"MappingProxyType",
"SimpleNamespace",
"GeneratorType",
"CoroutineType",
"AsyncGeneratorType",
"MethodType",
"BuiltinFunctionType",
"ModuleType",
"TracebackType",
"FrameType",
"GetSetDescriptorType",
"MemberDescriptorType",
"new_class",
"prepare_class",
"DynamicClassAttribute",
"coroutine",
]
if sys.version_info >= (3, 7):
__all__ += [
"BuiltinMethodType",
"ClassMethodDescriptorType",
"MethodDescriptorType",
"MethodWrapperType",
"WrapperDescriptorType",
"resolve_bases",
]
if sys.version_info >= (3, 8):
__all__ += ["CellType"]
if sys.version_info >= (3, 9):
__all__ += ["GenericAlias"]
if sys.version_info >= (3, 10):
__all__ = [
"FunctionType",
"LambdaType",
"CodeType",
"MappingProxyType",
"SimpleNamespace",
"CellType",
"GeneratorType",
"CoroutineType",
"AsyncGeneratorType",
"MethodType",
"BuiltinFunctionType",
"BuiltinMethodType",
"WrapperDescriptorType",
"MethodWrapperType",
"MethodDescriptorType",
"ClassMethodDescriptorType",
"ModuleType",
"TracebackType",
"FrameType",
"GetSetDescriptorType",
"MemberDescriptorType",
"new_class",
"resolve_bases",
"prepare_class",
"DynamicClassAttribute",
"coroutine",
"GenericAlias",
"UnionType",
"EllipsisType",
"NoneType",
"NotImplementedType",
]
elif sys.version_info >= (3, 9):
__all__ = [
"FunctionType",
"LambdaType",
"CodeType",
"MappingProxyType",
"SimpleNamespace",
"CellType",
"GeneratorType",
"CoroutineType",
"AsyncGeneratorType",
"MethodType",
"BuiltinFunctionType",
"BuiltinMethodType",
"WrapperDescriptorType",
"MethodWrapperType",
"MethodDescriptorType",
"ClassMethodDescriptorType",
"ModuleType",
"TracebackType",
"FrameType",
"GetSetDescriptorType",
"MemberDescriptorType",
"new_class",
"resolve_bases",
"prepare_class",
"DynamicClassAttribute",
"coroutine",
"GenericAlias",
]
elif sys.version_info >= (3, 8):
__all__ = [
"FunctionType",
"LambdaType",
"CodeType",
"MappingProxyType",
"SimpleNamespace",
"CellType",
"GeneratorType",
"CoroutineType",
"AsyncGeneratorType",
"MethodType",
"BuiltinFunctionType",
"BuiltinMethodType",
"WrapperDescriptorType",
"MethodWrapperType",
"MethodDescriptorType",
"ClassMethodDescriptorType",
"ModuleType",
"TracebackType",
"FrameType",
"GetSetDescriptorType",
"MemberDescriptorType",
"new_class",
"resolve_bases",
"prepare_class",
"DynamicClassAttribute",
"coroutine",
]
elif sys.version_info >= (3, 7):
__all__ = [
"FunctionType",
"LambdaType",
"CodeType",
"MappingProxyType",
"SimpleNamespace",
"GeneratorType",
"CoroutineType",
"AsyncGeneratorType",
"MethodType",
"BuiltinFunctionType",
"BuiltinMethodType",
"WrapperDescriptorType",
"MethodWrapperType",
"MethodDescriptorType",
"ClassMethodDescriptorType",
"ModuleType",
"TracebackType",
"FrameType",
"GetSetDescriptorType",
"MemberDescriptorType",
"new_class",
"resolve_bases",
"prepare_class",
"DynamicClassAttribute",
"coroutine",
]
else:
__all__ = [
"FunctionType",
"LambdaType",
"CodeType",
"MappingProxyType",
"SimpleNamespace",
"GeneratorType",
"CoroutineType",
"AsyncGeneratorType",
"MethodType",
"BuiltinFunctionType",
"ModuleType",
"TracebackType",
"FrameType",
"GetSetDescriptorType",
"MemberDescriptorType",
"new_class",
"prepare_class",
"DynamicClassAttribute",
"coroutine",
]
__all__ += ["EllipsisType", "NoneType", "NotImplementedType", "UnionType"]
# Note, all classes "defined" here require special handling.