mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-06-23 09:18:44 +08:00
[psutil] Complete common POSIX logic (#15094)
This commit is contained in:
@@ -108,5 +108,5 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
|
||||
def open_files(self) -> list[_common.popenfile]: ...
|
||||
def num_fds(self) -> int: ...
|
||||
def num_ctx_switches(self) -> _common.pctxsw: ...
|
||||
def wait(self, timeout: float | None = None): ...
|
||||
def wait(self, timeout: float | None = None) -> int | None: ...
|
||||
def io_counters(self) -> _common.pio: ...
|
||||
|
||||
@@ -177,7 +177,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
|
||||
def num_ctx_switches(self) -> _common.pctxsw: ...
|
||||
def threads(self) -> list[_common.pthread]: ...
|
||||
def net_connections(self, kind: str = "inet") -> list[_common.pconn]: ...
|
||||
def wait(self, timeout: float | None = None): ...
|
||||
def wait(self, timeout: float | None = None) -> int | None: ...
|
||||
def nice_get(self) -> int: ...
|
||||
def nice_set(self, value: int) -> None: ...
|
||||
def status(self) -> str: ...
|
||||
|
||||
@@ -260,7 +260,7 @@ if sys.platform == "linux":
|
||||
def io_counters(self) -> pio: ...
|
||||
def cpu_times(self) -> pcputimes: ...
|
||||
def cpu_num(self) -> int: ...
|
||||
def wait(self, timeout: float | None = None): ...
|
||||
def wait(self, timeout: float | None = None) -> int | None: ...
|
||||
def create_time(self, monotonic: bool = False) -> float: ...
|
||||
def memory_info(self) -> pmem: ...
|
||||
def memory_full_info(self) -> pfullmem: ...
|
||||
|
||||
@@ -110,7 +110,7 @@ if sys.platform == "darwin":
|
||||
def open_files(self) -> list[_common.popenfile]: ...
|
||||
def net_connections(self, kind: str = "inet"): ...
|
||||
def num_fds(self) -> int: ...
|
||||
def wait(self, timeout: float | None = None): ...
|
||||
def wait(self, timeout: float | None = None) -> int | None: ...
|
||||
def nice_get(self): ...
|
||||
def nice_set(self, value): ...
|
||||
def status(self) -> str: ...
|
||||
|
||||
@@ -1,19 +1,73 @@
|
||||
import enum
|
||||
import sys
|
||||
from _typeshed import FileDescriptorOrPath, StrOrBytesPath
|
||||
from _typeshed import FileDescriptorOrPath, Incomplete, StrOrBytesPath, Unused
|
||||
from collections.abc import Callable
|
||||
|
||||
from ._common import sdiskusage
|
||||
|
||||
def pid_exists(pid: int) -> bool: ...
|
||||
|
||||
# Sync with `signal.Signals`, but with opposite values:
|
||||
class Negsignal(enum.IntEnum):
|
||||
SIGABRT = -6
|
||||
SIGFPE = -8
|
||||
SIGILL = -4
|
||||
SIGINT = -2
|
||||
SIGSEGV = -11
|
||||
SIGTERM = -15
|
||||
|
||||
if sys.platform == "win32":
|
||||
SIGBREAK = -21
|
||||
CTRL_C_EVENT = 0
|
||||
CTRL_BREAK_EVENT = -1
|
||||
else:
|
||||
SIGALRM = -14
|
||||
SIGBUS = -7
|
||||
SIGCHLD = -17
|
||||
SIGCONT = -18
|
||||
SIGHUP = -1
|
||||
SIGIO = -29
|
||||
SIGIOT = -6
|
||||
SIGKILL = -9
|
||||
SIGPIPE = -13
|
||||
SIGPROF = -27
|
||||
SIGQUIT = -3
|
||||
SIGSTOP = -19
|
||||
SIGSYS = -31
|
||||
SIGTRAP = -5
|
||||
SIGTSTP = -20
|
||||
SIGTTIN = -21
|
||||
SIGTTOU = -22
|
||||
SIGURG = -23
|
||||
SIGUSR1 = -10
|
||||
SIGUSR2 = -12
|
||||
SIGVTALRM = -26
|
||||
SIGWINCH = -28
|
||||
SIGXCPU = -24
|
||||
SIGXFSZ = -25
|
||||
if sys.platform != "linux":
|
||||
SIGEMT = -7
|
||||
SIGINFO = -29
|
||||
if sys.platform != "darwin":
|
||||
SIGCLD = -17
|
||||
SIGPOLL = -29
|
||||
SIGPWR = -30
|
||||
SIGRTMAX = -64
|
||||
SIGRTMIN = -34
|
||||
if sys.version_info >= (3, 11):
|
||||
SIGSTKFLT = -16
|
||||
|
||||
def negsig_to_enum(num: int) -> int: ...
|
||||
def wait_pid(
|
||||
pid: int,
|
||||
timeout: float | None = None,
|
||||
proc_name: str | None = None,
|
||||
_waitpid=...,
|
||||
_timer=...,
|
||||
_min=...,
|
||||
_sleep=...,
|
||||
_pid_exists=...,
|
||||
): ...
|
||||
_waitpid: Unused = ...,
|
||||
_timer: Callable[[], float] = ...,
|
||||
_min: Callable[..., Incomplete] = ...,
|
||||
_sleep: Callable[[float], None] = ...,
|
||||
_pid_exists: Callable[[int], bool] = ...,
|
||||
) -> int | None: ...
|
||||
|
||||
if sys.platform == "darwin":
|
||||
def disk_usage(path: StrOrBytesPath) -> sdiskusage: ...
|
||||
|
||||
@@ -148,4 +148,4 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
|
||||
def memory_maps(self) -> list[tuple[str, str, str, int, int, int]]: ...
|
||||
def num_fds(self) -> int: ...
|
||||
def num_ctx_switches(self) -> _common.pctxsw: ...
|
||||
def wait(self, timeout: float | None = None): ...
|
||||
def wait(self, timeout: float | None = None) -> int | None: ...
|
||||
|
||||
@@ -7,7 +7,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
|
||||
AF_LINK: Final = 18
|
||||
|
||||
def getpagesize() -> int: ...
|
||||
def net_if_addrs(): ...
|
||||
def net_if_addrs() -> list[tuple[str, int, str, str | None, str | None, str | None]]: ...
|
||||
def net_if_flags(nic_name: str, /) -> list[str]: ...
|
||||
def net_if_is_running(nic_name: str, /) -> bool: ...
|
||||
def net_if_mtu(nic_name: str, /) -> int: ...
|
||||
|
||||
@@ -23,13 +23,13 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
|
||||
RLIM_INFINITY: Final[int] # only FreeBSD
|
||||
|
||||
def getpagesize() -> int: ...
|
||||
def net_if_addrs(): ...
|
||||
def net_if_addrs() -> list[tuple[str, int, str, str | None, str | None, str | None]]: ...
|
||||
def net_if_flags(nic_name: str, /) -> list[str]: ...
|
||||
def net_if_is_running(nic_name: str, /) -> bool: ...
|
||||
def net_if_mtu(nic_name: str, /) -> int: ...
|
||||
def proc_priority_get(pid: int, /) -> int: ...
|
||||
def proc_priority_set(pid: int, priority: int, /) -> None: ...
|
||||
def net_if_duplex_speed(nic_name: str, /): ...
|
||||
def net_if_duplex_speed(nic_name: str, /) -> tuple[int, int]: ... # It's actually list of 2 elements
|
||||
def proc_is_zombie(pid: int, /) -> bool: ...
|
||||
|
||||
version: Final[int]
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import sys
|
||||
|
||||
if sys.platform == "linux":
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Sequence
|
||||
from typing import Final
|
||||
|
||||
@@ -24,13 +23,13 @@ if sys.platform == "linux":
|
||||
RLIM_INFINITY: Final[int]
|
||||
|
||||
def getpagesize() -> int: ...
|
||||
def net_if_addrs(): ...
|
||||
def net_if_addrs() -> list[tuple[str, int, str, str | None, str | None, str | None]]: ...
|
||||
def net_if_flags(nic_name: str, /) -> list[str]: ...
|
||||
def net_if_is_running(nic_name: str, /) -> bool: ...
|
||||
def net_if_mtu(nic_name: str, /) -> int: ...
|
||||
def proc_priority_get(pid: int, /) -> int: ...
|
||||
def proc_priority_set(pid: int, priority: int, /) -> None: ...
|
||||
def users() -> list[tuple[Incomplete, ...]]: ...
|
||||
def users() -> list[tuple[str, str, str, float, int]]: ...
|
||||
|
||||
version: Final[int]
|
||||
DUPLEX_FULL: Final[int]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
|
||||
if sys.platform == "darwin":
|
||||
from _typeshed import Incomplete, StrOrBytesPath
|
||||
from _typeshed import StrOrBytesPath
|
||||
from collections.abc import Sequence
|
||||
from socket import AddressFamily, SocketKind
|
||||
from typing import Final, TypeVar
|
||||
@@ -11,14 +11,14 @@ if sys.platform == "darwin":
|
||||
AF_LINK: Final = 18
|
||||
|
||||
def getpagesize() -> int: ...
|
||||
def net_if_addrs(): ...
|
||||
def net_if_addrs() -> list[tuple[str, int, str, str | None, str | None, str | None]]: ...
|
||||
def net_if_flags(nic_name: str, /) -> list[str]: ...
|
||||
def net_if_is_running(nic_name: str, /) -> bool: ...
|
||||
def net_if_mtu(nic_name: str, /) -> int: ...
|
||||
def proc_priority_get(pid: int, /) -> int: ...
|
||||
def proc_priority_set(pid: int, priority: int, /) -> None: ...
|
||||
def net_if_duplex_speed(nic_name: str, /): ...
|
||||
def users() -> list[tuple[Incomplete, ...]]: ...
|
||||
def net_if_duplex_speed(nic_name: str, /) -> tuple[int, int]: ... # It's actually list of 2 elements
|
||||
def users() -> list[tuple[str, str, str, float, int]]: ...
|
||||
def proc_is_zombie(pid: int, /) -> bool: ...
|
||||
|
||||
version: Final[int]
|
||||
|
||||
@@ -2,19 +2,18 @@ import sys
|
||||
|
||||
# sys.platform.startswith(("sunos", "solaris")):
|
||||
if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
|
||||
from _typeshed import Incomplete
|
||||
from typing import Final
|
||||
|
||||
AF_LINK: Final[int]
|
||||
|
||||
def getpagesize() -> int: ...
|
||||
def net_if_addrs(): ...
|
||||
def net_if_addrs() -> list[tuple[str, int, str, str | None, str | None, str | None]]: ...
|
||||
def net_if_flags(nic_name: str, /) -> list[str]: ...
|
||||
def net_if_is_running(nic_name: str, /) -> bool: ...
|
||||
def net_if_mtu(nic_name: str, /) -> int: ...
|
||||
def proc_priority_get(pid: int, /) -> int: ...
|
||||
def proc_priority_set(pid: int, priority: int, /) -> None: ...
|
||||
def users() -> list[tuple[Incomplete, ...]]: ...
|
||||
def users() -> list[tuple[str, str, str, float, int]]: ...
|
||||
|
||||
version: Final[int]
|
||||
# They could be different between different versions of SunOS/Solaris:
|
||||
|
||||
Reference in New Issue
Block a user