2 # Ron Murawski <ron@horizonchess.com>
\r
4 from io import TextIOWrapper as _TextIOWrapper
\r
7 Mapping, MutableMapping, Dict, List, Any, Tuple, IO, Iterable, Iterator, NoReturn, overload, Union, AnyStr,
\r
8 Optional, Generic, Set, Callable, Text, Sequence, NamedTuple, TypeVar, ContextManager
\r
11 # Re-exported names from other modules.
\r
12 from builtins import OSError as error
\r
13 from posix import stat_result as stat_result
\r
14 from . import path as path
\r
18 # ----- os variables -----
\r
20 if sys.version_info >= (3, 2):
\r
21 supports_bytes_environ: bool
\r
23 if sys.version_info >= (3, 3):
\r
24 supports_dir_fd: Set[Callable[..., Any]]
\r
25 supports_fd: Set[Callable[..., Any]]
\r
26 supports_effective_ids: Set[Callable[..., Any]]
\r
27 supports_follow_symlinks: Set[Callable[..., Any]]
\r
29 PRIO_PROCESS: int # Unix only
\r
30 PRIO_PGRP: int # Unix only
\r
31 PRIO_USER: int # Unix only
\r
33 F_LOCK: int # Unix only
\r
34 F_TLOCK: int # Unix only
\r
35 F_ULOCK: int # Unix only
\r
36 F_TEST: int # Unix only
\r
38 POSIX_FADV_NORMAL: int # Unix only
\r
39 POSIX_FADV_SEQUENTIAL: int # Unix only
\r
40 POSIX_FADV_RANDOM: int # Unix only
\r
41 POSIX_FADV_NOREUSE: int # Unix only
\r
42 POSIX_FADV_WILLNEED: int # Unix only
\r
43 POSIX_FADV_DONTNEED: int # Unix only
\r
45 SF_NODISKIO: int # Unix only
\r
46 SF_MNOWAIT: int # Unix only
\r
47 SF_SYNC: int # Unix only
\r
49 XATTR_SIZE_MAX: int # Linux only
\r
50 XATTR_CREATE: int # Linux only
\r
51 XATTR_REPLACE: int # Linux only
\r
53 P_PID: int # Unix only
\r
54 P_PGID: int # Unix only
\r
55 P_ALL: int # Unix only
\r
57 WEXITED: int # Unix only
\r
58 WSTOPPED: int # Unix only
\r
59 WNOWAIT: int # Unix only
\r
61 CLD_EXITED: int # Unix only
\r
62 CLD_DUMPED: int # Unix only
\r
63 CLD_TRAPPED: int # Unix only
\r
64 CLD_CONTINUED: int # Unix only
\r
66 SCHED_OTHER: int # some flavors of Unix
\r
67 SCHED_BATCH: int # some flavors of Unix
\r
68 SCHED_IDLE: int # some flavors of Unix
\r
69 SCHED_SPORADIC: int # some flavors of Unix
\r
70 SCHED_FIFO: int # some flavors of Unix
\r
71 SCHED_RR: int # some flavors of Unix
\r
72 SCHED_RESET_ON_FORK: int # some flavors of Unix
\r
86 if sys.version_info >= (3, 3):
\r
87 SEEK_DATA: int # some flavors of Unix
\r
88 SEEK_HOLE: int # some flavors of Unix
\r
97 O_DSYNC: int # Unix only
\r
98 O_RSYNC: int # Unix only
\r
99 O_SYNC: int # Unix only
\r
100 O_NDELAY: int # Unix only
\r
101 O_NONBLOCK: int # Unix only
\r
102 O_NOCTTY: int # Unix only
\r
103 if sys.version_info >= (3, 3):
\r
104 O_CLOEXEC: int # Unix only
\r
105 O_SHLOCK: int # Unix only
\r
106 O_EXLOCK: int # Unix only
\r
107 O_BINARY: int # Windows only
\r
108 O_NOINHERIT: int # Windows only
\r
109 O_SHORT_LIVED: int # Windows only
\r
110 O_TEMPORARY: int # Windows only
\r
111 O_RANDOM: int # Windows only
\r
112 O_SEQUENTIAL: int # Windows only
\r
113 O_TEXT: int # Windows only
\r
114 O_ASYNC: int # Gnu extension if in C library
\r
115 O_DIRECT: int # Gnu extension if in C library
\r
116 O_DIRECTORY: int # Gnu extension if in C library
\r
117 O_NOFOLLOW: int # Gnu extension if in C library
\r
118 O_NOATIME: int # Gnu extension if in C library
\r
119 if sys.version_info >= (3, 4):
\r
120 O_PATH: int # Gnu extension if in C library
\r
121 O_TMPFILE: int # Gnu extension if in C library
\r
122 O_LARGEFILE: int # Gnu extension if in C library
\r
140 class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]):
\r
141 def copy(self) -> Dict[AnyStr, AnyStr]: ...
\r
142 def __delitem__(self, key: AnyStr) -> None: ...
\r
143 def __getitem__(self, key: AnyStr) -> AnyStr: ...
\r
144 def __setitem__(self, key: AnyStr, value: AnyStr) -> None: ...
\r
145 def __iter__(self) -> Iterator[AnyStr]: ...
\r
146 def __len__(self) -> int: ...
\r
148 environ: _Environ[str]
\r
149 if sys.version_info >= (3, 2):
\r
150 environb: _Environ[bytes]
\r
152 confstr_names: Dict[str, int] # Unix only
\r
153 pathconf_names: Dict[str, int] # Unix only
\r
154 sysconf_names: Dict[str, int] # Unix only
\r
156 EX_OK: int # Unix only
\r
157 EX_USAGE: int # Unix only
\r
158 EX_DATAERR: int # Unix only
\r
159 EX_NOINPUT: int # Unix only
\r
160 EX_NOUSER: int # Unix only
\r
161 EX_NOHOST: int # Unix only
\r
162 EX_UNAVAILABLE: int # Unix only
\r
163 EX_SOFTWARE: int # Unix only
\r
164 EX_OSERR: int # Unix only
\r
165 EX_OSFILE: int # Unix only
\r
166 EX_CANTCREAT: int # Unix only
\r
167 EX_IOERR: int # Unix only
\r
168 EX_TEMPFAIL: int # Unix only
\r
169 EX_PROTOCOL: int # Unix only
\r
170 EX_NOPERM: int # Unix only
\r
171 EX_CONFIG: int # Unix only
\r
172 EX_NOTFOUND: int # Unix only
\r
177 if sys.platform == 'win32':
\r
178 P_DETACH: int # Windows only
\r
179 P_OVERLAY: int # Windows only
\r
181 # wait()/waitpid() options
\r
182 WNOHANG: int # Unix only
\r
183 WCONTINUED: int # some Unix systems
\r
184 WUNTRACED: int # Unix only
\r
186 TMP_MAX: int # Undocumented, but used by tempfile
\r
188 # ----- os classes (structures) -----
\r
189 if sys.version_info >= (3, 6):
\r
190 from builtins import _PathLike as PathLike # See comment in builtins
\r
192 _PathType = path._PathType
\r
193 if sys.version_info >= (3, 3):
\r
194 _FdOrPathType = Union[int, _PathType]
\r
196 _FdOrPathType = _PathType
\r
198 if sys.version_info >= (3, 6):
\r
199 class DirEntry(PathLike[AnyStr]):
\r
200 # This is what the scandir interator yields
\r
201 # The constructor is hidden
\r
205 def inode(self) -> int: ...
\r
206 def is_dir(self, follow_symlinks: bool = ...) -> bool: ...
\r
207 def is_file(self, follow_symlinks: bool = ...) -> bool: ...
\r
208 def is_symlink(self) -> bool: ...
\r
209 def stat(self) -> stat_result: ...
\r
211 def __fspath__(self) -> AnyStr: ...
\r
212 elif sys.version_info >= (3, 5):
\r
213 class DirEntry(Generic[AnyStr]):
\r
214 # This is what the scandir interator yields
\r
215 # The constructor is hidden
\r
219 def inode(self) -> int: ...
\r
220 def is_dir(self, follow_symlinks: bool = ...) -> bool: ...
\r
221 def is_file(self, follow_symlinks: bool = ...) -> bool: ...
\r
222 def is_symlink(self) -> bool: ...
\r
223 def stat(self) -> stat_result: ...
\r
226 class statvfs_result: # Unix only
\r
238 # ----- os function stubs -----
\r
239 if sys.version_info >= (3, 6):
\r
240 def fsencode(filename: Union[str, bytes, PathLike]) -> bytes: ...
\r
242 def fsencode(filename: Union[str, bytes]) -> bytes: ...
\r
244 if sys.version_info >= (3, 6):
\r
245 def fsdecode(filename: Union[str, bytes, PathLike]) -> str: ...
\r
247 def fsdecode(filename: Union[str, bytes]) -> str: ...
\r
249 if sys.version_info >= (3, 6):
\r
251 def fspath(path: str) -> str: ...
\r
253 def fspath(path: bytes) -> bytes: ...
\r
255 def fspath(path: PathLike) -> Any: ...
\r
257 def get_exec_path(env: Optional[Mapping[str, str]] = ...) -> List[str]: ...
\r
258 # NOTE: get_exec_path(): returns List[bytes] when env not None
\r
259 def ctermid() -> str: ... # Unix only
\r
260 def getegid() -> int: ... # Unix only
\r
261 def geteuid() -> int: ... # Unix only
\r
262 def getgid() -> int: ... # Unix only
\r
263 if sys.version_info >= (3, 3):
\r
264 def getgrouplist(user: str, gid: int) -> List[int]: ... # Unix only
\r
265 def getgroups() -> List[int]: ... # Unix only, behaves differently on Mac
\r
266 def initgroups(username: str, gid: int) -> None: ... # Unix only
\r
267 def getlogin() -> str: ...
\r
268 def getpgid(pid: int) -> int: ... # Unix only
\r
269 def getpgrp() -> int: ... # Unix only
\r
270 def getpid() -> int: ...
\r
271 def getppid() -> int: ...
\r
272 if sys.version_info >= (3, 3):
\r
273 def getpriority(which: int, who: int) -> int: ... # Unix only
\r
274 def setpriority(which: int, who: int, priority: int) -> None: ... # Unix only
\r
275 def getresuid() -> Tuple[int, int, int]: ... # Unix only
\r
276 def getresgid() -> Tuple[int, int, int]: ... # Unix only
\r
277 def getuid() -> int: ... # Unix only
\r
278 def setegid(egid: int) -> None: ... # Unix only
\r
279 def seteuid(euid: int) -> None: ... # Unix only
\r
280 def setgid(gid: int) -> None: ... # Unix only
\r
281 def setgroups(groups: Sequence[int]) -> None: ... # Unix only
\r
282 def setpgrp() -> None: ... # Unix only
\r
283 def setpgid(pid: int, pgrp: int) -> None: ... # Unix only
\r
284 def setregid(rgid: int, egid: int) -> None: ... # Unix only
\r
285 def setresgid(rgid: int, egid: int, sgid: int) -> None: ... # Unix only
\r
286 def setresuid(ruid: int, euid: int, suid: int) -> None: ... # Unix only
\r
287 def setreuid(ruid: int, euid: int) -> None: ... # Unix only
\r
288 def getsid(pid: int) -> int: ... # Unix only
\r
289 def setsid() -> None: ... # Unix only
\r
290 def setuid(uid: int) -> None: ... # Unix only
\r
291 def strerror(code: int) -> str: ...
\r
292 def umask(mask: int) -> int: ...
\r
293 if sys.version_info >= (3, 3):
\r
294 from posix import uname_result
\r
295 def uname() -> uname_result: ... # Unix only
\r
297 def uname() -> Tuple[str, str, str, str, str]: ... # Unix only
\r
300 def getenv(key: Text) -> Optional[str]: ...
\r
302 def getenv(key: Text, default: _T) -> Union[str, _T]: ...
\r
303 def getenvb(key: bytes, default: bytes = ...) -> bytes: ...
\r
304 def putenv(key: Union[bytes, Text], value: Union[bytes, Text]) -> None: ...
\r
305 def unsetenv(key: Union[bytes, Text]) -> None: ...
\r
307 # Return IO or TextIO
\r
308 def fdopen(fd: int, mode: str = ..., buffering: int = ..., encoding: str = ...,
\r
309 errors: str = ..., newline: str = ..., closefd: bool = ...) -> Any: ...
\r
310 def close(fd: int) -> None: ...
\r
311 def closerange(fd_low: int, fd_high: int) -> None: ...
\r
312 def device_encoding(fd: int) -> Optional[str]: ...
\r
313 def dup(fd: int) -> int: ...
\r
314 def dup2(fd: int, fd2: int) -> None: ...
\r
315 def fchmod(fd: int, mode: int) -> None: ... # Unix only
\r
316 def fchown(fd: int, uid: int, gid: int) -> None: ... # Unix only
\r
317 def fdatasync(fd: int) -> None: ... # Unix only, not Mac
\r
318 def fpathconf(fd: int, name: Union[str, int]) -> int: ... # Unix only
\r
319 def fstat(fd: int) -> stat_result: ...
\r
320 def fstatvfs(fd: int) -> statvfs_result: ... # Unix only
\r
321 def fsync(fd: int) -> None: ...
\r
322 def ftruncate(fd: int, length: int) -> None: ... # Unix only
\r
323 if sys.version_info >= (3, 5):
\r
324 def get_blocking(fd: int) -> bool: ... # Unix only
\r
325 def set_blocking(fd: int, blocking: bool) -> None: ... # Unix only
\r
326 def isatty(fd: int) -> bool: ... # Unix only
\r
327 if sys.version_info >= (3, 3):
\r
328 def lockf(__fd: int, __cmd: int, __length: int) -> None: ... # Unix only
\r
329 def lseek(fd: int, pos: int, how: int) -> int: ...
\r
330 if sys.version_info >= (3, 3):
\r
331 def open(file: _PathType, flags: int, mode: int = ..., *, dir_fd: Optional[int] = ...) -> int: ...
\r
333 def open(file: _PathType, flags: int, mode: int = ...) -> int: ...
\r
334 def openpty() -> Tuple[int, int]: ... # some flavors of Unix
\r
335 def pipe() -> Tuple[int, int]: ...
\r
336 if sys.version_info >= (3, 3):
\r
337 def pipe2(flags: int) -> Tuple[int, int]: ... # some flavors of Unix
\r
338 def posix_fallocate(fd: int, offset: int, length: int) -> None: ... # Unix only
\r
339 def posix_fadvise(fd: int, offset: int, length: int, advice: int) -> None: ... # Unix only
\r
340 def pread(fd: int, buffersize: int, offset: int) -> bytes: ... # Unix only
\r
341 def pwrite(fd: int, string: bytes, offset: int) -> int: ... # Unix only
\r
342 def read(fd: int, n: int) -> bytes: ...
\r
343 if sys.version_info >= (3, 3):
\r
345 def sendfile(__out_fd: int, __in_fd: int, offset: Optional[int], count: int) -> int: ... # Unix only
\r
347 def sendfile(__out_fd: int, __in_fd: int, offset: int, count: int,
\r
348 headers: Sequence[bytes] = ..., trailers: Sequence[bytes] = ..., flags: int = ...) -> int: ... # FreeBSD and Mac OS X only
\r
349 def readv(fd: int, buffers: Sequence[bytearray]) -> int: ... # Unix only
\r
350 def writev(fd: int, buffers: Sequence[bytes]) -> int: ... # Unix only
\r
352 terminal_size = NamedTuple('terminal_size', [('columns', int), ('lines', int)])
\r
353 def get_terminal_size(fd: int = ...) -> terminal_size: ...
\r
355 if sys.version_info >= (3, 4):
\r
356 def get_inheritable(fd: int) -> bool: ...
\r
357 def set_inheritable(fd: int, inheritable: bool) -> None: ...
\r
359 def tcgetpgrp(fd: int) -> int: ... # Unix only
\r
360 def tcsetpgrp(fd: int, pg: int) -> None: ... # Unix only
\r
361 def ttyname(fd: int) -> str: ... # Unix only
\r
362 def write(fd: int, string: bytes) -> int: ...
\r
363 if sys.version_info >= (3, 3):
\r
364 def access(path: _FdOrPathType, mode: int, *, dir_fd: Optional[int] = ...,
\r
365 effective_ids: bool = ..., follow_symlinks: bool = ...) -> bool: ...
\r
367 def access(path: _PathType, mode: int) -> bool: ...
\r
368 def chdir(path: _FdOrPathType) -> None: ...
\r
369 def fchdir(fd: int) -> None: ...
\r
370 def getcwd() -> str: ...
\r
371 def getcwdb() -> bytes: ...
\r
372 if sys.version_info >= (3, 3):
\r
373 def chflags(path: _PathType, flags: int, follow_symlinks: bool = ...) -> None: ... # some flavors of Unix
\r
374 def chmod(path: _FdOrPathType, mode: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ...
\r
375 def chown(path: _FdOrPathType, uid: int, gid: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ... # Unix only
\r
377 def chflags(path: _PathType, flags: int) -> None: ... # Some flavors of Unix
\r
378 def chmod(path: _PathType, mode: int) -> None: ...
\r
379 def chown(path: _PathType, uid: int, gid: int) -> None: ... # Unix only
\r
380 def chroot(path: _PathType) -> None: ... # Unix only
\r
381 def lchflags(path: _PathType, flags: int) -> None: ... # Unix only
\r
382 def lchmod(path: _PathType, mode: int) -> None: ... # Unix only
\r
383 def lchown(path: _PathType, uid: int, gid: int) -> None: ... # Unix only
\r
384 if sys.version_info >= (3, 3):
\r
385 def link(src: _PathType, link_name: _PathType, *, src_dir_fd: Optional[int] = ...,
\r
386 dst_dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ...
\r
388 def link(src: _PathType, link_name: _PathType) -> None: ...
\r
390 if sys.version_info >= (3, 6):
\r
392 def listdir(path: Optional[str] = ...) -> List[str]: ...
\r
394 def listdir(path: bytes) -> List[bytes]: ...
\r
396 def listdir(path: int) -> List[str]: ...
\r
398 def listdir(path: PathLike[str]) -> List[str]: ...
\r
399 elif sys.version_info >= (3, 3):
\r
401 def listdir(path: Optional[str] = ...) -> List[str]: ...
\r
403 def listdir(path: bytes) -> List[bytes]: ...
\r
405 def listdir(path: int) -> List[str]: ...
\r
408 def listdir(path: Optional[str] = ...) -> List[str]: ...
\r
410 def listdir(path: bytes) -> List[bytes]: ...
\r
412 if sys.version_info >= (3, 3):
\r
413 def lstat(path: _PathType, *, dir_fd: Optional[int] = ...) -> stat_result: ...
\r
414 def mkdir(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
\r
415 def mkfifo(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... # Unix only
\r
417 def lstat(path: _PathType) -> stat_result: ...
\r
418 def mkdir(path: _PathType, mode: int = ...) -> None: ...
\r
419 def mkfifo(path: _PathType, mode: int = ...) -> None: ... # Unix only
\r
420 if sys.version_info >= (3, 4):
\r
421 def makedirs(name: _PathType, mode: int = ..., exist_ok: bool = ...) -> None: ...
\r
423 def makedirs(path: _PathType, mode: int = ..., exist_ok: bool = ...) -> None: ...
\r
424 if sys.version_info >= (3, 4):
\r
425 def mknod(path: _PathType, mode: int = ..., device: int = ...,
\r
426 *, dir_fd: Optional[int] = ...) -> None: ...
\r
427 elif sys.version_info >= (3, 3):
\r
428 def mknod(filename: _PathType, mode: int = ..., device: int = ...,
\r
429 *, dir_fd: Optional[int] = ...) -> None: ...
\r
431 def mknod(filename: _PathType, mode: int = ..., device: int = ...) -> None: ...
\r
432 def major(device: int) -> int: ...
\r
433 def minor(device: int) -> int: ...
\r
434 def makedev(major: int, minor: int) -> int: ...
\r
435 def pathconf(path: _FdOrPathType, name: Union[str, int]) -> int: ... # Unix only
\r
436 if sys.version_info >= (3, 6):
\r
437 def readlink(path: Union[AnyStr, PathLike[AnyStr]], *, dir_fd: Optional[int] = ...) -> AnyStr: ...
\r
438 elif sys.version_info >= (3, 3):
\r
439 def readlink(path: AnyStr, *, dir_fd: Optional[int] = ...) -> AnyStr: ...
\r
441 def readlink(path: AnyStr) -> AnyStr: ...
\r
442 if sys.version_info >= (3, 3):
\r
443 def remove(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
\r
445 def remove(path: _PathType) -> None: ...
\r
446 if sys.version_info >= (3, 4):
\r
447 def removedirs(name: _PathType) -> None: ...
\r
449 def removedirs(path: _PathType) -> None: ...
\r
450 if sys.version_info >= (3, 3):
\r
451 def rename(src: _PathType, dst: _PathType, *,
\r
452 src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ...
\r
454 def rename(src: _PathType, dst: _PathType) -> None: ...
\r
455 def renames(old: _PathType, new: _PathType) -> None: ...
\r
456 if sys.version_info >= (3, 3):
\r
457 def replace(src: _PathType, dst: _PathType, *,
\r
458 src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ...
\r
459 def rmdir(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
\r
461 def rmdir(path: _PathType) -> None: ...
\r
462 if sys.version_info >= (3, 7):
\r
463 class _ScandirIterator(Iterator[DirEntry[AnyStr]], ContextManager[_ScandirIterator[AnyStr]]):
\r
464 def __next__(self) -> DirEntry[AnyStr]: ...
\r
465 def close(self) -> None: ...
\r
467 def scandir() -> _ScandirIterator[str]: ...
\r
469 def scandir(path: int) -> _ScandirIterator[str]: ...
\r
471 def scandir(path: Union[AnyStr, PathLike[AnyStr]]) -> _ScandirIterator[AnyStr]: ...
\r
472 elif sys.version_info >= (3, 6):
\r
473 class _ScandirIterator(Iterator[DirEntry[AnyStr]], ContextManager[_ScandirIterator[AnyStr]]):
\r
474 def __next__(self) -> DirEntry[AnyStr]: ...
\r
475 def close(self) -> None: ...
\r
477 def scandir() -> _ScandirIterator[str]: ...
\r
479 def scandir(path: Union[AnyStr, PathLike[AnyStr]]) -> _ScandirIterator[AnyStr]: ...
\r
480 elif sys.version_info >= (3, 5):
\r
482 def scandir() -> Iterator[DirEntry[str]]: ...
\r
484 def scandir(path: AnyStr) -> Iterator[DirEntry[AnyStr]]: ...
\r
485 if sys.version_info >= (3, 3):
\r
486 def stat(path: _FdOrPathType, *, dir_fd: Optional[int] = ...,
\r
487 follow_symlinks: bool = ...) -> stat_result: ...
\r
489 def stat(path: _PathType) -> stat_result: ...
\r
490 if sys.version_info < (3, 7):
\r
492 def stat_float_times() -> bool: ...
\r
494 def stat_float_times(__newvalue: bool) -> None: ...
\r
495 def statvfs(path: _FdOrPathType) -> statvfs_result: ... # Unix only
\r
496 if sys.version_info >= (3, 3):
\r
497 def symlink(source: _PathType, link_name: _PathType,
\r
498 target_is_directory: bool = ..., *, dir_fd: Optional[int] = ...) -> None: ...
\r
499 def sync() -> None: ... # Unix only
\r
500 def truncate(path: _FdOrPathType, length: int) -> None: ... # Unix only up to version 3.4
\r
501 def unlink(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
\r
502 def utime(path: _FdOrPathType, times: Optional[Union[Tuple[int, int], Tuple[float, float]]] = ..., *,
\r
503 ns: Tuple[int, int] = ..., dir_fd: Optional[int] = ...,
\r
504 follow_symlinks: bool = ...) -> None: ...
\r
506 def symlink(source: _PathType, link_name: _PathType,
\r
507 target_is_directory: bool = ...) -> None:
\r
508 ... # final argument in Windows only
\r
509 def unlink(path: _PathType) -> None: ...
\r
510 def utime(path: _PathType, times: Optional[Tuple[float, float]]) -> None: ...
\r
512 if sys.version_info >= (3, 6):
\r
513 def walk(top: Union[AnyStr, PathLike[AnyStr]], topdown: bool = ...,
\r
514 onerror: Optional[Callable[[OSError], Any]] = ...,
\r
515 followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
\r
516 List[AnyStr]]]: ...
\r
518 def walk(top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ...,
\r
519 followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
\r
520 List[AnyStr]]]: ...
\r
521 if sys.version_info >= (3, 3):
\r
522 if sys.version_info >= (3, 7):
\r
524 def fwalk(top: Union[str, PathLike[str]] = ..., topdown: bool = ...,
\r
525 onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ...,
\r
526 dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ... # Unix only
\r
528 def fwalk(top: bytes, topdown: bool = ...,
\r
529 onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ...,
\r
530 dir_fd: Optional[int] = ...) -> Iterator[Tuple[bytes, List[bytes], List[bytes], int]]: ... # Unix only
\r
531 elif sys.version_info >= (3, 6):
\r
532 def fwalk(top: Union[str, PathLike[str]] = ..., topdown: bool = ...,
\r
533 onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ...,
\r
534 dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ... # Unix only
\r
536 def fwalk(top: str = ..., topdown: bool = ...,
\r
537 onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ...,
\r
538 dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ... # Unix only
\r
539 def getxattr(path: _FdOrPathType, attribute: _PathType, *, follow_symlinks: bool = ...) -> bytes: ... # Linux only
\r
540 def listxattr(path: _FdOrPathType, *, follow_symlinks: bool = ...) -> List[str]: ... # Linux only
\r
541 def removexattr(path: _FdOrPathType, attribute: _PathType, *, follow_symlinks: bool = ...) -> None: ... # Linux only
\r
542 def setxattr(path: _FdOrPathType, attribute: _PathType, value: bytes, flags: int = ..., *,
\r
543 follow_symlinks: bool = ...) -> None: ... # Linux only
\r
545 def abort() -> NoReturn: ...
\r
546 # These are defined as execl(file, *args) but the first *arg is mandatory.
\r
547 def execl(file: _PathType, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
\r
548 def execlp(file: _PathType, __arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> NoReturn: ...
\r
550 # These are: execle(file, *args, env) but env is pulled from the last element of the args.
\r
551 def execle(file: _PathType, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
\r
552 def execlpe(file: _PathType, __arg0: Union[bytes, Text], *args: Any) -> NoReturn: ...
\r
554 # The docs say `args: tuple or list of strings`
\r
555 # The implementation enforces tuple or list so we can't use Sequence.
\r
556 _ExecVArgs = Union[Tuple[Union[bytes, Text], ...], List[bytes], List[Text], List[Union[bytes, Text]]]
\r
557 def execv(path: _PathType, args: _ExecVArgs) -> NoReturn: ...
\r
558 def execve(path: _FdOrPathType, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
\r
559 def execvp(file: _PathType, args: _ExecVArgs) -> NoReturn: ...
\r
560 def execvpe(file: _PathType, args: _ExecVArgs, env: Mapping[str, str]) -> NoReturn: ...
\r
562 def _exit(n: int) -> NoReturn: ...
\r
563 def fork() -> int: ... # Unix only
\r
564 def forkpty() -> Tuple[int, int]: ... # some flavors of Unix
\r
565 def kill(pid: int, sig: int) -> None: ...
\r
566 def killpg(pgid: int, sig: int) -> None: ... # Unix only
\r
567 def nice(increment: int) -> int: ... # Unix only
\r
568 def plock(op: int) -> None: ... # Unix only ???op is int?
\r
570 if sys.version_info >= (3, 0):
\r
571 class _wrap_close(_TextIOWrapper):
\r
572 def close(self) -> Optional[int]: ... # type: ignore
\r
573 def popen(command: str, mode: str = ..., buffering: int = ...) -> _wrap_close: ...
\r
575 class _wrap_close(IO[Text]):
\r
576 def close(self) -> Optional[int]: ... # type: ignore
\r
577 def popen(__cmd: Text, __mode: Text = ..., __bufsize: int = ...) -> _wrap_close: ...
\r
578 def popen2(__cmd: Text, __mode: Text = ..., __bufsize: int = ...) -> Tuple[IO[Text], IO[Text]]: ...
\r
579 def popen3(__cmd: Text, __mode: Text = ..., __bufsize: int = ...) -> Tuple[IO[Text], IO[Text], IO[Text]]: ...
\r
580 def popen4(__cmd: Text, __mode: Text = ..., __bufsize: int = ...) -> Tuple[IO[Text], IO[Text]]: ...
\r
582 def spawnl(mode: int, path: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
\r
583 def spawnle(mode: int, path: _PathType, arg0: Union[bytes, Text],
\r
584 *args: Any) -> int: ... # Imprecise sig
\r
585 def spawnlp(mode: int, file: _PathType, arg0: Union[bytes, Text],
\r
586 *args: Union[bytes, Text]) -> int: ... # Unix only TODO
\r
587 def spawnlpe(mode: int, file: _PathType, arg0: Union[bytes, Text], *args: Any) -> int:
\r
588 ... # Imprecise signature; Unix only TODO
\r
589 def spawnv(mode: int, path: _PathType, args: List[Union[bytes, Text]]) -> int: ...
\r
590 def spawnve(mode: int, path: _PathType, args: List[Union[bytes, Text]],
\r
591 env: Mapping[str, str]) -> int: ...
\r
592 def spawnvp(mode: int, file: _PathType, args: List[Union[bytes, Text]]) -> int: ... # Unix only
\r
593 def spawnvpe(mode: int, file: _PathType, args: List[Union[bytes, Text]],
\r
594 env: Mapping[str, str]) -> int:
\r
596 def startfile(path: _PathType, operation: Optional[str] = ...) -> None: ... # Windows only
\r
597 def system(command: _PathType) -> int: ...
\r
598 if sys.version_info >= (3, 3):
\r
599 from posix import times_result
\r
600 def times() -> times_result: ...
\r
602 def times() -> Tuple[float, float, float, float, float]: ...
\r
603 def wait() -> Tuple[int, int]: ... # Unix only
\r
604 if sys.version_info >= (3, 3):
\r
605 from posix import waitid_result
\r
606 def waitid(idtype: int, ident: int, options: int) -> waitid_result: ... # Unix only
\r
607 def waitpid(pid: int, options: int) -> Tuple[int, int]: ...
\r
608 def wait3(options: int) -> Tuple[int, int, Any]: ... # Unix only
\r
609 def wait4(pid: int, options: int) -> Tuple[int, int, Any]: ... # Unix only
\r
610 def WCOREDUMP(status: int) -> bool: ... # Unix only
\r
611 def WIFCONTINUED(status: int) -> bool: ... # Unix only
\r
612 def WIFSTOPPED(status: int) -> bool: ... # Unix only
\r
613 def WIFSIGNALED(status: int) -> bool: ... # Unix only
\r
614 def WIFEXITED(status: int) -> bool: ... # Unix only
\r
615 def WEXITSTATUS(status: int) -> int: ... # Unix only
\r
616 def WSTOPSIG(status: int) -> int: ... # Unix only
\r
617 def WTERMSIG(status: int) -> int: ... # Unix only
\r
619 if sys.version_info >= (3, 3):
\r
620 from posix import sched_param
\r
621 def sched_get_priority_min(policy: int) -> int: ... # some flavors of Unix
\r
622 def sched_get_priority_max(policy: int) -> int: ... # some flavors of Unix
\r
623 def sched_setscheduler(pid: int, policy: int, param: sched_param) -> None: ... # some flavors of Unix
\r
624 def sched_getscheduler(pid: int) -> int: ... # some flavors of Unix
\r
625 def sched_setparam(pid: int, param: sched_param) -> None: ... # some flavors of Unix
\r
626 def sched_getparam(pid: int) -> sched_param: ... # some flavors of Unix
\r
627 def sched_rr_get_interval(pid: int) -> float: ... # some flavors of Unix
\r
628 def sched_yield() -> None: ... # some flavors of Unix
\r
629 def sched_setaffinity(pid: int, mask: Iterable[int]) -> None: ... # some flavors of Unix
\r
630 def sched_getaffinity(pid: int) -> Set[int]: ... # some flavors of Unix
\r
632 def confstr(name: Union[str, int]) -> Optional[str]: ... # Unix only
\r
633 if sys.version_info >= (3, 4):
\r
634 def cpu_count() -> Optional[int]: ...
\r
635 def getloadavg() -> Tuple[float, float, float]: ... # Unix only
\r
636 def sysconf(name: Union[str, int]) -> int: ... # Unix only
\r
637 if sys.version_info >= (3, 6):
\r
638 def getrandom(size: int, flags: int = ...) -> bytes: ...
\r
639 def urandom(size: int) -> bytes: ...
\r
641 def urandom(n: int) -> bytes: ...
\r
643 if sys.version_info >= (3, 7):
\r
644 def register_at_fork(func: Callable[..., object], when: str) -> None: ...
\r