Simplify __all__ definitions in modules beginning with 'a' to 'l' (#8026)

This commit is contained in:
Alex Waygood
2022-06-07 14:40:48 +01:00
committed by GitHub
parent 214bf15dce
commit e88a182573
17 changed files with 419 additions and 883 deletions

View File

@@ -21,30 +21,18 @@ if sys.version_info >= (3, 7):
all_feature_names: list[str] # undocumented
__all__ = [
"all_feature_names",
"absolute_import",
"division",
"generators",
"nested_scopes",
"print_function",
"unicode_literals",
"with_statement",
"barry_as_FLUFL",
"generator_stop",
]
if sys.version_info >= (3, 7):
__all__ = [
"all_feature_names",
"absolute_import",
"division",
"generators",
"nested_scopes",
"print_function",
"unicode_literals",
"with_statement",
"barry_as_FLUFL",
"generator_stop",
"annotations",
]
else:
__all__ = [
"all_feature_names",
"absolute_import",
"division",
"generators",
"nested_scopes",
"print_function",
"unicode_literals",
"with_statement",
"barry_as_FLUFL",
"generator_stop",
]
__all__ += ["annotations"]

View File

@@ -10,56 +10,32 @@ _TF: TypeAlias = Callable[[FrameType, str, Any], Callable[..., Any] | None]
_PF: TypeAlias = Callable[[FrameType, str, Any], None]
_T = TypeVar("_T")
__all__ = [
"get_ident",
"active_count",
"Condition",
"current_thread",
"enumerate",
"main_thread",
"TIMEOUT_MAX",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Barrier",
"BrokenBarrierError",
"Timer",
"ThreadError",
"setprofile",
"settrace",
"local",
"stack_size",
]
if sys.version_info >= (3, 8):
__all__ = [
"get_ident",
"active_count",
"Condition",
"current_thread",
"enumerate",
"main_thread",
"TIMEOUT_MAX",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Barrier",
"BrokenBarrierError",
"Timer",
"ThreadError",
"setprofile",
"settrace",
"local",
"stack_size",
"excepthook",
"ExceptHookArgs",
]
else:
__all__ = [
"get_ident",
"active_count",
"Condition",
"current_thread",
"enumerate",
"main_thread",
"TIMEOUT_MAX",
"Event",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Thread",
"Barrier",
"BrokenBarrierError",
"Timer",
"ThreadError",
"setprofile",
"settrace",
"local",
"stack_size",
]
__all__ += ["ExceptHookArgs", "excepthook"]
def active_count() -> int: ...
def current_thread() -> Thread: ...

View File

@@ -4,82 +4,44 @@ import sys
# However, in all likelihood, the differences are inconsequential
from _decimal import *
__all__ = [
"Decimal",
"Context",
"DecimalTuple",
"DefaultContext",
"BasicContext",
"ExtendedContext",
"DecimalException",
"Clamped",
"InvalidOperation",
"DivisionByZero",
"Inexact",
"Rounded",
"Subnormal",
"Overflow",
"Underflow",
"FloatOperation",
"DivisionImpossible",
"InvalidContext",
"ConversionSyntax",
"DivisionUndefined",
"ROUND_DOWN",
"ROUND_HALF_UP",
"ROUND_HALF_EVEN",
"ROUND_CEILING",
"ROUND_FLOOR",
"ROUND_UP",
"ROUND_HALF_DOWN",
"ROUND_05UP",
"setcontext",
"getcontext",
"localcontext",
"MAX_PREC",
"MAX_EMAX",
"MIN_EMIN",
"MIN_ETINY",
"HAVE_THREADS",
]
if sys.version_info >= (3, 7):
__all__ = [
"Decimal",
"Context",
"DecimalTuple",
"DefaultContext",
"BasicContext",
"ExtendedContext",
"DecimalException",
"Clamped",
"InvalidOperation",
"DivisionByZero",
"Inexact",
"Rounded",
"Subnormal",
"Overflow",
"Underflow",
"FloatOperation",
"DivisionImpossible",
"InvalidContext",
"ConversionSyntax",
"DivisionUndefined",
"ROUND_DOWN",
"ROUND_HALF_UP",
"ROUND_HALF_EVEN",
"ROUND_CEILING",
"ROUND_FLOOR",
"ROUND_UP",
"ROUND_HALF_DOWN",
"ROUND_05UP",
"setcontext",
"getcontext",
"localcontext",
"MAX_PREC",
"MAX_EMAX",
"MIN_EMIN",
"MIN_ETINY",
"HAVE_THREADS",
"HAVE_CONTEXTVAR",
]
else:
__all__ = [
"Decimal",
"Context",
"DecimalTuple",
"DefaultContext",
"BasicContext",
"ExtendedContext",
"DecimalException",
"Clamped",
"InvalidOperation",
"DivisionByZero",
"Inexact",
"Rounded",
"Subnormal",
"Overflow",
"Underflow",
"FloatOperation",
"DivisionImpossible",
"InvalidContext",
"ConversionSyntax",
"DivisionUndefined",
"ROUND_DOWN",
"ROUND_HALF_UP",
"ROUND_HALF_EVEN",
"ROUND_CEILING",
"ROUND_FLOOR",
"ROUND_UP",
"ROUND_HALF_DOWN",
"ROUND_05UP",
"setcontext",
"getcontext",
"localcontext",
"MAX_PREC",
"MAX_EMAX",
"MIN_EMIN",
"MIN_ETINY",
"HAVE_THREADS",
]
__all__ += ["HAVE_CONTEXTVAR"]

View File

@@ -3,47 +3,28 @@ from collections.abc import Callable, Generator, Iterable, Sequence
from typing import IO, Any, Generic, NewType, NoReturn, Pattern, Protocol, TypeVar, overload
from typing_extensions import Literal, TypeAlias
__all__ = [
"ArgumentParser",
"ArgumentError",
"ArgumentTypeError",
"FileType",
"HelpFormatter",
"ArgumentDefaultsHelpFormatter",
"RawDescriptionHelpFormatter",
"RawTextHelpFormatter",
"MetavarTypeHelpFormatter",
"Namespace",
"Action",
"ONE_OR_MORE",
"OPTIONAL",
"PARSER",
"REMAINDER",
"SUPPRESS",
"ZERO_OR_MORE",
]
if sys.version_info >= (3, 9):
__all__ = [
"ArgumentParser",
"ArgumentError",
"ArgumentTypeError",
"BooleanOptionalAction",
"FileType",
"HelpFormatter",
"ArgumentDefaultsHelpFormatter",
"RawDescriptionHelpFormatter",
"RawTextHelpFormatter",
"MetavarTypeHelpFormatter",
"Namespace",
"Action",
"ONE_OR_MORE",
"OPTIONAL",
"PARSER",
"REMAINDER",
"SUPPRESS",
"ZERO_OR_MORE",
]
else:
__all__ = [
"ArgumentParser",
"ArgumentError",
"ArgumentTypeError",
"FileType",
"HelpFormatter",
"ArgumentDefaultsHelpFormatter",
"RawDescriptionHelpFormatter",
"RawTextHelpFormatter",
"MetavarTypeHelpFormatter",
"Namespace",
"Action",
"ONE_OR_MORE",
"OPTIONAL",
"PARSER",
"REMAINDER",
"SUPPRESS",
"ZERO_OR_MORE",
]
__all__ += ["BooleanOptionalAction"]
_T = TypeVar("_T")
_ActionT = TypeVar("_ActionT", bound=Action)

View File

@@ -2,50 +2,29 @@ import sys
from _typeshed import ReadableBuffer
from typing import IO
__all__ = [
"encode",
"decode",
"encodebytes",
"decodebytes",
"b64encode",
"b64decode",
"b32encode",
"b32decode",
"b16encode",
"b16decode",
"b85encode",
"b85decode",
"a85encode",
"a85decode",
"standard_b64encode",
"standard_b64decode",
"urlsafe_b64encode",
"urlsafe_b64decode",
]
if sys.version_info >= (3, 10):
__all__ = [
"encode",
"decode",
"encodebytes",
"decodebytes",
"b64encode",
"b64decode",
"b32encode",
"b32decode",
"b32hexencode",
"b32hexdecode",
"b16encode",
"b16decode",
"b85encode",
"b85decode",
"a85encode",
"a85decode",
"standard_b64encode",
"standard_b64decode",
"urlsafe_b64encode",
"urlsafe_b64decode",
]
else:
__all__ = [
"encode",
"decode",
"encodebytes",
"decodebytes",
"b64encode",
"b64decode",
"b32encode",
"b32decode",
"b16encode",
"b16decode",
"b85encode",
"b85decode",
"a85encode",
"a85decode",
"standard_b64encode",
"standard_b64decode",
"urlsafe_b64encode",
"urlsafe_b64decode",
]
__all__ += ["b32hexencode", "b32hexdecode"]
def b64encode(s: ReadableBuffer, altchars: ReadableBuffer | None = ...) -> bytes: ...
def b64decode(s: str | ReadableBuffer, altchars: ReadableBuffer | None = ..., validate: bool = ...) -> bytes: ...

View File

@@ -4,67 +4,35 @@ from collections.abc import Iterable, Sequence
from time import struct_time
from typing_extensions import Literal, TypeAlias
__all__ = [
"IllegalMonthError",
"IllegalWeekdayError",
"setfirstweekday",
"firstweekday",
"isleap",
"leapdays",
"weekday",
"monthrange",
"monthcalendar",
"prmonth",
"month",
"prcal",
"calendar",
"timegm",
"month_name",
"month_abbr",
"day_name",
"day_abbr",
"Calendar",
"TextCalendar",
"HTMLCalendar",
"LocaleTextCalendar",
"LocaleHTMLCalendar",
"weekheader",
]
if sys.version_info >= (3, 10):
__all__ = [
"IllegalMonthError",
"IllegalWeekdayError",
"setfirstweekday",
"firstweekday",
"isleap",
"leapdays",
"weekday",
"monthrange",
"monthcalendar",
"prmonth",
"month",
"prcal",
"calendar",
"timegm",
"month_name",
"month_abbr",
"day_name",
"day_abbr",
"Calendar",
"TextCalendar",
"HTMLCalendar",
"LocaleTextCalendar",
"LocaleHTMLCalendar",
"weekheader",
"FRIDAY",
"MONDAY",
"SATURDAY",
"SUNDAY",
"THURSDAY",
"TUESDAY",
"WEDNESDAY",
]
else:
__all__ = [
"IllegalMonthError",
"IllegalWeekdayError",
"setfirstweekday",
"firstweekday",
"isleap",
"leapdays",
"weekday",
"monthrange",
"monthcalendar",
"prmonth",
"month",
"prcal",
"calendar",
"timegm",
"month_name",
"month_abbr",
"day_name",
"day_abbr",
"Calendar",
"TextCalendar",
"HTMLCalendar",
"LocaleTextCalendar",
"LocaleHTMLCalendar",
"weekheader",
]
__all__ += ["FRIDAY", "MONDAY", "SATURDAY", "SUNDAY", "THURSDAY", "TUESDAY", "WEDNESDAY"]
_LocaleType: TypeAlias = tuple[str | None, str | None]

View File

@@ -5,39 +5,23 @@ from collections.abc import Iterable, Iterator, Mapping
from types import TracebackType
from typing import IO, Any, Protocol
if sys.version_info >= (3, 8):
__all__ = [
"MiniFieldStorage",
"FieldStorage",
"parse",
"parse_multipart",
"parse_header",
"test",
"print_exception",
"print_environ",
"print_form",
"print_directory",
"print_arguments",
"print_environ_usage",
]
else:
__all__ = [
"MiniFieldStorage",
"FieldStorage",
"parse",
"parse_qs",
"parse_qsl",
"parse_multipart",
"parse_header",
"test",
"print_exception",
"print_environ",
"print_form",
"print_directory",
"print_arguments",
"print_environ_usage",
"escape",
]
__all__ = [
"MiniFieldStorage",
"FieldStorage",
"parse",
"parse_multipart",
"parse_header",
"test",
"print_exception",
"print_environ",
"print_form",
"print_directory",
"print_arguments",
"print_environ_usage",
]
if sys.version_info < (3, 8):
__all__ += ["parse_qs", "parse_qsl", "escape"]
def parse(
fp: IO[Any] | None = ...,

View File

@@ -5,65 +5,25 @@ from types import TracebackType
from typing import IO, Any, ContextManager, Generic, Protocol, TypeVar, overload # noqa: Y027
from typing_extensions import ParamSpec, TypeAlias
__all__ = [
"contextmanager",
"closing",
"AbstractContextManager",
"ContextDecorator",
"ExitStack",
"redirect_stdout",
"redirect_stderr",
"suppress",
]
if sys.version_info >= (3, 7):
__all__ += ["AbstractAsyncContextManager", "AsyncExitStack", "asynccontextmanager", "nullcontext"]
if sys.version_info >= (3, 10):
__all__ += ["aclosing"]
if sys.version_info >= (3, 11):
__all__ = [
"asynccontextmanager",
"contextmanager",
"closing",
"nullcontext",
"AbstractContextManager",
"AbstractAsyncContextManager",
"AsyncExitStack",
"ContextDecorator",
"ExitStack",
"redirect_stdout",
"redirect_stderr",
"suppress",
"aclosing",
"chdir",
]
elif sys.version_info >= (3, 10):
__all__ = [
"asynccontextmanager",
"contextmanager",
"closing",
"nullcontext",
"AbstractContextManager",
"AbstractAsyncContextManager",
"AsyncExitStack",
"ContextDecorator",
"ExitStack",
"redirect_stdout",
"redirect_stderr",
"suppress",
"aclosing",
]
elif sys.version_info >= (3, 7):
__all__ = [
"asynccontextmanager",
"contextmanager",
"closing",
"nullcontext",
"AbstractContextManager",
"AbstractAsyncContextManager",
"AsyncExitStack",
"ContextDecorator",
"ExitStack",
"redirect_stdout",
"redirect_stderr",
"suppress",
]
else:
__all__ = [
"contextmanager",
"closing",
"AbstractContextManager",
"ContextDecorator",
"ExitStack",
"redirect_stdout",
"redirect_stderr",
"suppress",
]
__all__ += ["chdir"]
AbstractContextManager = ContextManager
if sys.version_info >= (3, 7):

View File

@@ -12,37 +12,23 @@ if sys.version_info >= (3, 9):
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
__all__ = [
"dataclass",
"field",
"Field",
"FrozenInstanceError",
"InitVar",
"MISSING",
"fields",
"asdict",
"astuple",
"make_dataclass",
"replace",
"is_dataclass",
]
if sys.version_info >= (3, 10):
__all__ = [
"dataclass",
"field",
"Field",
"FrozenInstanceError",
"InitVar",
"KW_ONLY",
"MISSING",
"fields",
"asdict",
"astuple",
"make_dataclass",
"replace",
"is_dataclass",
]
else:
__all__ = [
"dataclass",
"field",
"Field",
"FrozenInstanceError",
"InitVar",
"MISSING",
"fields",
"asdict",
"astuple",
"make_dataclass",
"replace",
"is_dataclass",
]
__all__ += ["KW_ONLY"]
# define _MISSING_TYPE as an enum within the type stubs,
# even though that is not really its type at runtime

View File

@@ -7,38 +7,31 @@ from collections.abc import Iterable, Iterator, Mapping
from typing import Any, Generic, TypeVar, overload
from typing_extensions import Literal, TypeAlias
__all__ = ["EnumMeta", "Enum", "IntEnum", "Flag", "IntFlag", "auto", "unique"]
if sys.version_info >= (3, 11):
__all__ = [
__all__ += [
"CONFORM",
"CONTINUOUS",
"EJECT",
"EnumCheck",
"EnumType",
"EnumMeta",
"Enum",
"IntEnum",
"StrEnum",
"Flag",
"IntFlag",
"FlagBoundary",
"KEEP",
"NAMED_FLAGS",
"ReprEnum",
"auto",
"unique",
"property",
"verify",
"STRICT",
"StrEnum",
"UNIQUE",
"global_enum",
"global_enum_repr",
"global_flag_repr",
"global_str",
"member",
"nonmember",
"FlagBoundary",
"STRICT",
"CONFORM",
"EJECT",
"KEEP",
"global_flag_repr",
"global_enum_repr",
"global_str",
"global_enum",
"EnumCheck",
"CONTINUOUS",
"NAMED_FLAGS",
"UNIQUE",
"property",
"verify",
]
else:
__all__ = ["EnumMeta", "Enum", "IntEnum", "Flag", "IntFlag", "auto", "unique"]
_EnumMemberT = TypeVar("_EnumMemberT")
_EnumerationT = TypeVar("_EnumerationT", bound=type[Enum])

View File

@@ -8,52 +8,25 @@ from typing_extensions import Literal, TypeAlias, final
if sys.version_info >= (3, 9):
from types import GenericAlias
__all__ = [
"update_wrapper",
"wraps",
"WRAPPER_ASSIGNMENTS",
"WRAPPER_UPDATES",
"total_ordering",
"cache",
"cmp_to_key",
"lru_cache",
"reduce",
"partial",
"partialmethod",
"singledispatch",
"singledispatchmethod",
"cached_property",
]
elif sys.version_info >= (3, 8):
__all__ = [
"update_wrapper",
"wraps",
"WRAPPER_ASSIGNMENTS",
"WRAPPER_UPDATES",
"total_ordering",
"cmp_to_key",
"lru_cache",
"reduce",
"partial",
"partialmethod",
"singledispatch",
"singledispatchmethod",
"cached_property",
]
else:
__all__ = [
"update_wrapper",
"wraps",
"WRAPPER_ASSIGNMENTS",
"WRAPPER_UPDATES",
"total_ordering",
"cmp_to_key",
"lru_cache",
"reduce",
"partial",
"partialmethod",
"singledispatch",
]
__all__ = [
"update_wrapper",
"wraps",
"WRAPPER_ASSIGNMENTS",
"WRAPPER_UPDATES",
"total_ordering",
"cmp_to_key",
"lru_cache",
"reduce",
"partial",
"partialmethod",
"singledispatch",
]
if sys.version_info >= (3, 8):
__all__ += ["cached_property", "singledispatchmethod"]
if sys.version_info >= (3, 9):
__all__ += ["cache"]
_AnyCallable: TypeAlias = Callable[..., Any]

View File

@@ -5,69 +5,26 @@ from collections.abc import Callable, Container, Iterable, Sequence
from typing import Any, Protocol, TypeVar, overload
from typing_extensions import Final, Literal
if sys.version_info >= (3, 11):
__all__ = [
"NullTranslations",
"GNUTranslations",
"Catalog",
"bindtextdomain",
"find",
"translation",
"install",
"textdomain",
"dgettext",
"dngettext",
"gettext",
"ngettext",
"pgettext",
"dpgettext",
"npgettext",
"dnpgettext",
]
elif sys.version_info >= (3, 8):
__all__ = [
"NullTranslations",
"GNUTranslations",
"Catalog",
"find",
"translation",
"install",
"textdomain",
"bindtextdomain",
"bind_textdomain_codeset",
"dgettext",
"dngettext",
"gettext",
"lgettext",
"ldgettext",
"ldngettext",
"lngettext",
"ngettext",
"pgettext",
"dpgettext",
"npgettext",
"dnpgettext",
]
else:
__all__ = [
"NullTranslations",
"GNUTranslations",
"Catalog",
"find",
"translation",
"install",
"textdomain",
"bindtextdomain",
"bind_textdomain_codeset",
"dgettext",
"dngettext",
"gettext",
"lgettext",
"ldgettext",
"ldngettext",
"lngettext",
"ngettext",
]
__all__ = [
"NullTranslations",
"GNUTranslations",
"Catalog",
"find",
"translation",
"install",
"textdomain",
"bindtextdomain",
"dgettext",
"dngettext",
"gettext",
"ngettext",
]
if sys.version_info < (3, 11):
__all__ += ["bind_textdomain_codeset", "ldgettext", "ldngettext", "lgettext", "lngettext"]
if sys.version_info >= (3, 8):
__all__ += ["dnpgettext", "dpgettext", "npgettext", "pgettext"]
class _TranslationsReader(Protocol):
def read(self) -> bytes: ...

View File

@@ -9,34 +9,21 @@ from os import PathLike
from pathlib import Path
from typing import Any, ClassVar, NamedTuple, Pattern, overload
__all__ = [
"Distribution",
"DistributionFinder",
"PackageNotFoundError",
"distribution",
"distributions",
"entry_points",
"files",
"metadata",
"requires",
"version",
]
if sys.version_info >= (3, 10):
__all__ = [
"Distribution",
"DistributionFinder",
"PackageMetadata",
"PackageNotFoundError",
"distribution",
"distributions",
"entry_points",
"files",
"metadata",
"packages_distributions",
"requires",
"version",
]
else:
__all__ = [
"Distribution",
"DistributionFinder",
"PackageNotFoundError",
"distribution",
"distributions",
"entry_points",
"files",
"metadata",
"requires",
"version",
]
__all__ += ["PackageMetadata", "packages_distributions"]
if sys.version_info >= (3, 10):
from importlib.metadata._meta import PackageMetadata as PackageMetadata

View File

@@ -7,37 +7,13 @@ from types import ModuleType
from typing import Any, BinaryIO, TextIO
from typing_extensions import TypeAlias
__all__ = ["Package", "Resource", "contents", "is_resource", "open_binary", "open_text", "path", "read_binary", "read_text"]
if sys.version_info >= (3, 9):
__all__ += ["as_file", "files"]
if sys.version_info >= (3, 10):
__all__ = [
"Package",
"Resource",
"ResourceReader",
"as_file",
"contents",
"files",
"is_resource",
"open_binary",
"open_text",
"path",
"read_binary",
"read_text",
]
elif sys.version_info >= (3, 9):
__all__ = [
"Package",
"Resource",
"as_file",
"contents",
"files",
"is_resource",
"open_binary",
"open_text",
"path",
"read_binary",
"read_text",
]
else:
__all__ = ["Package", "Resource", "contents", "is_resource", "open_binary", "open_text", "path", "read_binary", "read_text"]
__all__ += ["ResourceReader"]
Package: TypeAlias = str | ModuleType

View File

@@ -8,49 +8,29 @@ from types import TracebackType
from typing import IO, Any, BinaryIO, TextIO
from typing_extensions import Literal
__all__ = [
"BlockingIOError",
"open",
"IOBase",
"RawIOBase",
"FileIO",
"BytesIO",
"StringIO",
"BufferedIOBase",
"BufferedReader",
"BufferedWriter",
"BufferedRWPair",
"BufferedRandom",
"TextIOBase",
"TextIOWrapper",
"UnsupportedOperation",
"SEEK_SET",
"SEEK_CUR",
"SEEK_END",
]
if sys.version_info >= (3, 8):
__all__ = [
"BlockingIOError",
"open",
"open_code",
"IOBase",
"RawIOBase",
"FileIO",
"BytesIO",
"StringIO",
"BufferedIOBase",
"BufferedReader",
"BufferedWriter",
"BufferedRWPair",
"BufferedRandom",
"TextIOBase",
"TextIOWrapper",
"UnsupportedOperation",
"SEEK_SET",
"SEEK_CUR",
"SEEK_END",
]
else:
__all__ = [
"BlockingIOError",
"open",
"IOBase",
"RawIOBase",
"FileIO",
"BytesIO",
"StringIO",
"BufferedIOBase",
"BufferedReader",
"BufferedWriter",
"BufferedRWPair",
"BufferedRandom",
"TextIOBase",
"TextIOWrapper",
"UnsupportedOperation",
"SEEK_SET",
"SEEK_CUR",
"SEEK_END",
]
__all__ += ["open_code"]
DEFAULT_BUFFER_SIZE: Literal[8192]

View File

@@ -3,149 +3,79 @@ from collections.abc import Callable, Iterable, Iterator
from lib2to3.pgen2.token import *
from typing_extensions import TypeAlias
__all__ = [
"AMPER",
"AMPEREQUAL",
"ASYNC",
"AT",
"ATEQUAL",
"AWAIT",
"BACKQUOTE",
"CIRCUMFLEX",
"CIRCUMFLEXEQUAL",
"COLON",
"COMMA",
"COMMENT",
"DEDENT",
"DOT",
"DOUBLESLASH",
"DOUBLESLASHEQUAL",
"DOUBLESTAR",
"DOUBLESTAREQUAL",
"ENDMARKER",
"EQEQUAL",
"EQUAL",
"ERRORTOKEN",
"GREATER",
"GREATEREQUAL",
"INDENT",
"ISEOF",
"ISNONTERMINAL",
"ISTERMINAL",
"LBRACE",
"LEFTSHIFT",
"LEFTSHIFTEQUAL",
"LESS",
"LESSEQUAL",
"LPAR",
"LSQB",
"MINEQUAL",
"MINUS",
"NAME",
"NEWLINE",
"NL",
"NOTEQUAL",
"NT_OFFSET",
"NUMBER",
"N_TOKENS",
"OP",
"PERCENT",
"PERCENTEQUAL",
"PLUS",
"PLUSEQUAL",
"RARROW",
"RBRACE",
"RIGHTSHIFT",
"RIGHTSHIFTEQUAL",
"RPAR",
"RSQB",
"SEMI",
"SLASH",
"SLASHEQUAL",
"STAR",
"STAREQUAL",
"STRING",
"TILDE",
"VBAR",
"VBAREQUAL",
"tok_name",
"tokenize",
"generate_tokens",
"untokenize",
]
if sys.version_info >= (3, 8):
__all__ = [
"AMPER",
"AMPEREQUAL",
"ASYNC",
"AT",
"ATEQUAL",
"AWAIT",
"BACKQUOTE",
"CIRCUMFLEX",
"CIRCUMFLEXEQUAL",
"COLON",
"COLONEQUAL",
"COMMA",
"COMMENT",
"DEDENT",
"DOT",
"DOUBLESLASH",
"DOUBLESLASHEQUAL",
"DOUBLESTAR",
"DOUBLESTAREQUAL",
"ENDMARKER",
"EQEQUAL",
"EQUAL",
"ERRORTOKEN",
"GREATER",
"GREATEREQUAL",
"INDENT",
"ISEOF",
"ISNONTERMINAL",
"ISTERMINAL",
"LBRACE",
"LEFTSHIFT",
"LEFTSHIFTEQUAL",
"LESS",
"LESSEQUAL",
"LPAR",
"LSQB",
"MINEQUAL",
"MINUS",
"NAME",
"NEWLINE",
"NL",
"NOTEQUAL",
"NT_OFFSET",
"NUMBER",
"N_TOKENS",
"OP",
"PERCENT",
"PERCENTEQUAL",
"PLUS",
"PLUSEQUAL",
"RARROW",
"RBRACE",
"RIGHTSHIFT",
"RIGHTSHIFTEQUAL",
"RPAR",
"RSQB",
"SEMI",
"SLASH",
"SLASHEQUAL",
"STAR",
"STAREQUAL",
"STRING",
"TILDE",
"VBAR",
"VBAREQUAL",
"tok_name",
"tokenize",
"generate_tokens",
"untokenize",
]
else:
__all__ = [
"AMPER",
"AMPEREQUAL",
"ASYNC",
"AT",
"ATEQUAL",
"AWAIT",
"BACKQUOTE",
"CIRCUMFLEX",
"CIRCUMFLEXEQUAL",
"COLON",
"COMMA",
"COMMENT",
"DEDENT",
"DOT",
"DOUBLESLASH",
"DOUBLESLASHEQUAL",
"DOUBLESTAR",
"DOUBLESTAREQUAL",
"ENDMARKER",
"EQEQUAL",
"EQUAL",
"ERRORTOKEN",
"GREATER",
"GREATEREQUAL",
"INDENT",
"ISEOF",
"ISNONTERMINAL",
"ISTERMINAL",
"LBRACE",
"LEFTSHIFT",
"LEFTSHIFTEQUAL",
"LESS",
"LESSEQUAL",
"LPAR",
"LSQB",
"MINEQUAL",
"MINUS",
"NAME",
"NEWLINE",
"NL",
"NOTEQUAL",
"NT_OFFSET",
"NUMBER",
"N_TOKENS",
"OP",
"PERCENT",
"PERCENTEQUAL",
"PLUS",
"PLUSEQUAL",
"RARROW",
"RBRACE",
"RIGHTSHIFT",
"RIGHTSHIFTEQUAL",
"RPAR",
"RSQB",
"SEMI",
"SLASH",
"SLASHEQUAL",
"STAR",
"STAREQUAL",
"STRING",
"TILDE",
"VBAR",
"VBAREQUAL",
"tok_name",
"tokenize",
"generate_tokens",
"untokenize",
]
__all__ += ["COLONEQUAL"]
_Coord: TypeAlias = tuple[int, int]
_TokenEater: TypeAlias = Callable[[int, str, _Coord, _Coord, str], None]

View File

@@ -12,97 +12,53 @@ from typing_extensions import Literal, TypeAlias
if sys.version_info >= (3, 11):
from types import GenericAlias
__all__ = [
"BASIC_FORMAT",
"BufferingFormatter",
"CRITICAL",
"DEBUG",
"ERROR",
"FATAL",
"FileHandler",
"Filter",
"Formatter",
"Handler",
"INFO",
"LogRecord",
"Logger",
"LoggerAdapter",
"NOTSET",
"NullHandler",
"StreamHandler",
"WARN",
"WARNING",
"addLevelName",
"basicConfig",
"captureWarnings",
"critical",
"debug",
"disable",
"error",
"exception",
"fatal",
"getLevelName",
"getLogger",
"getLoggerClass",
"info",
"log",
"makeLogRecord",
"setLoggerClass",
"shutdown",
"warn",
"warning",
"getLogRecordFactory",
"setLogRecordFactory",
"lastResort",
"raiseExceptions",
]
if sys.version_info >= (3, 11):
__all__ = [
"BASIC_FORMAT",
"BufferingFormatter",
"CRITICAL",
"DEBUG",
"ERROR",
"FATAL",
"FileHandler",
"Filter",
"Formatter",
"Handler",
"INFO",
"LogRecord",
"Logger",
"LoggerAdapter",
"NOTSET",
"NullHandler",
"StreamHandler",
"WARN",
"WARNING",
"addLevelName",
"basicConfig",
"captureWarnings",
"critical",
"debug",
"disable",
"error",
"exception",
"fatal",
"getLevelName",
"getLogger",
"getLoggerClass",
"info",
"log",
"makeLogRecord",
"setLoggerClass",
"shutdown",
"warn",
"warning",
"getLogRecordFactory",
"setLogRecordFactory",
"lastResort",
"raiseExceptions",
"getLevelNamesMapping",
]
else:
__all__ = [
"BASIC_FORMAT",
"BufferingFormatter",
"CRITICAL",
"DEBUG",
"ERROR",
"FATAL",
"FileHandler",
"Filter",
"Formatter",
"Handler",
"INFO",
"LogRecord",
"Logger",
"LoggerAdapter",
"NOTSET",
"NullHandler",
"StreamHandler",
"WARN",
"WARNING",
"addLevelName",
"basicConfig",
"captureWarnings",
"critical",
"debug",
"disable",
"error",
"exception",
"fatal",
"getLevelName",
"getLogger",
"getLoggerClass",
"info",
"log",
"makeLogRecord",
"setLoggerClass",
"shutdown",
"warn",
"warning",
"getLogRecordFactory",
"setLogRecordFactory",
"lastResort",
"raiseExceptions",
]
__all__ += ["getLevelNamesMapping"]
_SysExcInfoType: TypeAlias = Union[tuple[type[BaseException], BaseException, TracebackType | None], tuple[None, None, None]]
_ExcInfoType: TypeAlias = None | bool | _SysExcInfoType | BaseException