Add __all__ for modules beginning with 'e', 'f' and 'g' (#7325)

This commit is contained in:
Alex Waygood
2022-02-20 23:08:14 +00:00
committed by GitHub
parent 3ead05f277
commit 2fe519c3a7
13 changed files with 192 additions and 1 deletions

View File

@@ -1,3 +1,5 @@
__all__ = ["version", "bootstrap"]
def version() -> str: ...
def bootstrap(
*,

View File

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

View File

@@ -2,6 +2,21 @@ import sys
from _typeshed import Self, StrOrBytesPath
from typing import IO, Any, AnyStr, Callable, Generic, Iterable, Iterator
__all__ = [
"input",
"close",
"nextfile",
"filename",
"lineno",
"filelineno",
"fileno",
"isfirstline",
"isstdin",
"FileInput",
"hook_compressed",
"hook_encoded",
]
if sys.version_info >= (3, 9):
from types import GenericAlias

View File

@@ -1,5 +1,7 @@
from typing import AnyStr, Iterable
__all__ = ["filter", "fnmatch", "fnmatchcase", "translate"]
def fnmatch(name: AnyStr, pat: AnyStr) -> bool: ...
def fnmatchcase(name: AnyStr, pat: AnyStr) -> bool: ...
def filter(names: Iterable[AnyStr], pat: AnyStr) -> list[AnyStr]: ...

View File

@@ -7,7 +7,10 @@ from typing_extensions import Literal
_ComparableNum = Union[int, float, Decimal, Real]
if sys.version_info < (3, 9):
if sys.version_info >= (3, 9):
__all__ = ["Fraction"]
else:
__all__ = ["Fraction", "gcd"]
@overload
def gcd(a: int, b: int) -> int: ...
@overload

View File

@@ -7,6 +7,53 @@ from typing_extensions import Literal, 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",
]
_AnyCallable = Callable[..., Any]
_T = TypeVar("_T")

View File

@@ -3,6 +3,20 @@ from _typeshed import BytesPath, StrOrBytesPath, StrPath, SupportsRichComparison
from typing import Sequence, overload
from typing_extensions import Literal
__all__ = [
"commonprefix",
"exists",
"getatime",
"getctime",
"getmtime",
"getsize",
"isdir",
"isfile",
"samefile",
"sameopenfile",
"samestat",
]
# All overloads can return empty string. Ideally, Literal[""] would be a valid
# Iterable[T], so that list[T] | Literal[""] could be used as a return
# type. But because this only works when T is str, we need Sequence[T] instead.

View File

@@ -1,3 +1,5 @@
__all__ = ["GetoptError", "error", "getopt", "gnu_getopt"]
def getopt(args: list[str], shortopts: str, longopts: list[str] = ...) -> tuple[list[tuple[str, str]], list[str]]: ...
def gnu_getopt(args: list[str], shortopts: str, longopts: list[str] = ...) -> tuple[list[tuple[str, str]], list[str]]: ...

View File

@@ -1,5 +1,7 @@
from typing import TextIO
__all__ = ["getpass", "getuser", "GetPassWarning"]
def getpass(prompt: str = ..., stream: TextIO | None = ...) -> str: ...
def getuser() -> str: ...

View File

@@ -3,6 +3,70 @@ from _typeshed import StrPath
from typing import IO, Any, Container, Iterable, Sequence, TypeVar, overload
from typing_extensions import 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",
]
class NullTranslations:
def __init__(self, fp: IO[str] | None = ...) -> None: ...
def _parse(self, fp: IO[str]) -> None: ...

View File

@@ -2,6 +2,8 @@ import sys
from _typeshed import StrOrBytesPath
from typing import AnyStr, Iterator
__all__ = ["escape", "glob", "iglob"]
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...

View File

@@ -1,6 +1,8 @@
from _typeshed import SupportsItems
from typing import Generic, Iterable, TypeVar
__all__ = ["TopologicalSorter", "CycleError"]
_T = TypeVar("_T")
class TopologicalSorter(Generic[_T]):

View File

@@ -6,6 +6,11 @@ from io import FileIO
from typing import Any, Protocol, TextIO, overload
from typing_extensions import Literal
if sys.version_info >= (3, 8):
__all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"]
else:
__all__ = ["GzipFile", "open", "compress", "decompress"]
_ReadBinaryMode = Literal["r", "rb"]
_WriteBinaryMode = Literal["a", "ab", "w", "wb", "x", "xb"]
_OpenTextMode = Literal["rt", "at", "wt", "xt"]