Repository navigation
Expand file tree
/
Copy pathmmap.pyi
More file actions
191 lines (168 loc) · 6.89 KB
/
Copy pathmmap.pyi
File metadata and controls
191 lines (168 loc) · 6.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
import os
import sys
from _typeshed import ReadableBuffer, Unused
from collections.abc import Iterator
from typing import Final, Literal, SupportsIndex, overload
from typing_extensions import Never, Self, disjoint_base
ACCESS_DEFAULT: Final = 0
ACCESS_READ: Final = 1
ACCESS_WRITE: Final = 2
ACCESS_COPY: Final = 3
ALLOCATIONGRANULARITY: Final[int]
if sys.platform == "linux":
MAP_DENYWRITE: Final[int]
MAP_EXECUTABLE: Final[int]
MAP_POPULATE: Final[int]
if sys.version_info >= (3, 11) and sys.platform != "win32" and sys.platform != "darwin":
MAP_STACK: Final[int]
if sys.platform != "win32":
MAP_ANON: Final[int]
MAP_ANONYMOUS: Final[int]
MAP_PRIVATE: Final[int]
MAP_SHARED: Final[int]
PROT_EXEC: Final[int]
PROT_READ: Final[int]
PROT_WRITE: Final[int]
if sys.version_info >= (3, 15):
MS_ASYNC: Final[int]
MS_INVALIDATE: Final[int]
MS_SYNC: Final[int]
PAGESIZE: Final[int]
@disjoint_base
class mmap:
if sys.platform == "win32":
if sys.version_info >= (3, 15):
def __new__(
cls,
fileno: int,
length: int,
tagname: str | None = None,
access: int = 0,
offset: int = 0,
*,
trackfd: bool = True,
) -> Self: ...
else:
def __new__(cls, fileno: int, length: int, tagname: str | None = None, access: int = 0, offset: int = 0) -> Self: ...
else:
if sys.version_info >= (3, 13):
def __new__(
cls,
fileno: int,
length: int,
flags: int = ...,
prot: int = ...,
access: int = 0,
offset: int = 0,
*,
trackfd: bool = True,
) -> Self: ...
else:
def __new__(
cls, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = 0, offset: int = 0
) -> Self: ...
def close(self) -> None: ...
if sys.version_info >= (3, 15):
def flush(self, offset: int = 0, size: int = -1, /, *, flags: int = 0) -> None: ...
elif sys.version_info >= (3, 14):
# size default changed in Python 3.14.1
def flush(self, offset: int = 0, size: int | None = None, /) -> None: ...
else:
def flush(self, offset: int = 0, size: int = ..., /) -> None: ...
def move(self, dest: int, src: int, count: int, /) -> None: ...
def read_byte(self) -> int: ...
def readline(self) -> bytes: ...
if sys.version_info < (3, 15) or sys.platform != "darwin":
def resize(self, newsize: int, /) -> None: ...
if sys.platform != "win32":
def seek(self, pos: int, whence: Literal[0, 1, 2, 3, 4] = os.SEEK_SET, /) -> None: ...
else:
def seek(self, pos: int, whence: Literal[0, 1, 2] = os.SEEK_SET, /) -> None: ...
def size(self) -> int: ...
def tell(self) -> int: ...
def write_byte(self, byte: int, /) -> None: ...
def __len__(self) -> int: ...
closed: bool
if sys.platform != "win32":
if sys.version_info >= (3, 15):
def madvise(self, option: int, start: int = 0, length: int | None = None, /) -> None: ...
else:
def madvise(self, option: int, start: int = 0, length: int = ..., /) -> None: ...
if sys.version_info >= (3, 14):
# default values changed in Python 3.14.1
def find(self, view: ReadableBuffer, start: int | None = None, end: int | None = None, /) -> int: ...
def rfind(self, view: ReadableBuffer, start: int | None = None, end: int | None = None, /) -> int: ...
else:
def find(self, view: ReadableBuffer, start: int = ..., end: int = ..., /) -> int: ...
def rfind(self, view: ReadableBuffer, start: int = ..., end: int = ..., /) -> int: ...
def read(self, n: int | None = None, /) -> bytes: ...
def write(self, bytes: ReadableBuffer, /) -> int: ...
if sys.version_info >= (3, 15):
def set_name(self, name: str, /) -> None: ...
@overload
def __getitem__(self, key: SupportsIndex, /) -> int: ...
@overload
def __getitem__(self, key: slice[SupportsIndex | None], /) -> bytes: ...
def __delitem__(self, key: SupportsIndex | slice[SupportsIndex | None], /) -> Never: ...
@overload
def __setitem__(self, key: SupportsIndex, value: int, /) -> None: ...
@overload
def __setitem__(self, key: slice[SupportsIndex | None], value: ReadableBuffer, /) -> None: ...
# Doesn't actually exist, but the object actually supports "in" because it has __getitem__,
# so we claim that there is also a __contains__ to help type checkers.
def __contains__(self, o: object, /) -> bool: ...
# Doesn't actually exist, but the object is actually iterable because it has __getitem__ and __len__,
# so we claim that there is also an __iter__ to help type checkers.
def __iter__(self) -> Iterator[int]: ...
def __enter__(self) -> Self: ...
def __exit__(self, exc_type: Unused, exc_value: Unused, traceback: Unused, /) -> None: ...
def __buffer__(self, flags: int, /) -> memoryview: ...
def __release_buffer__(self, buffer: memoryview, /) -> None: ...
if sys.version_info >= (3, 13):
def seekable(self) -> Literal[True]: ...
if sys.platform != "win32":
MADV_NORMAL: Final[int]
MADV_RANDOM: Final[int]
MADV_SEQUENTIAL: Final[int]
MADV_WILLNEED: Final[int]
MADV_DONTNEED: Final[int]
MADV_FREE: Final[int]
if sys.platform == "linux":
MADV_REMOVE: Final[int]
MADV_DONTFORK: Final[int]
MADV_DOFORK: Final[int]
MADV_HWPOISON: Final[int]
MADV_MERGEABLE: Final[int]
MADV_UNMERGEABLE: Final[int]
# Seems like this constant is not defined in glibc.
# See https://github.com/python/typeshed/pull/5360 for details
# MADV_SOFT_OFFLINE: Final[int]
MADV_HUGEPAGE: Final[int]
MADV_NOHUGEPAGE: Final[int]
MADV_DONTDUMP: Final[int]
MADV_DODUMP: Final[int]
# This Values are defined for FreeBSD but type checkers do not support conditions for these
if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32":
MADV_NOSYNC: Final[int]
MADV_AUTOSYNC: Final[int]
MADV_NOCORE: Final[int]
MADV_CORE: Final[int]
MADV_PROTECT: Final[int]
if sys.platform == "darwin":
MADV_FREE_REUSABLE: Final[int]
MADV_FREE_REUSE: Final[int]
if sys.version_info >= (3, 13) and sys.platform != "win32":
MAP_32BIT: Final[int]
if sys.version_info >= (3, 13) and sys.platform == "darwin":
MAP_NORESERVE: Final = 64
MAP_NOEXTEND: Final = 256
MAP_HASSEMAPHORE: Final = 512
MAP_NOCACHE: Final = 1024
MAP_JIT: Final = 2048
MAP_RESILIENT_CODESIGN: Final = 8192
MAP_RESILIENT_MEDIA: Final = 16384
MAP_TRANSLATED_ALLOW_EXECUTE: Final = 131072
MAP_UNIX03: Final = 262144
MAP_TPRO: Final = 524288
if sys.version_info >= (3, 13) and sys.platform == "linux":
MAP_NORESERVE: Final = 16384