From d2ddda00cf05a9b285270349acddbe4218352561 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Fri, 25 Feb 2022 13:10:00 +0000 Subject: [PATCH] Fix various `__all__`-related typos and omissions (#7378) --- stdlib/asyncio/windows_utils.pyi | 3 +++ stdlib/ftplib.pyi | 2 +- stdlib/locale.pyi | 3 ++- stdlib/multiprocessing/__init__.pyi | 1 + stdlib/multiprocessing/context.pyi | 5 +++++ stdlib/re.pyi | 4 ++-- stdlib/types.pyi | 2 -- tests/stubtest_allowlists/win32-py36.txt | 1 - 8 files changed, 14 insertions(+), 7 deletions(-) diff --git a/stdlib/asyncio/windows_utils.pyi b/stdlib/asyncio/windows_utils.pyi index bdc0212ca..78eff6956 100644 --- a/stdlib/asyncio/windows_utils.pyi +++ b/stdlib/asyncio/windows_utils.pyi @@ -10,6 +10,9 @@ if sys.platform == "win32": __all__ = ("pipe", "Popen", "PIPE", "PipeHandle") else: __all__ = ["socketpair", "pipe", "Popen", "PIPE", "PipeHandle"] + import socket + + socketpair = socket.socketpair class _WarnFunction(Protocol): def __call__( diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index d76251417..4a5dad0dd 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -6,7 +6,7 @@ from types import TracebackType from typing import Any, Callable, Iterable, Iterator, TextIO from typing_extensions import Literal -__all__ = ["FTP", "error_reply", "error_temp", "error_perm", "error_proto", "all_errors"] +__all__ = ["FTP", "error_reply", "error_temp", "error_perm", "error_proto", "all_errors", "FTP_TLS"] MSG_OOB: Literal[1] FTP_PORT: Literal[21] diff --git a/stdlib/locale.pyi b/stdlib/locale.pyi index 60945b886..899bf0000 100644 --- a/stdlib/locale.pyi +++ b/stdlib/locale.pyi @@ -20,7 +20,8 @@ __all__ = [ "normalize", "LC_CTYPE", "LC_COLLATE", - "LC_MESSAGES" "LC_TIME", + "LC_MESSAGES", + "LC_TIME", "LC_MONETARY", "LC_NUMERIC", "LC_ALL", diff --git a/stdlib/multiprocessing/__init__.pyi b/stdlib/multiprocessing/__init__.pyi index 604a2ad63..3f489ca43 100644 --- a/stdlib/multiprocessing/__init__.pyi +++ b/stdlib/multiprocessing/__init__.pyi @@ -62,6 +62,7 @@ if sys.version_info >= (3, 8): "get_context", "get_logger", "get_start_method", + "parent_process", "log_to_stderr", "reducer", "set_executable", diff --git a/stdlib/multiprocessing/context.pyi b/stdlib/multiprocessing/context.pyi index e170b893c..28ec0b140 100644 --- a/stdlib/multiprocessing/context.pyi +++ b/stdlib/multiprocessing/context.pyi @@ -11,6 +11,11 @@ from multiprocessing.sharedctypes import SynchronizedArray, SynchronizedBase from typing import Any, TypeVar, Union, overload from typing_extensions import Literal +if sys.version_info >= (3, 8): + __all__ = () +else: + __all__: list[str] = [] + _LockLike = Union[synchronize.Lock, synchronize.RLock] _CT = TypeVar("_CT", bound=_CData) diff --git a/stdlib/re.pyi b/stdlib/re.pyi index fe440a13c..b9c41e1ca 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -126,7 +126,7 @@ class RegexFlag(enum.IntFlag): T = sre_compile.SRE_FLAG_TEMPLATE TEMPLATE = T if sys.version_info >= (3, 11): - NO_FLAG: int + NOFLAG: int A = RegexFlag.A ASCII = RegexFlag.ASCII @@ -146,7 +146,7 @@ UNICODE = RegexFlag.UNICODE T = RegexFlag.T TEMPLATE = RegexFlag.TEMPLATE if sys.version_info >= (3, 11): - NO_FLAG = RegexFlag.NO_FLAG + NOFLAG = RegexFlag.NOFLAG _FlagsType = Union[int, RegexFlag] if sys.version_info < (3, 7): diff --git a/stdlib/types.pyi b/stdlib/types.pyi index 6a899fb57..90729323d 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -155,14 +155,12 @@ else: "AsyncGeneratorType", "MethodType", "BuiltinFunctionType", - "ClassMethodDescriptorType", "ModuleType", "TracebackType", "FrameType", "GetSetDescriptorType", "MemberDescriptorType", "new_class", - "resolve_bases", "prepare_class", "DynamicClassAttribute", "coroutine", diff --git a/tests/stubtest_allowlists/win32-py36.txt b/tests/stubtest_allowlists/win32-py36.txt index 768616bdb..d6fd83f34 100644 --- a/tests/stubtest_allowlists/win32-py36.txt +++ b/tests/stubtest_allowlists/win32-py36.txt @@ -16,5 +16,4 @@ hashlib.scrypt os.startfile # Exists at runtime, but missing from stubs -asyncio.windows_utils.socketpair venv.EnvBuilder.include_binary