| 1 |
import os |
| 2 |
import sys |
| 3 |
from _typeshed import ReadableBuffer, Unused |
| 4 |
from collections.abc import Iterator |
| 5 |
from typing import Final, Literal, NoReturn, SupportsIndex, overload |
| 6 |
from typing_extensions import Self, disjoint_base |
| 7 |
|
| 8 |
ACCESS_DEFAULT: Final = 0 |
| 9 |
ACCESS_READ: Final = 1 |
| 10 |
ACCESS_WRITE: Final = 2 |
| 11 |
ACCESS_COPY: Final = 3 |
| 12 |
|
| 13 |
ALLOCATIONGRANULARITY: Final[int] |
| 14 |
|
| 15 |
if sys.platform == "linux": |
| 16 |
MAP_DENYWRITE: Final[int] |
| 17 |
MAP_EXECUTABLE: Final[int] |
| 18 |
if sys.version_info >= (3, 10): |
| 19 |
MAP_POPULATE: Final[int] |
| 20 |
if sys.version_info >= (3, 11) and sys.platform != "win32" and sys.platform != "darwin": |
| 21 |
MAP_STACK: Final[int] |
| 22 |
|
| 23 |
if sys.platform != "win32": |
| 24 |
MAP_ANON: Final[int] |
| 25 |
MAP_ANONYMOUS: Final[int] |
| 26 |
MAP_PRIVATE: Final[int] |
| 27 |
MAP_SHARED: Final[int] |
| 28 |
PROT_EXEC: Final[int] |
| 29 |
PROT_READ: Final[int] |
| 30 |
PROT_WRITE: Final[int] |
| 31 |
|
| 32 |
PAGESIZE: Final[int] |
| 33 |
|
| 34 |
@disjoint_base |
| 35 |
class mmap: |
| 36 |
if sys.platform == "win32": |
| 37 |
def __new__(cls, fileno: int, length: int, tagname: str | None = None, access: int = 0, offset: int = 0) -> Self: ... |
| 38 |
else: |
| 39 |
if sys.version_info >= (3, 13): |
| 40 |
def __new__( |
| 41 |
cls, |
| 42 |
fileno: int, |
| 43 |
length: int, |
| 44 |
flags: int = ..., |
| 45 |
prot: int = ..., |
| 46 |
access: int = 0, |
| 47 |
offset: int = 0, |
| 48 |
*, |
| 49 |
trackfd: bool = True, |
| 50 |
) -> Self: ... |
| 51 |
else: |
| 52 |
def __new__( |
| 53 |
cls, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = 0, offset: int = 0 |
| 54 |
) -> Self: ... |
| 55 |
|
| 56 |
def close(self) -> None: ... |
| 57 |
def flush(self, offset: int = 0, size: int = ..., /) -> None: ... |
| 58 |
def move(self, dest: int, src: int, count: int, /) -> None: ... |
| 59 |
def read_byte(self) -> int: ... |
| 60 |
def readline(self) -> bytes: ... |
| 61 |
def resize(self, newsize: int, /) -> None: ... |
| 62 |
if sys.platform != "win32": |
| 63 |
def seek(self, pos: int, whence: Literal[0, 1, 2, 3, 4] = os.SEEK_SET, /) -> None: ... |
| 64 |
else: |
| 65 |
def seek(self, pos: int, whence: Literal[0, 1, 2] = os.SEEK_SET, /) -> None: ... |
| 66 |
|
| 67 |
def size(self) -> int: ... |
| 68 |
def tell(self) -> int: ... |
| 69 |
def write_byte(self, byte: int, /) -> None: ... |
| 70 |
def __len__(self) -> int: ... |
| 71 |
closed: bool |
| 72 |
if sys.platform != "win32": |
| 73 |
def madvise(self, option: int, start: int = 0, length: int = ..., /) -> None: ... |
| 74 |
|
| 75 |
def find(self, view: ReadableBuffer, start: int = ..., end: int = ..., /) -> int: ... |
| 76 |
def rfind(self, view: ReadableBuffer, start: int = ..., end: int = ..., /) -> int: ... |
| 77 |
def read(self, n: int | None = None, /) -> bytes: ... |
| 78 |
def write(self, bytes: ReadableBuffer, /) -> int: ... |
| 79 |
@overload |
| 80 |
def __getitem__(self, key: SupportsIndex, /) -> int: ... |
| 81 |
@overload |
| 82 |
def __getitem__(self, key: slice[SupportsIndex | None], /) -> bytes: ... |
| 83 |
def __delitem__(self, key: SupportsIndex | slice[SupportsIndex | None], /) -> NoReturn: ... |
| 84 |
@overload |
| 85 |
def __setitem__(self, key: SupportsIndex, value: int, /) -> None: ... |
| 86 |
@overload |
| 87 |
def __setitem__(self, key: slice[SupportsIndex | None], value: ReadableBuffer, /) -> None: ... |
| 88 |
|
| 89 |
|
| 90 |
def __contains__(self, o: object, /) -> bool: ... |
| 91 |
|
| 92 |
|
| 93 |
def __iter__(self) -> Iterator[int]: ... |
| 94 |
def __enter__(self) -> Self: ... |
| 95 |
def __exit__(self, exc_type: Unused, exc_value: Unused, traceback: Unused, /) -> None: ... |
| 96 |
def __buffer__(self, flags: int, /) -> memoryview: ... |
| 97 |
def __release_buffer__(self, buffer: memoryview, /) -> None: ... |
| 98 |
if sys.version_info >= (3, 13): |
| 99 |
def seekable(self) -> Literal[True]: ... |
| 100 |
|
| 101 |
if sys.platform != "win32": |
| 102 |
MADV_NORMAL: Final[int] |
| 103 |
MADV_RANDOM: Final[int] |
| 104 |
MADV_SEQUENTIAL: Final[int] |
| 105 |
MADV_WILLNEED: Final[int] |
| 106 |
MADV_DONTNEED: Final[int] |
| 107 |
MADV_FREE: Final[int] |
| 108 |
|
| 109 |
if sys.platform == "linux": |
| 110 |
MADV_REMOVE: Final[int] |
| 111 |
MADV_DONTFORK: Final[int] |
| 112 |
MADV_DOFORK: Final[int] |
| 113 |
MADV_HWPOISON: Final[int] |
| 114 |
MADV_MERGEABLE: Final[int] |
| 115 |
MADV_UNMERGEABLE: Final[int] |
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
MADV_HUGEPAGE: Final[int] |
| 120 |
MADV_NOHUGEPAGE: Final[int] |
| 121 |
MADV_DONTDUMP: Final[int] |
| 122 |
MADV_DODUMP: Final[int] |
| 123 |
|
| 124 |
|
| 125 |
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32": |
| 126 |
MADV_NOSYNC: Final[int] |
| 127 |
MADV_AUTOSYNC: Final[int] |
| 128 |
MADV_NOCORE: Final[int] |
| 129 |
MADV_CORE: Final[int] |
| 130 |
MADV_PROTECT: Final[int] |
| 131 |
|
| 132 |
if sys.version_info >= (3, 10) and sys.platform == "darwin": |
| 133 |
MADV_FREE_REUSABLE: Final[int] |
| 134 |
MADV_FREE_REUSE: Final[int] |
| 135 |
|
| 136 |
if sys.version_info >= (3, 13) and sys.platform != "win32": |
| 137 |
MAP_32BIT: Final[int] |
| 138 |
|
| 139 |
if sys.version_info >= (3, 13) and sys.platform == "darwin": |
| 140 |
MAP_NORESERVE: Final = 64 |
| 141 |
MAP_NOEXTEND: Final = 256 |
| 142 |
MAP_HASSEMAPHORE: Final = 512 |
| 143 |
MAP_NOCACHE: Final = 1024 |
| 144 |
MAP_JIT: Final = 2048 |
| 145 |
MAP_RESILIENT_CODESIGN: Final = 8192 |
| 146 |
MAP_RESILIENT_MEDIA: Final = 16384 |
| 147 |
MAP_TRANSLATED_ALLOW_EXECUTE: Final = 131072 |
| 148 |
MAP_UNIX03: Final = 262144 |
| 149 |
MAP_TPRO: Final = 524288 |
| 150 |
|
| 151 |
if sys.version_info >= (3, 13) and sys.platform == "linux": |
| 152 |
MAP_NORESERVE: Final = 16384 |