mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Add __all__ to modules beginning with 'm' (#7330)
This commit is contained in:
@@ -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.
|
||||
#
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]):
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user