Add __all__ to modules beginning with 'm' (#7330)

This commit is contained in:
Alex Waygood
2022-02-20 22:08:07 +00:00
committed by GitHub
parent 3e579b8b29
commit 07de01f29e
17 changed files with 193 additions and 33 deletions

View File

@@ -174,6 +174,7 @@ modulefinder: 2.7-
msilib: 2.7-
msvcrt: 2.7-
multiprocessing: 2.7-
multiprocessing.shared_memory: 3.8-
netrc: 2.7-
nis: 2.7-
nntplib: 2.7-

View File

@@ -9,6 +9,26 @@ from typing_extensions import Literal
if sys.version_info >= (3, 9):
from types import GenericAlias
__all__ = [
"Mailbox",
"Maildir",
"mbox",
"MH",
"Babyl",
"MMDF",
"Message",
"MaildirMessage",
"mboxMessage",
"MHMessage",
"BabylMessage",
"MMDFMessage",
"Error",
"NoSuchMailboxError",
"NotEmptyError",
"ExternalClashError",
"FormatError",
]
_T = TypeVar("_T")
_MessageT = TypeVar("_MessageT", bound=Message)
_MessageData = Union[email.message.Message, bytes, str, IO[str], IO[bytes]]

View File

@@ -2,6 +2,8 @@ from typing import Mapping, Sequence, Union
_Cap = dict[str, Union[str, int]]
__all__ = ["getcaps", "findmatch"]
def findmatch(
caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = ..., filename: str = ..., plist: Sequence[str] = ...
) -> tuple[str | None, _Cap | None]: ...

View File

@@ -2,6 +2,22 @@ import sys
from _typeshed import StrPath
from typing import IO, Sequence
__all__ = [
"knownfiles",
"inited",
"MimeTypes",
"guess_type",
"guess_all_extensions",
"guess_extension",
"add_type",
"init",
"read_mime_types",
"suffix_map",
"encodings_map",
"types_map",
"common_types",
]
if sys.version_info >= (3, 8):
def guess_type(url: StrPath, strict: bool = ...) -> tuple[str | None, str | None]: ...

View File

@@ -29,6 +29,86 @@ if sys.version_info >= (3, 8):
if sys.platform != "win32":
from multiprocessing.context import ForkContext, ForkServerContext
if sys.version_info >= (3, 8):
__all__ = [
"Array",
"AuthenticationError",
"Barrier",
"BoundedSemaphore",
"BufferTooShort",
"Condition",
"Event",
"JoinableQueue",
"Lock",
"Manager",
"Pipe",
"Pool",
"Process",
"ProcessError",
"Queue",
"RLock",
"RawArray",
"RawValue",
"Semaphore",
"SimpleQueue",
"TimeoutError",
"Value",
"active_children",
"allow_connection_pickling",
"cpu_count",
"current_process",
"freeze_support",
"get_all_start_methods",
"get_context",
"get_logger",
"get_start_method",
"log_to_stderr",
"reducer",
"set_executable",
"set_forkserver_preload",
"set_start_method",
]
else:
__all__ = [
"Array",
"AuthenticationError",
"Barrier",
"BoundedSemaphore",
"BufferTooShort",
"Condition",
"Event",
"JoinableQueue",
"Lock",
"Manager",
"Pipe",
"Pool",
"Process",
"ProcessError",
"Queue",
"RLock",
"RawArray",
"RawValue",
"Semaphore",
"SimpleQueue",
"TimeoutError",
"Value",
"active_children",
"allow_connection_pickling",
"cpu_count",
"current_process",
"freeze_support",
"get_all_start_methods",
"get_context",
"get_logger",
"get_start_method",
"log_to_stderr",
"parent_process",
"reducer",
"set_executable",
"set_forkserver_preload",
"set_start_method",
]
# The following type aliases can be used to annotate the return values of
# the corresponding functions. They are not defined at runtime.
#

View File

@@ -3,19 +3,15 @@ import sys
import types
from _typeshed import Self
from typing import Any, Iterable, Union
from typing_extensions import SupportsIndex
if sys.version_info >= (3, 8):
from typing import SupportsIndex
__all__ = ["Client", "Listener", "Pipe", "wait"]
# https://docs.python.org/3/library/multiprocessing.html#address-formats
_Address = Union[str, tuple[str, int]]
class _ConnectionBase:
if sys.version_info >= (3, 8):
def __init__(self, handle: SupportsIndex, readable: bool = ..., writable: bool = ...) -> None: ...
else:
def __init__(self, handle: int, readable: bool = ..., writable: bool = ...) -> None: ...
def __init__(self, handle: SupportsIndex, readable: bool = ..., writable: bool = ...) -> None: ...
@property
def closed(self) -> bool: ... # undocumented
@property

View File

@@ -4,6 +4,25 @@ import weakref
from queue import Queue as Queue
from typing import Any, Callable, Iterable, Mapping, Sequence
__all__ = [
"Process",
"current_process",
"active_children",
"freeze_support",
"Lock",
"RLock",
"Semaphore",
"BoundedSemaphore",
"Condition",
"Event",
"Barrier",
"Queue",
"Manager",
"Pipe",
"Pool",
"JoinableQueue",
]
JoinableQueue = Queue
Barrier = threading.Barrier
BoundedSemaphore = threading.BoundedSemaphore

View File

@@ -3,6 +3,8 @@ from queue import Queue
from types import TracebackType
from typing import Any, Union
__all__ = ["Client", "Listener", "Pipe"]
families: list[None]
_Address = Union[str, tuple[str, int]]

View File

@@ -11,8 +11,12 @@ from .context import BaseContext
if sys.version_info >= (3, 8):
from .shared_memory import _SLT, ShareableList, SharedMemory
__all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token", "SharedMemoryManager"]
_SharedMemory = SharedMemory
_ShareableList = ShareableList
else:
__all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token"]
if sys.version_info >= (3, 9):
from types import GenericAlias

View File

@@ -1,6 +1,11 @@
import sys
from typing import Any, Callable, Mapping
if sys.version_info >= (3, 8):
__all__ = ["BaseProcess", "current_process", "active_children", "parent_process"]
else:
__all__ = ["BaseProcess", "current_process", "active_children"]
class BaseProcess:
name: str
daemon: bool

View File

@@ -5,6 +5,8 @@ from typing import Any, Generic, TypeVar
if sys.version_info >= (3, 9):
from types import GenericAlias
__all__ = ["Queue", "SimpleQueue", "JoinableQueue"]
_T = TypeVar("_T")
class Queue(queue.Queue[_T]):

View File

@@ -5,30 +5,31 @@ from typing import Any, Generic, Iterable, TypeVar
if sys.version_info >= (3, 9):
from types import GenericAlias
__all__ = ["SharedMemory", "ShareableList"]
_SLT = TypeVar("_SLT", int, float, bool, str, bytes, None)
if sys.version_info >= (3, 8):
class SharedMemory:
def __init__(self, name: str | None = ..., create: bool = ..., size: int = ...) -> None: ...
@property
def buf(self) -> memoryview: ...
@property
def name(self) -> str: ...
@property
def size(self) -> int: ...
def close(self) -> None: ...
def unlink(self) -> None: ...
class SharedMemory:
def __init__(self, name: str | None = ..., create: bool = ..., size: int = ...) -> None: ...
@property
def buf(self) -> memoryview: ...
@property
def name(self) -> str: ...
@property
def size(self) -> int: ...
def close(self) -> None: ...
def unlink(self) -> None: ...
class ShareableList(Generic[_SLT]):
shm: SharedMemory
def __init__(self, sequence: Iterable[_SLT] | None = ..., *, name: str | None = ...) -> None: ...
def __getitem__(self, position: int) -> _SLT: ...
def __setitem__(self, position: int, value: _SLT) -> None: ...
def __reduce__(self: Self) -> tuple[Self, tuple[_SLT, ...]]: ...
def __len__(self) -> int: ...
@property
def format(self) -> str: ...
def count(self, value: _SLT) -> int: ...
def index(self, value: _SLT) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
class ShareableList(Generic[_SLT]):
shm: SharedMemory
def __init__(self, sequence: Iterable[_SLT] | None = ..., *, name: str | None = ...) -> None: ...
def __getitem__(self, position: int) -> _SLT: ...
def __setitem__(self, position: int, value: _SLT) -> None: ...
def __reduce__(self: Self) -> tuple[Self, tuple[_SLT, ...]]: ...
def __len__(self) -> int: ...
@property
def format(self) -> str: ...
def count(self, value: _SLT) -> int: ...
def index(self, value: _SLT) -> int: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

View File

@@ -6,6 +6,8 @@ from multiprocessing.synchronize import _LockLike
from typing import Any, Generic, Protocol, TypeVar, overload
from typing_extensions import Literal
__all__ = ["RawValue", "RawArray", "Value", "Array", "copy", "synchronized"]
_T = TypeVar("_T")
_CT = TypeVar("_CT", bound=_CData)

View File

@@ -1,6 +1,16 @@
from types import ModuleType
from typing import Any, Mapping, Sequence
__all__ = [
"_main",
"freeze_support",
"set_executable",
"get_executable",
"get_preparation_data",
"get_command_line",
"import_main_path",
]
WINEXE: bool
WINSERVICE: bool

View File

@@ -4,6 +4,8 @@ from contextlib import AbstractContextManager
from multiprocessing.context import BaseContext
from typing import Any, Callable, Union
__all__ = ["Lock", "RLock", "Semaphore", "BoundedSemaphore", "Condition", "Event"]
_LockLike = Union[Lock, RLock]
class Barrier(threading.Barrier):

View File

@@ -30,7 +30,6 @@ io.StringIO.readline
ipaddress._BaseNetwork.__init__
json.loads
mmap.ACCESS_DEFAULT
multiprocessing.shared_memory
(os|posix).utime
plistlib.Dict.__init__
pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args

View File

@@ -29,7 +29,6 @@ hmac.HMAC.__init__
http.server.SimpleHTTPRequestHandler.__init__ # *args is expanded
ipaddress._BaseNetwork.__init__
json.loads
multiprocessing.shared_memory
(os|posix).utime
pyexpat.XMLParserType.ExternalEntityParserCreate # C signature is wrong - function gets only positional args
queue.SimpleQueue.__init__ # Default C __init__ signature is wrong