From dd24bba3dd4e61342c322fde8d18d0d881f8c121 Mon Sep 17 00:00:00 2001 From: Kevin Kirsche Date: Thu, 28 Jul 2022 11:09:18 -0400 Subject: [PATCH] Add `multiprocessing.resource_sharer` submodule (#8413) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Alex Waygood --- stdlib/multiprocessing/resource_sharer.pyi | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 stdlib/multiprocessing/resource_sharer.pyi diff --git a/stdlib/multiprocessing/resource_sharer.pyi b/stdlib/multiprocessing/resource_sharer.pyi new file mode 100644 index 000000000..b0d95514e --- /dev/null +++ b/stdlib/multiprocessing/resource_sharer.pyi @@ -0,0 +1,25 @@ +import sys +from socket import socket +from typing import Union +from typing_extensions import TypeAlias + +__all__ = ["stop"] + +# https://docs.python.org/3/library/multiprocessing.html#address-formats +_Address: TypeAlias = Union[str, tuple[str, int]] + +if sys.platform == "win32": + __all__ += ["DupSocket"] + + class DupSocket: + def __init__(self, sock: socket) -> None: ... + def detach(self) -> socket: ... + +else: + __all__ += ["DupFd"] + + class DupFd: + def __init__(self, fd: int) -> None: ... + def detach(self) -> int: ... + +def stop(timeout: float | None = ...) -> None: ...