Use "all +=" instead of duplicating the branches (#7865)

This commit is contained in:
Sebastian Rittau
2022-06-07 13:32:19 +02:00
committed by GitHub
parent 15ad2657db
commit 214bf15dce
3 changed files with 127 additions and 480 deletions

View File

@@ -11,466 +11,112 @@ if sys.version_info >= (3, 7):
if sys.version_info >= (3, 9):
from types import GenericAlias
if sys.version_info >= (3, 11):
__all__ = [
"Annotated",
"Any",
"Callable",
"ClassVar",
"Concatenate",
"Final",
"ForwardRef",
"Generic",
"Literal",
"LiteralString",
"NotRequired",
"Optional",
"ParamSpec",
"Protocol",
"Required",
"Tuple",
"Type",
"TypeVar",
"TypeVarTuple",
"Union",
"Unpack",
"AbstractSet",
"ByteString",
"Container",
"ContextManager",
"Hashable",
"ItemsView",
"Iterable",
"Iterator",
"KeysView",
"Mapping",
"MappingView",
"MutableMapping",
"MutableSequence",
"MutableSet",
"Sequence",
"Sized",
"ValuesView",
"Awaitable",
"AsyncIterator",
"AsyncIterable",
"Coroutine",
"Collection",
"AsyncGenerator",
__all__ = [
"AbstractSet",
"Any",
"AnyStr",
"ByteString",
"Callable",
"ClassVar",
"Container",
"ContextManager",
"Counter",
"DefaultDict",
"Deque",
"Dict",
"FrozenSet",
"Generator",
"Generic",
"Hashable",
"ItemsView",
"Iterable",
"Iterator",
"KeysView",
"List",
"Mapping",
"MappingView",
"MutableMapping",
"MutableSequence",
"MutableSet",
"NamedTuple",
"NewType",
"Optional",
"Reversible",
"Sequence",
"Set",
"Sized",
"SupportsAbs",
"SupportsBytes",
"SupportsComplex",
"SupportsFloat",
"SupportsInt",
"SupportsRound",
"Text",
"Tuple",
"Type",
"TypeVar",
"Union",
"ValuesView",
"TYPE_CHECKING",
"cast",
"get_type_hints",
"no_type_check",
"no_type_check_decorator",
"overload",
]
if sys.version_info < (3, 7):
__all__ += ["GenericMeta"]
if sys.version_info >= (3, 7):
__all__ += [
"AsyncContextManager",
"Reversible",
"SupportsAbs",
"SupportsBytes",
"SupportsComplex",
"SupportsFloat",
"SupportsIndex",
"SupportsInt",
"SupportsRound",
"AsyncGenerator",
"AsyncIterable",
"AsyncIterator",
"Awaitable",
"ChainMap",
"Counter",
"Deque",
"Dict",
"DefaultDict",
"List",
"Collection",
"Coroutine",
"ForwardRef",
"NoReturn",
"OrderedDict",
"Set",
"FrozenSet",
"NamedTuple",
]
if sys.version_info >= (3, 8):
__all__ += [
"Final",
"Literal",
"Protocol",
"SupportsIndex",
"TypedDict",
"Generator",
"BinaryIO",
"IO",
"Match",
"Pattern",
"TextIO",
"AnyStr",
"final",
"get_args",
"get_origin",
"runtime_checkable",
]
if sys.version_info >= (3, 9):
__all__ += ["Annotated", "BinaryIO", "IO", "Match", "Pattern", "TextIO"]
if sys.version_info >= (3, 10):
__all__ += ["Concatenate", "ParamSpec", "ParamSpecArgs", "ParamSpecKwargs", "TypeAlias", "TypeGuard", "is_typeddict"]
if sys.version_info >= (3, 11):
__all__ += [
"LiteralString",
"Never",
"NotRequired",
"Required",
"Self",
"TypeVarTuple",
"Unpack",
"assert_never",
"assert_type",
"cast",
"clear_overloads",
"dataclass_transform",
"final",
"get_args",
"get_origin",
"get_overloads",
"get_type_hints",
"is_typeddict",
"Never",
"NewType",
"no_type_check",
"no_type_check_decorator",
"NoReturn",
"overload",
"ParamSpecArgs",
"ParamSpecKwargs",
"reveal_type",
"runtime_checkable",
"Self",
"Text",
"TYPE_CHECKING",
"TypeAlias",
"TypeGuard",
]
elif sys.version_info >= (3, 10):
__all__ = [
"Annotated",
"Any",
"Callable",
"ClassVar",
"Concatenate",
"Final",
"ForwardRef",
"Generic",
"Literal",
"Optional",
"ParamSpec",
"Protocol",
"Tuple",
"Type",
"TypeVar",
"Union",
"AbstractSet",
"ByteString",
"Container",
"ContextManager",
"Hashable",
"ItemsView",
"Iterable",
"Iterator",
"KeysView",
"Mapping",
"MappingView",
"MutableMapping",
"MutableSequence",
"MutableSet",
"Sequence",
"Sized",
"ValuesView",
"Awaitable",
"AsyncIterator",
"AsyncIterable",
"Coroutine",
"Collection",
"AsyncGenerator",
"AsyncContextManager",
"Reversible",
"SupportsAbs",
"SupportsBytes",
"SupportsComplex",
"SupportsFloat",
"SupportsIndex",
"SupportsInt",
"SupportsRound",
"ChainMap",
"Counter",
"Deque",
"Dict",
"DefaultDict",
"List",
"OrderedDict",
"Set",
"FrozenSet",
"NamedTuple",
"TypedDict",
"Generator",
"BinaryIO",
"IO",
"Match",
"Pattern",
"TextIO",
"AnyStr",
"cast",
"final",
"get_args",
"get_origin",
"get_type_hints",
"is_typeddict",
"NewType",
"no_type_check",
"no_type_check_decorator",
"NoReturn",
"overload",
"ParamSpecArgs",
"ParamSpecKwargs",
"runtime_checkable",
"Text",
"TYPE_CHECKING",
"TypeAlias",
"TypeGuard",
]
elif sys.version_info >= (3, 9):
__all__ = [
"Annotated",
"Any",
"Callable",
"ClassVar",
"Final",
"ForwardRef",
"Generic",
"Literal",
"Optional",
"Protocol",
"Tuple",
"Type",
"TypeVar",
"Union",
"AbstractSet",
"ByteString",
"Container",
"ContextManager",
"Hashable",
"ItemsView",
"Iterable",
"Iterator",
"KeysView",
"Mapping",
"MappingView",
"MutableMapping",
"MutableSequence",
"MutableSet",
"Sequence",
"Sized",
"ValuesView",
"Awaitable",
"AsyncIterator",
"AsyncIterable",
"Coroutine",
"Collection",
"AsyncGenerator",
"AsyncContextManager",
"Reversible",
"SupportsAbs",
"SupportsBytes",
"SupportsComplex",
"SupportsFloat",
"SupportsIndex",
"SupportsInt",
"SupportsRound",
"ChainMap",
"Counter",
"Deque",
"Dict",
"DefaultDict",
"List",
"OrderedDict",
"Set",
"FrozenSet",
"NamedTuple",
"TypedDict",
"Generator",
"BinaryIO",
"IO",
"Match",
"Pattern",
"TextIO",
"AnyStr",
"cast",
"final",
"get_args",
"get_origin",
"get_type_hints",
"NewType",
"no_type_check",
"no_type_check_decorator",
"NoReturn",
"overload",
"runtime_checkable",
"Text",
"TYPE_CHECKING",
]
elif sys.version_info >= (3, 8):
__all__ = [
"Any",
"Callable",
"ClassVar",
"Final",
"ForwardRef",
"Generic",
"Literal",
"Optional",
"Protocol",
"Tuple",
"Type",
"TypeVar",
"Union",
"AbstractSet",
"ByteString",
"Container",
"ContextManager",
"Hashable",
"ItemsView",
"Iterable",
"Iterator",
"KeysView",
"Mapping",
"MappingView",
"MutableMapping",
"MutableSequence",
"MutableSet",
"Sequence",
"Sized",
"ValuesView",
"Awaitable",
"AsyncIterator",
"AsyncIterable",
"Coroutine",
"Collection",
"AsyncGenerator",
"AsyncContextManager",
"Reversible",
"SupportsAbs",
"SupportsBytes",
"SupportsComplex",
"SupportsFloat",
"SupportsIndex",
"SupportsInt",
"SupportsRound",
"ChainMap",
"Counter",
"Deque",
"Dict",
"DefaultDict",
"List",
"OrderedDict",
"Set",
"FrozenSet",
"NamedTuple",
"TypedDict",
"Generator",
"AnyStr",
"cast",
"final",
"get_args",
"get_origin",
"get_type_hints",
"NewType",
"no_type_check",
"no_type_check_decorator",
"NoReturn",
"overload",
"runtime_checkable",
"Text",
"TYPE_CHECKING",
]
elif sys.version_info >= (3, 7):
__all__ = [
"Any",
"Callable",
"ClassVar",
"ForwardRef",
"Generic",
"Optional",
"Tuple",
"Type",
"TypeVar",
"Union",
"AbstractSet",
"ByteString",
"Container",
"ContextManager",
"Hashable",
"ItemsView",
"Iterable",
"Iterator",
"KeysView",
"Mapping",
"MappingView",
"MutableMapping",
"MutableSequence",
"MutableSet",
"Sequence",
"Sized",
"ValuesView",
"Awaitable",
"AsyncIterator",
"AsyncIterable",
"Coroutine",
"Collection",
"AsyncGenerator",
"AsyncContextManager",
"Reversible",
"SupportsAbs",
"SupportsBytes",
"SupportsComplex",
"SupportsFloat",
"SupportsInt",
"SupportsRound",
"ChainMap",
"Counter",
"Deque",
"Dict",
"DefaultDict",
"List",
"OrderedDict",
"Set",
"FrozenSet",
"NamedTuple",
"Generator",
"AnyStr",
"cast",
"get_type_hints",
"NewType",
"no_type_check",
"no_type_check_decorator",
"NoReturn",
"overload",
"Text",
"TYPE_CHECKING",
]
else:
__all__ = [
"Any",
"Callable",
"ClassVar",
"Generic",
"Optional",
"Tuple",
"Type",
"TypeVar",
"Union",
"AbstractSet",
"GenericMeta",
"ByteString",
"Container",
"ContextManager",
"Hashable",
"ItemsView",
"Iterable",
"Iterator",
"KeysView",
"Mapping",
"MappingView",
"MutableMapping",
"MutableSequence",
"MutableSet",
"Sequence",
"Sized",
"ValuesView",
"Reversible",
"SupportsAbs",
"SupportsBytes",
"SupportsComplex",
"SupportsFloat",
"SupportsInt",
"SupportsRound",
"Counter",
"Deque",
"Dict",
"DefaultDict",
"List",
"Set",
"FrozenSet",
"NamedTuple",
"Generator",
"AnyStr",
"cast",
"get_type_hints",
"NewType",
"no_type_check",
"no_type_check_decorator",
"overload",
"Text",
"TYPE_CHECKING",
]
Any = object()