diff --git a/stdlib/ensurepip/__init__.pyi b/stdlib/ensurepip/__init__.pyi index 749fedc04..e2686b8d5 100644 --- a/stdlib/ensurepip/__init__.pyi +++ b/stdlib/ensurepip/__init__.pyi @@ -1,3 +1,5 @@ +__all__ = ["version", "bootstrap"] + def version() -> str: ... def bootstrap( *, diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 7e0918c32..b99e28850 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -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]) diff --git a/stdlib/fileinput.pyi b/stdlib/fileinput.pyi index a1c40508d..787f75b89 100644 --- a/stdlib/fileinput.pyi +++ b/stdlib/fileinput.pyi @@ -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 diff --git a/stdlib/fnmatch.pyi b/stdlib/fnmatch.pyi index 1cbcf0072..8351fce59 100644 --- a/stdlib/fnmatch.pyi +++ b/stdlib/fnmatch.pyi @@ -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]: ... diff --git a/stdlib/fractions.pyi b/stdlib/fractions.pyi index b33526c4f..117990fb5 100644 --- a/stdlib/fractions.pyi +++ b/stdlib/fractions.pyi @@ -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 diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 0edb258cb..042d7409c 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -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") diff --git a/stdlib/genericpath.pyi b/stdlib/genericpath.pyi index f9518750d..3abedda26 100644 --- a/stdlib/genericpath.pyi +++ b/stdlib/genericpath.pyi @@ -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. diff --git a/stdlib/getopt.pyi b/stdlib/getopt.pyi index 6ae226f52..42ddb1cb7 100644 --- a/stdlib/getopt.pyi +++ b/stdlib/getopt.pyi @@ -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]]: ... diff --git a/stdlib/getpass.pyi b/stdlib/getpass.pyi index 27f4c6a9b..153db2f4c 100644 --- a/stdlib/getpass.pyi +++ b/stdlib/getpass.pyi @@ -1,5 +1,7 @@ from typing import TextIO +__all__ = ["getpass", "getuser", "GetPassWarning"] + def getpass(prompt: str = ..., stream: TextIO | None = ...) -> str: ... def getuser() -> str: ... diff --git a/stdlib/gettext.pyi b/stdlib/gettext.pyi index e7893e5fd..1f3ef67ab 100644 --- a/stdlib/gettext.pyi +++ b/stdlib/gettext.pyi @@ -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: ... diff --git a/stdlib/glob.pyi b/stdlib/glob.pyi index 478d8ba63..ced0ceceb 100644 --- a/stdlib/glob.pyi +++ b/stdlib/glob.pyi @@ -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]: ... diff --git a/stdlib/graphlib.pyi b/stdlib/graphlib.pyi index 96d64cbce..0ab78e94e 100644 --- a/stdlib/graphlib.pyi +++ b/stdlib/graphlib.pyi @@ -1,6 +1,8 @@ from _typeshed import SupportsItems from typing import Generic, Iterable, TypeVar +__all__ = ["TopologicalSorter", "CycleError"] + _T = TypeVar("_T") class TopologicalSorter(Generic[_T]): diff --git a/stdlib/gzip.pyi b/stdlib/gzip.pyi index 070ceac48..7347949ae 100644 --- a/stdlib/gzip.pyi +++ b/stdlib/gzip.pyi @@ -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"]