mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Add multiprocessing.heap submodule (#8412)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
36
stdlib/multiprocessing/heap.pyi
Normal file
36
stdlib/multiprocessing/heap.pyi
Normal file
@@ -0,0 +1,36 @@
|
||||
import sys
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from mmap import mmap
|
||||
from typing import Protocol
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
__all__ = ["BufferWrapper"]
|
||||
|
||||
class Arena:
|
||||
size: int
|
||||
buffer: mmap
|
||||
if sys.platform == "win32":
|
||||
name: str
|
||||
def __init__(self, size: int) -> None: ...
|
||||
else:
|
||||
fd: int
|
||||
def __init__(self, size: int, fd: int = ...) -> None: ...
|
||||
|
||||
_Block: TypeAlias = tuple[Arena, int, int]
|
||||
|
||||
if sys.platform != "win32":
|
||||
class _SupportsDetach(Protocol):
|
||||
def detach(self) -> int: ...
|
||||
|
||||
def reduce_arena(a: Arena) -> tuple[Callable[[int, _SupportsDetach], Arena], tuple[int, Incomplete]]: ...
|
||||
def rebuild_arena(size: int, dupfd: _SupportsDetach) -> Arena: ...
|
||||
|
||||
class Heap:
|
||||
def __init__(self, size: int = ...) -> None: ...
|
||||
def free(self, block: _Block) -> None: ...
|
||||
def malloc(self, size: int) -> _Block: ...
|
||||
|
||||
class BufferWrapper:
|
||||
def __init__(self, size: int) -> None: ...
|
||||
def create_memoryview(self) -> memoryview: ...
|
||||
Reference in New Issue
Block a user