mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Update and add stubs for os module (#1645)
This commit is contained in:
@@ -5,8 +5,8 @@ from builtins import OSError as error
|
||||
from io import TextIOWrapper as _TextIOWrapper
|
||||
import sys
|
||||
from typing import (
|
||||
Mapping, MutableMapping, Dict, List, Any, Tuple, Iterator, overload, Union, AnyStr,
|
||||
Optional, Generic, Set, Callable, Text, Sequence, IO, NamedTuple, TypeVar
|
||||
Mapping, MutableMapping, Dict, List, Any, Tuple, IO, Iterable, Iterator, overload, Union, AnyStr,
|
||||
Optional, Generic, Set, Callable, Text, Sequence, NamedTuple, TypeVar
|
||||
)
|
||||
from . import path as path
|
||||
from mypy_extensions import NoReturn
|
||||
@@ -24,9 +24,66 @@ if sys.version_info >= (3, 3):
|
||||
supports_effective_ids: Set[Callable[..., Any]]
|
||||
supports_follow_symlinks: Set[Callable[..., Any]]
|
||||
|
||||
PRIO_PROCESS: int # Unix only
|
||||
PRIO_PGRP: int # Unix only
|
||||
PRIO_USER: int # Unix only
|
||||
|
||||
F_LOCK: int # Unix only
|
||||
F_TLOCK: int # Unix only
|
||||
F_ULOCK: int # Unix only
|
||||
F_TEST: int # Unix only
|
||||
|
||||
POSIX_FADV_NORMAL: int # Unix only
|
||||
POSIX_FADV_SEQUENTIAL: int # Unix only
|
||||
POSIX_FADV_RANDOM: int # Unix only
|
||||
POSIX_FADV_NOREUSE: int # Unix only
|
||||
POSIX_FADV_WILLNEED: int # Unix only
|
||||
POSIX_FADV_DONTNEED: int # Unix only
|
||||
|
||||
SF_NODISKIO: int # Unix only
|
||||
SF_MNOWAIT: int # Unix only
|
||||
SF_SYNC: int # Unix only
|
||||
|
||||
XATTR_SIZE_MAX: int # Linux only
|
||||
XATTR_CREATE: int # Linux only
|
||||
XATTR_REPLACE: int # Linux only
|
||||
|
||||
P_PID: int # Unix only
|
||||
P_PGID: int # Unix only
|
||||
P_ALL: int # Unix only
|
||||
|
||||
WEXITED: int # Unix only
|
||||
WSTOPPED: int # Unix only
|
||||
WNOWAIT: int # Unix only
|
||||
|
||||
CLD_EXITED: int # Unix only
|
||||
CLD_DUMPED: int # Unix only
|
||||
CLD_TRAPPED: int # Unix only
|
||||
CLD_CONTINUED: int # Unix only
|
||||
|
||||
SCHED_OTHER: int # some flavors of Unix
|
||||
SCHED_BATCH: int # some flavors of Unix
|
||||
SCHED_IDLE: int # some flavors of Unix
|
||||
SCHED_SPORADIC: int # some flavors of Unix
|
||||
SCHED_FIFO: int # some flavors of Unix
|
||||
SCHED_RR: int # some flavors of Unix
|
||||
SCHED_RESET_ON_FORK: int # some flavors of Unix
|
||||
|
||||
RTLD_LAZY: int
|
||||
RTLD_NOW: int
|
||||
RTLD_GLOBAL: int
|
||||
RTLD_LOCAL: int
|
||||
RTLD_NODELETE: int
|
||||
RTLD_NOLOAD: int
|
||||
RTLD_DEEPBIND: int
|
||||
|
||||
|
||||
SEEK_SET: int
|
||||
SEEK_CUR: int
|
||||
SEEK_END: int
|
||||
if sys.version_info >= (3, 3):
|
||||
SEEK_DATA: int # some flavors of Unix
|
||||
SEEK_HOLE: int # some flavors of Unix
|
||||
|
||||
O_RDONLY: int
|
||||
O_WRONLY: int
|
||||
@@ -41,6 +98,8 @@ O_SYNC: int # Unix only
|
||||
O_NDELAY: int # Unix only
|
||||
O_NONBLOCK: int # Unix only
|
||||
O_NOCTTY: int # Unix only
|
||||
if sys.version_info >= (3, 3):
|
||||
O_CLOEXEC: int # Unix only
|
||||
O_SHLOCK: int # Unix only
|
||||
O_EXLOCK: int # Unix only
|
||||
O_BINARY: int # Windows only
|
||||
@@ -55,6 +114,9 @@ O_DIRECT: int # Gnu extension if in C library
|
||||
O_DIRECTORY: int # Gnu extension if in C library
|
||||
O_NOFOLLOW: int # Gnu extension if in C library
|
||||
O_NOATIME: int # Gnu extension if in C library
|
||||
if sys.version_info >= (3, 4):
|
||||
O_PATH: int # Gnu extension if in C library
|
||||
O_TMPFILE: int # Gnu extension if in C library
|
||||
O_LARGEFILE: int # Gnu extension if in C library
|
||||
|
||||
curdir: str
|
||||
@@ -121,6 +183,10 @@ if sys.version_info >= (3, 6):
|
||||
from builtins import _PathLike as PathLike # See comment in builtins
|
||||
|
||||
_PathType = path._PathType
|
||||
if sys.version_info >= (3, 3):
|
||||
_FdOrPathType = Union[int, _PathType]
|
||||
else:
|
||||
_FdOrPathType = _PathType
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
class DirEntry(PathLike[AnyStr]):
|
||||
@@ -230,6 +296,8 @@ def ctermid() -> str: ... # Unix only
|
||||
def getegid() -> int: ... # Unix only
|
||||
def geteuid() -> int: ... # Unix only
|
||||
def getgid() -> int: ... # Unix only
|
||||
if sys.version_info >= (3, 3):
|
||||
def getgrouplist(user: str, gid: int) -> List[int]: ... # Unix only
|
||||
def getgroups() -> List[int]: ... # Unix only, behaves differently on Mac
|
||||
def initgroups(username: str, gid: int) -> None: ... # Unix only
|
||||
def getlogin() -> str: ...
|
||||
@@ -237,6 +305,9 @@ def getpgid(pid: int) -> int: ... # Unix only
|
||||
def getpgrp() -> int: ... # Unix only
|
||||
def getpid() -> int: ...
|
||||
def getppid() -> int: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def getpriority(which: int, who: int) -> int: ... # Unix only
|
||||
def setpriority(which: int, who: int, priority: int) -> None: ... # Unix only
|
||||
def getresuid() -> Tuple[int, int, int]: ... # Unix only
|
||||
def getresgid() -> Tuple[int, int, int]: ... # Unix only
|
||||
def getuid() -> int: ... # Unix only
|
||||
@@ -285,63 +356,136 @@ def fstat(fd: int) -> stat_result: ...
|
||||
def fstatvfs(fd: int) -> statvfs_result: ... # Unix only
|
||||
def fsync(fd: int) -> None: ...
|
||||
def ftruncate(fd: int, length: int) -> None: ... # Unix only
|
||||
if sys.version_info >= (3, 5):
|
||||
def get_blocking(fd: int) -> bool: ... # Unix only
|
||||
def set_blocking(fd: int, blocking: bool) -> None: ... # Unix only
|
||||
def isatty(fd: int) -> bool: ... # Unix only
|
||||
if sys.version_info >= (3, 3):
|
||||
def lockf(__fd: int, __cmd: int, __length: int) -> None: ... # Unix only
|
||||
def lseek(fd: int, pos: int, how: int) -> int: ...
|
||||
def open(file: _PathType, flags: int, mode: int = ...) -> int: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def open(file: _PathType, flags: int, mode: int = ..., *, dir_fd: Optional[int] = ...) -> int: ...
|
||||
else:
|
||||
def open(file: _PathType, flags: int, mode: int = ...) -> int: ...
|
||||
def openpty() -> Tuple[int, int]: ... # some flavors of Unix
|
||||
def pipe() -> Tuple[int, int]: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def pipe2(flags: int) -> Tuple[int, int]: ... # some flavors of Unix
|
||||
def posix_fallocate(fd: int, offset: int, length: int) -> None: ... # Unix only
|
||||
def posix_fadvise(fd: int, offset: int, length: int, advice: int) -> None: ... # Unix only
|
||||
def pread(fd: int, buffersize: int, offset: int) -> bytes: ... # Unix only
|
||||
def pwrite(fd: int, string: bytes, offset: int) -> int: ... # Unix only
|
||||
def read(fd: int, n: int) -> bytes: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
@overload
|
||||
def sendfile(__out_fd: int, __in_fd: int, offset: Optional[int], count: int) -> int: ... # Unix only
|
||||
@overload
|
||||
def sendfile(__out_fd: int, __in_fd: int, offset: int, count: int,
|
||||
headers: Sequence[bytes] = ..., trailers: Sequence[bytes] = ..., flags: int = ...) -> int: ... # FreeBSD and Mac OS X only
|
||||
def readv(fd: int, buffers: Sequence[bytearray]) -> int: ... # Unix only
|
||||
def writev(fd: int, buffers: Sequence[bytes]) -> int: ... # Unix only
|
||||
|
||||
terminal_size = NamedTuple('terminal_size', [('columns', int), ('lines', int)])
|
||||
def get_terminal_size(fd: int = ...) -> terminal_size: ...
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
def get_inheritable(fd: int) -> bool: ...
|
||||
def set_inheritable(fd: int, inheritable: bool) -> None: ...
|
||||
|
||||
def tcgetpgrp(fd: int) -> int: ... # Unix only
|
||||
def tcsetpgrp(fd: int, pg: int) -> None: ... # Unix only
|
||||
def ttyname(fd: int) -> str: ... # Unix only
|
||||
def write(fd: int, string: bytes) -> int: ...
|
||||
def access(path: _PathType, mode: int) -> bool: ...
|
||||
def chdir(path: _PathType) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def access(path: _FdOrPathType, mode: int, *, dir_fd: Optional[int] = ...,
|
||||
effective_ids: bool = ..., follow_symlinks: bool = ...) -> bool: ...
|
||||
else:
|
||||
def access(path: _PathType, mode: int) -> bool: ...
|
||||
def chdir(path: _FdOrPathType) -> None: ...
|
||||
def fchdir(fd: int) -> None: ...
|
||||
def getcwd() -> str: ...
|
||||
def getcwdb() -> bytes: ...
|
||||
def chflags(path: _PathType, flags: int) -> None: ... # Unix only
|
||||
if sys.version_info >= (3, 3):
|
||||
def chflags(path: _PathType, flags: int, follow_symlinks: bool = ...) -> None: ... # some flavors of Unix
|
||||
def chmod(path: _FdOrPathType, mode: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ...
|
||||
def chown(path: _FdOrPathType, uid: int, gid: int, *, dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ... # Unix only
|
||||
else:
|
||||
def chflags(path: _PathType, flags: int) -> None: ... # Some flavors of Unix
|
||||
def chmod(path: _PathType, mode: int) -> None: ...
|
||||
def chown(path: _PathType, uid: int, gid: int) -> None: ... # Unix only
|
||||
def chroot(path: _PathType) -> None: ... # Unix only
|
||||
def chmod(path: _PathType, mode: int) -> None: ...
|
||||
def chown(path: _PathType, uid: int, gid: int) -> None: ... # Unix only
|
||||
def lchflags(path: _PathType, flags: int) -> None: ... # Unix only
|
||||
def lchmod(path: _PathType, mode: int) -> None: ... # Unix only
|
||||
def lchown(path: _PathType, uid: int, gid: int) -> None: ... # Unix only
|
||||
def link(src: _PathType, link_name: _PathType) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def link(src: _PathType, link_name: _PathType, *, src_dir_fd: Optional[int] = ...,
|
||||
dst_dir_fd: Optional[int] = ..., follow_symlinks: bool = ...) -> None: ...
|
||||
else:
|
||||
def link(src: _PathType, link_name: _PathType) -> None: ...
|
||||
|
||||
@overload
|
||||
def listdir(path: str = ...) -> List[str]: ...
|
||||
@overload
|
||||
def listdir(path: bytes) -> List[bytes]: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
@overload
|
||||
def listdir(path: Optional[str] = ...) -> List[str]: ...
|
||||
@overload
|
||||
def listdir(path: bytes) -> List[bytes]: ...
|
||||
@overload
|
||||
def listdir(path: int) -> List[str]: ...
|
||||
else:
|
||||
@overload
|
||||
def listdir(path: Optional[str] = ...) -> List[str]: ...
|
||||
@overload
|
||||
def listdir(path: bytes) -> List[bytes]: ...
|
||||
|
||||
def lstat(path: _PathType) -> stat_result: ...
|
||||
def mkfifo(path: _PathType, mode: int = ...) -> None: ... # Unix only
|
||||
def mknod(filename: _PathType, mode: int = ..., device: int = ...) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def lstat(path: _PathType, *, dir_fd: Optional[int] = ...) -> stat_result: ...
|
||||
def mkdir(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def mkfifo(path: _PathType, mode: int = ..., *, dir_fd: Optional[int] = ...) -> None: ... # Unix only
|
||||
else:
|
||||
def lstat(path: _PathType) -> stat_result: ...
|
||||
def mkdir(path: _PathType, mode: int = ...) -> None: ...
|
||||
def mkfifo(path: _PathType, mode: int = ...) -> None: ... # Unix only
|
||||
if sys.version_info >= (3, 4):
|
||||
def makedirs(name: _PathType, mode: int = ..., exist_ok: bool = ...) -> None: ...
|
||||
else:
|
||||
def makedirs(path: _PathType, mode: int = ..., exist_ok: bool = ...) -> None: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def mknod(path: _PathType, mode: int = ..., device: int = ...,
|
||||
*, dir_fd: Optional[int] = ...) -> None: ...
|
||||
elif sys.version_info >= (3, 3):
|
||||
def mknod(filename: _PathType, mode: int = ..., device: int = ...,
|
||||
*, dir_fd: Optional[int] = ...) -> None: ...
|
||||
else:
|
||||
def mknod(filename: _PathType, mode: int = ..., device: int = ...) -> None: ...
|
||||
def major(device: int) -> int: ...
|
||||
def minor(device: int) -> int: ...
|
||||
def makedev(major: int, minor: int) -> int: ...
|
||||
def mkdir(path: _PathType, mode: int = ...) -> None: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def makedirs(name: _PathType, mode: int = ...,
|
||||
exist_ok: bool = ...) -> None: ...
|
||||
else:
|
||||
def makedirs(path: _PathType, mode: int = ...,
|
||||
exist_ok: bool = ...) -> None: ...
|
||||
def pathconf(path: _PathType, name: Union[str, int]) -> int: ... # Unix only
|
||||
def pathconf(path: _FdOrPathType, name: Union[str, int]) -> int: ... # Unix only
|
||||
if sys.version_info >= (3, 6):
|
||||
def readlink(path: Union[AnyStr, PathLike[AnyStr]]) -> AnyStr: ...
|
||||
def readlink(path: Union[AnyStr, PathLike[AnyStr]], *, dir_fd: Optional[int] = ...) -> AnyStr: ...
|
||||
elif sys.version_info >= (3, 3):
|
||||
def readlink(path: AnyStr, *, dir_fd: Optional[int] = ...) -> AnyStr: ...
|
||||
else:
|
||||
def readlink(path: AnyStr) -> AnyStr: ...
|
||||
def remove(path: _PathType) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def remove(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
else:
|
||||
def remove(path: _PathType) -> None: ...
|
||||
if sys.version_info >= (3, 4):
|
||||
def removedirs(name: _PathType) -> None: ...
|
||||
else:
|
||||
def removedirs(path: _PathType) -> None: ...
|
||||
def rename(src: _PathType, dst: _PathType) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def rename(src: _PathType, dst: _PathType, *,
|
||||
src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ...
|
||||
else:
|
||||
def rename(src: _PathType, dst: _PathType) -> None: ...
|
||||
def renames(old: _PathType, new: _PathType) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def replace(src: _PathType, dst: _PathType) -> None: ...
|
||||
def rmdir(path: _PathType) -> None: ...
|
||||
def replace(src: _PathType, dst: _PathType, *,
|
||||
src_dir_fd: Optional[int] = ..., dst_dir_fd: Optional[int] = ...) -> None: ...
|
||||
def rmdir(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
else:
|
||||
def rmdir(path: _PathType) -> None: ...
|
||||
if sys.version_info >= (3, 6):
|
||||
@overload
|
||||
def scandir() -> Iterator[DirEntry[str]]: ...
|
||||
@@ -352,18 +496,30 @@ elif sys.version_info >= (3, 5):
|
||||
def scandir() -> Iterator[DirEntry[str]]: ...
|
||||
@overload
|
||||
def scandir(path: AnyStr) -> Iterator[DirEntry[AnyStr]]: ...
|
||||
def stat(path: _PathType) -> stat_result: ...
|
||||
def stat_float_times(newvalue: Union[bool, None] = ...) -> bool: ...
|
||||
def statvfs(path: _PathType) -> statvfs_result: ... # Unix only
|
||||
def symlink(source: _PathType, link_name: _PathType,
|
||||
target_is_directory: bool = ...) -> None:
|
||||
... # final argument in Windows only
|
||||
def unlink(path: _PathType) -> None: ...
|
||||
if sys.version_info >= (3, 0):
|
||||
def utime(path: _PathType, times: Optional[Union[Tuple[int, int], Tuple[float, float]]] = ...,
|
||||
ns: Optional[Tuple[int, int]] = ..., dir_fd: Optional[int] = ...,
|
||||
if sys.version_info >= (3, 3):
|
||||
def stat(path: _FdOrPathType, *, dir_fd: Optional[int] = ...,
|
||||
follow_symlinks: bool = ...) -> stat_result: ...
|
||||
else:
|
||||
def stat(path: _PathType) -> stat_result: ...
|
||||
@overload
|
||||
def stat_float_times() -> bool: ...
|
||||
@overload
|
||||
def stat_float_times(__newvalue: bool) -> None: ...
|
||||
def statvfs(path: _FdOrPathType) -> statvfs_result: ... # Unix only
|
||||
if sys.version_info >= (3, 3):
|
||||
def symlink(source: _PathType, link_name: _PathType,
|
||||
target_is_directory: bool = ..., *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def sync() -> None: ... # Unix only
|
||||
def truncate(path: _FdOrPathType, length: int) -> None: ... # Unix only up to version 3.4
|
||||
def unlink(path: _PathType, *, dir_fd: Optional[int] = ...) -> None: ...
|
||||
def utime(path: _FdOrPathType, times: Optional[Union[Tuple[int, int], Tuple[float, float]]] = ..., *,
|
||||
ns: Tuple[int, int] = ..., dir_fd: Optional[int] = ...,
|
||||
follow_symlinks: bool = ...) -> None: ...
|
||||
else:
|
||||
def symlink(source: _PathType, link_name: _PathType,
|
||||
target_is_directory: bool = ...) -> None:
|
||||
... # final argument in Windows only
|
||||
def unlink(path: _PathType) -> None: ...
|
||||
def utime(path: _PathType, times: Optional[Tuple[float, float]]) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
@@ -375,6 +531,15 @@ else:
|
||||
def walk(top: AnyStr, topdown: bool = ..., onerror: Optional[Callable[[OSError], Any]] = ...,
|
||||
followlinks: bool = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
|
||||
List[AnyStr]]]: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
def fwalk(top: _PathType = ..., topdown: bool = ...,
|
||||
onerror: Optional[Callable] = ..., *, follow_symlinks: bool = ...,
|
||||
dir_fd: Optional[int] = ...) -> Iterator[Tuple[str, List[str], List[str], int]]: ... # Unix only
|
||||
def getxattr(path: _FdOrPathType, attribute: _PathType, *, follow_symlinks: bool = ...) -> bytes: ... # Linux only
|
||||
def listxattr(path: _FdOrPathType, *, follow_symlinks: bool = ...) -> List[str]: ... # Linux only
|
||||
def removexattr(path: _FdOrPathType, attribute: _PathType, *, follow_symlinks: bool = ...) -> None: ... # Linux only
|
||||
def setxattr(path: _FdOrPathType, attribute: _PathType, value: bytes, flags: int = ..., *,
|
||||
follow_symlinks: bool = ...) -> None: ... # Linux only
|
||||
|
||||
def abort() -> NoReturn: ...
|
||||
# These are defined as execl(file, *args) but the first *arg is mandatory.
|
||||
@@ -389,7 +554,7 @@ def execlpe(file: _PathType, __arg0: Union[bytes, Text], *args: Any) -> NoReturn
|
||||
# The implementation enforces tuple or list so we can't use Sequence.
|
||||
_ExecVArgs = Union[Tuple[Union[bytes, Text], ...], List[bytes], List[Text], List[Union[bytes, Text]]]
|
||||
def execv(path: _PathType, args: _ExecVArgs) -> None: ...
|
||||
def execve(path: _PathType, args: _ExecVArgs, env: Mapping[str, str]) -> None: ...
|
||||
def execve(path: _FdOrPathType, args: _ExecVArgs, env: Mapping[str, str]) -> None: ...
|
||||
def execvp(file: _PathType, args: _ExecVArgs) -> None: ...
|
||||
def execvpe(file: _PathType, args: _ExecVArgs, env: Mapping[str, str]) -> None: ...
|
||||
|
||||
@@ -402,16 +567,16 @@ def nice(increment: int) -> int: ... # Unix only
|
||||
def plock(op: int) -> None: ... # Unix only ???op is int?
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
class popen(_TextIOWrapper):
|
||||
# TODO 'b' modes or bytes command not accepted?
|
||||
def __init__(self, command: str, mode: str = ...,
|
||||
bufsize: int = ...) -> None: ...
|
||||
def close(self) -> Any: ... # may return int
|
||||
class _wrap_close(_TextIOWrapper):
|
||||
def close(self) -> Optional[int]: ... # type: ignore
|
||||
def popen(self, command: str, mode: str = ..., buffering: int = ...) -> _wrap_close: ...
|
||||
else:
|
||||
def popen(command: str, *args, **kwargs) -> Optional[IO[Any]]: ...
|
||||
def popen2(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
def popen3(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any], IO[Any]]: ...
|
||||
def popen4(cmd: str, *args, **kwargs) -> Tuple[IO[Any], IO[Any]]: ...
|
||||
class _wrap_close(IO[Text]):
|
||||
def close(self) -> Optional[int]: ... # type: ignore
|
||||
def popen(__cmd: Text, __mode: Text = ..., __bufsize: int = ...) -> _wrap_close: ...
|
||||
def popen2(__cmd: Text, __mode: Text = ..., __bufsize: int = ...) -> Tuple[IO[Text], IO[Text]]: ...
|
||||
def popen3(__cmd: Text, __mode: Text = ..., __bufsize: int = ...) -> Tuple[IO[Text], IO[Text], IO[Text]]: ...
|
||||
def popen4(__cmd: Text, __mode: Text = ..., __bufsize: int = ...) -> Tuple[IO[Text], IO[Text]]: ...
|
||||
|
||||
def spawnl(mode: int, path: _PathType, arg0: Union[bytes, Text], *args: Union[bytes, Text]) -> int: ...
|
||||
def spawnle(mode: int, path: _PathType, arg0: Union[bytes, Text],
|
||||
@@ -429,8 +594,15 @@ def spawnvpe(mode: int, file: _PathType, args: List[Union[bytes, Text]],
|
||||
... # Unix only
|
||||
def startfile(path: _PathType, operation: Optional[str] = ...) -> None: ... # Windows only
|
||||
def system(command: _PathType) -> int: ...
|
||||
def times() -> Tuple[float, float, float, float, float]: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
from posix import times_result
|
||||
def times() -> times_result: ...
|
||||
else:
|
||||
def times() -> Tuple[float, float, float, float, float]: ...
|
||||
def wait() -> Tuple[int, int]: ... # Unix only
|
||||
if sys.version_info >= (3, 3):
|
||||
from posix import waitid_result
|
||||
def waitid(idtype: int, ident: int, options: int) -> waitid_result: ... # Unix only
|
||||
def waitpid(pid: int, options: int) -> Tuple[int, int]: ...
|
||||
def wait3(options: int) -> Tuple[int, int, Any]: ... # Unix only
|
||||
def wait4(pid: int, options: int) -> Tuple[int, int, Any]: ... # Unix only
|
||||
@@ -442,39 +614,27 @@ def WIFEXITED(status: int) -> bool: ... # Unix only
|
||||
def WEXITSTATUS(status: int) -> int: ... # Unix only
|
||||
def WSTOPSIG(status: int) -> int: ... # Unix only
|
||||
def WTERMSIG(status: int) -> int: ... # Unix only
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
from posix import sched_param
|
||||
def sched_get_priority_min(policy: int) -> int: ... # some flavors of Unix
|
||||
def sched_get_priority_max(policy: int) -> int: ... # some flavors of Unix
|
||||
def sched_setscheduler(pid: int, policy: int, param: sched_param) -> None: ... # some flavors of Unix
|
||||
def sched_getscheduler(pid: int) -> int: ... # some flavors of Unix
|
||||
def sched_setparam(pid: int, param: sched_param) -> None: ... # some flavors of Unix
|
||||
def sched_getparam(pid: int) -> sched_param: ... # some flavors of Unix
|
||||
def sched_rr_get_interval(pid: int) -> float: ... # some flavors of Unix
|
||||
def sched_yield() -> None: ... # some flavors of Unix
|
||||
def sched_setaffinity(pid: int, mask: Iterable[int]) -> None: ... # some flavors of Unix
|
||||
def sched_getaffinity(pid: int) -> Set[int]: ... # some flavors of Unix
|
||||
|
||||
def confstr(name: Union[str, int]) -> Optional[str]: ... # Unix only
|
||||
def getloadavg() -> Tuple[float, float, float]: ... # Unix only
|
||||
def sysconf(name: Union[str, int]) -> int: ... # Unix only
|
||||
def urandom(n: int) -> bytes: ...
|
||||
|
||||
if sys.version_info >= (3, 0):
|
||||
def sched_getaffinity(id: int) -> Set[int]: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
class waitresult:
|
||||
si_pid: int
|
||||
def waitid(idtype: int, id: int, options: int) -> waitresult: ...
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
def tmpfile() -> IO[Any]: ...
|
||||
def tmpnam() -> str: ...
|
||||
def tempnam(dir: str = ..., prefix: str = ...) -> str: ...
|
||||
|
||||
P_ALL: int
|
||||
WEXITED: int
|
||||
WNOWAIT: int
|
||||
|
||||
if sys.version_info >= (3, 3):
|
||||
def sync() -> None: ... # Unix only
|
||||
|
||||
def truncate(path: Union[_PathType, int], length: int) -> None: ... # Unix only up to version 3.4
|
||||
|
||||
def fwalk(top: AnyStr = ..., topdown: bool = ...,
|
||||
onerror: Callable = ..., *, follow_symlinks: bool = ...,
|
||||
dir_fd: int = ...) -> Iterator[Tuple[AnyStr, List[AnyStr],
|
||||
List[AnyStr], int]]: ... # Unix only
|
||||
|
||||
terminal_size = NamedTuple('terminal_size', [('columns', int), ('lines', int)])
|
||||
def get_terminal_size(fd: int = ...) -> terminal_size: ...
|
||||
|
||||
if sys.version_info >= (3, 4):
|
||||
def cpu_count() -> Optional[int]: ...
|
||||
def getloadavg() -> Tuple[float, float, float]: ... # Unix only
|
||||
def sysconf(name: Union[str, int]) -> int: ... # Unix only
|
||||
if sys.version_info >= (3, 6):
|
||||
def getrandom(size: int, flags: int = ...) -> bytes: ...
|
||||
def urandom(size: int) -> bytes: ...
|
||||
else:
|
||||
def urandom(n: int) -> bytes: ...
|
||||
|
||||
@@ -11,8 +11,8 @@ class Template:
|
||||
def debug(self, flag: bool) -> None: ...
|
||||
def append(self, cmd: str, kind: str) -> None: ...
|
||||
def prepend(self, cmd: str, kind: str) -> None: ...
|
||||
def open(self, file: str, rw: str) -> os.popen: ...
|
||||
def copy(self, file: str, rw: str) -> os.popen: ...
|
||||
def open(self, file: str, rw: str) -> os._wrap_close: ...
|
||||
def copy(self, file: str, rw: str) -> os._wrap_close: ...
|
||||
|
||||
# Not documented, but widely used.
|
||||
# Documented as shlex.quote since 3.3.
|
||||
|
||||
@@ -10,3 +10,23 @@ from typing import NamedTuple
|
||||
if sys.version_info >= (3, 3):
|
||||
uname_result = NamedTuple('uname_result', [('sysname', str), ('nodename', str),
|
||||
('release', str), ('version', str), ('machine', str)])
|
||||
|
||||
times_result = NamedTuple('times_result', [
|
||||
('user', float),
|
||||
('system', float),
|
||||
('children_user', float),
|
||||
('children_system', float),
|
||||
('elapsed', float),
|
||||
])
|
||||
|
||||
waitid_result = NamedTuple('waitid_result', [
|
||||
('si_pid', int),
|
||||
('si_uid', int),
|
||||
('si_signo', int),
|
||||
('si_status', int),
|
||||
('si_code', int),
|
||||
])
|
||||
|
||||
sched_param = NamedTuple('sched_priority', [
|
||||
('sched_priority', int),
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user