Debian Codegraph @

jedi/third_party/typeshed/stdlib/fcntl.pyi

raw symbols SCIP
1 import sys
2 from _typeshed import FileDescriptorLike, ReadOnlyBuffer, WriteableBuffer
3 from typing import Any, Final, Literal, overload
4 from typing_extensions import Buffer
5
6 if sys.platform != "win32":
7 FASYNC: Final[int]
8 FD_CLOEXEC: Final[int]
9 F_DUPFD: Final[int]
10 F_DUPFD_CLOEXEC: Final[int]
11 F_GETFD: Final[int]
12 F_GETFL: Final[int]
13 F_GETLK: Final[int]
14 F_GETOWN: Final[int]
15 F_RDLCK: Final[int]
16 F_SETFD: Final[int]
17 F_SETFL: Final[int]
18 F_SETLK: Final[int]
19 F_SETLKW: Final[int]
20 F_SETOWN: Final[int]
21 F_UNLCK: Final[int]
22 F_WRLCK: Final[int]
23
24 F_GETLEASE: Final[int]
25 F_SETLEASE: Final[int]
26 if sys.platform == "darwin":
27 F_FULLFSYNC: Final[int]
28 F_NOCACHE: Final[int]
29 F_GETPATH: Final[int]
30 if sys.platform == "linux":
31 F_SETLKW64: Final[int]
32 F_SETSIG: Final[int]
33 F_SHLCK: Final[int]
34 F_SETLK64: Final[int]
35 F_GETSIG: Final[int]
36 F_NOTIFY: Final[int]
37 F_EXLCK: Final[int]
38 F_GETLK64: Final[int]
39 F_ADD_SEALS: Final[int]
40 F_GET_SEALS: Final[int]
41 F_SEAL_GROW: Final[int]
42 F_SEAL_SEAL: Final[int]
43 F_SEAL_SHRINK: Final[int]
44 F_SEAL_WRITE: Final[int]
45 F_OFD_GETLK: Final[int]
46 F_OFD_SETLK: Final[int]
47 F_OFD_SETLKW: Final[int]
48
49 if sys.version_info >= (3, 10):
50 F_GETPIPE_SZ: Final[int]
51 F_SETPIPE_SZ: Final[int]
52
53 DN_ACCESS: Final[int]
54 DN_ATTRIB: Final[int]
55 DN_CREATE: Final[int]
56 DN_DELETE: Final[int]
57 DN_MODIFY: Final[int]
58 DN_MULTISHOT: Final[int]
59 DN_RENAME: Final[int]
60
61 LOCK_EX: Final[int]
62 LOCK_NB: Final[int]
63 LOCK_SH: Final[int]
64 LOCK_UN: Final[int]
65 if sys.platform == "linux":
66 LOCK_MAND: Final[int]
67 LOCK_READ: Final[int]
68 LOCK_RW: Final[int]
69 LOCK_WRITE: Final[int]
70
71 if sys.platform == "linux":
72 # Constants for the POSIX STREAMS interface. Present in glibc until 2.29 (released February 2019).
73 # Never implemented on BSD, and considered "obsolescent" starting in POSIX 2008.
74 # Probably still used on Solaris.
75 I_ATMARK: Final[int]
76 I_CANPUT: Final[int]
77 I_CKBAND: Final[int]
78 I_FDINSERT: Final[int]
79 I_FIND: Final[int]
80 I_FLUSH: Final[int]
81 I_FLUSHBAND: Final[int]
82 I_GETBAND: Final[int]
83 I_GETCLTIME: Final[int]
84 I_GETSIG: Final[int]
85 I_GRDOPT: Final[int]
86 I_GWROPT: Final[int]
87 I_LINK: Final[int]
88 I_LIST: Final[int]
89 I_LOOK: Final[int]
90 I_NREAD: Final[int]
91 I_PEEK: Final[int]
92 I_PLINK: Final[int]
93 I_POP: Final[int]
94 I_PUNLINK: Final[int]
95 I_PUSH: Final[int]
96 I_RECVFD: Final[int]
97 I_SENDFD: Final[int]
98 I_SETCLTIME: Final[int]
99 I_SETSIG: Final[int]
100 I_SRDOPT: Final[int]
101 I_STR: Final[int]
102 I_SWROPT: Final[int]
103 I_UNLINK: Final[int]
104
105 if sys.version_info >= (3, 12) and sys.platform == "linux":
106 FICLONE: Final[int]
107 FICLONERANGE: Final[int]
108
109 if sys.version_info >= (3, 13) and sys.platform == "linux":
110 F_OWNER_TID: Final = 0
111 F_OWNER_PID: Final = 1
112 F_OWNER_PGRP: Final = 2
113 F_SETOWN_EX: Final = 15
114 F_GETOWN_EX: Final = 16
115 F_SEAL_FUTURE_WRITE: Final = 16
116 F_GET_RW_HINT: Final = 1035
117 F_SET_RW_HINT: Final = 1036
118 F_GET_FILE_RW_HINT: Final = 1037
119 F_SET_FILE_RW_HINT: Final = 1038
120 RWH_WRITE_LIFE_NOT_SET: Final = 0
121 RWH_WRITE_LIFE_NONE: Final = 1
122 RWH_WRITE_LIFE_SHORT: Final = 2
123 RWH_WRITE_LIFE_MEDIUM: Final = 3
124 RWH_WRITE_LIFE_LONG: Final = 4
125 RWH_WRITE_LIFE_EXTREME: Final = 5
126
127 if sys.version_info >= (3, 11) and sys.platform == "darwin":
128 F_OFD_SETLK: Final = 90
129 F_OFD_SETLKW: Final = 91
130 F_OFD_GETLK: Final = 92
131
132 if sys.version_info >= (3, 13) and sys.platform != "linux":
133 # OSx and NetBSD
134 F_GETNOSIGPIPE: Final[int]
135 F_SETNOSIGPIPE: Final[int]
136 # OSx and FreeBSD
137 F_RDAHEAD: Final[int]
138
139 @overload
140 def fcntl(fd: FileDescriptorLike, cmd: int, arg: int = 0, /) -> int: ...
141 @overload
142 def fcntl(fd: FileDescriptorLike, cmd: int, arg: str | ReadOnlyBuffer, /) -> bytes: ...
143 # If arg is an int, return int
144 @overload
145 def ioctl(fd: FileDescriptorLike, request: int, arg: int = 0, mutate_flag: bool = True, /) -> int: ...
146 # The return type works as follows:
147 # - If arg is a read-write buffer, return int if mutate_flag is True, otherwise bytes
148 # - If arg is a read-only buffer, return bytes (and ignore the value of mutate_flag)
149 # We can't represent that precisely as we can't distinguish between read-write and read-only
150 # buffers, so we add overloads for a few unambiguous cases and use Any for the rest.
151 @overload
152 def ioctl(fd: FileDescriptorLike, request: int, arg: bytes, mutate_flag: bool = True, /) -> bytes: ...
153 @overload
154 def ioctl(fd: FileDescriptorLike, request: int, arg: WriteableBuffer, mutate_flag: Literal[False], /) -> bytes: ...
155 @overload
156 def ioctl(fd: FileDescriptorLike, request: int, arg: Buffer, mutate_flag: bool = True, /) -> Any: ...
157 def flock(fd: FileDescriptorLike, operation: int, /) -> None: ...
158 def lockf(fd: FileDescriptorLike, cmd: int, len: int = 0, start: int = 0, whence: int = 0, /) -> Any: ...