diff --git a/stubs/psutil/@tests/stubtest_allowlist.txt b/stubs/psutil/@tests/stubtest_allowlist.txt index de51b72de935..049382cd3acd 100644 --- a/stubs/psutil/@tests/stubtest_allowlist.txt +++ b/stubs/psutil/@tests/stubtest_allowlist.txt @@ -5,6 +5,9 @@ psutil.__all__ psutil._psaix psutil._psbsd psutil._pssunos +psutil._psutil_aix +psutil._psutil_bsd +psutil._psutil_sunos # Test utilities psutil.tests.* diff --git a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt index d90126c03a35..2606ecbdf50b 100644 --- a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt +++ b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt @@ -1,7 +1,7 @@ psutil._pslinux +psutil._pswindows psutil._psutil_linux psutil._psutil_windows -psutil._pswindows # not always available on ARM64, but we test there psutil.cpu_freq diff --git a/stubs/psutil/@tests/stubtest_allowlist_linux.txt b/stubs/psutil/@tests/stubtest_allowlist_linux.txt index eb279310d6d0..5433c30009cc 100644 --- a/stubs/psutil/@tests/stubtest_allowlist_linux.txt +++ b/stubs/psutil/@tests/stubtest_allowlist_linux.txt @@ -1,4 +1,4 @@ psutil._psosx -psutil._psutil_windows -psutil._psutil_osx psutil._pswindows +psutil._psutil_osx +psutil._psutil_windows diff --git a/stubs/psutil/@tests/stubtest_allowlist_win32.txt b/stubs/psutil/@tests/stubtest_allowlist_win32.txt index 0f1f95fa109b..1e781db20233 100644 --- a/stubs/psutil/@tests/stubtest_allowlist_win32.txt +++ b/stubs/psutil/@tests/stubtest_allowlist_win32.txt @@ -1,5 +1,4 @@ -psutil._pslinux psutil._psosx -psutil._psutil_linux +psutil._pslinux psutil._psutil_osx -psutil._psutil_posix +psutil._psutil_linux diff --git a/stubs/psutil/METADATA.toml b/stubs/psutil/METADATA.toml index 35f15a689034..bc7195f02d42 100644 --- a/stubs/psutil/METADATA.toml +++ b/stubs/psutil/METADATA.toml @@ -1,4 +1,4 @@ -version = "7.1.1" +version = "7.1.3" upstream_repository = "https://github.com/giampaolo/psutil" [tool.stubtest] diff --git a/stubs/psutil/psutil/_psbsd.pyi b/stubs/psutil/psutil/_psbsd.pyi index 74a40361527d..f6a74618c733 100644 --- a/stubs/psutil/psutil/_psbsd.pyi +++ b/stubs/psutil/psutil/_psbsd.pyi @@ -111,7 +111,6 @@ INIT_BOOT_TIME: float def adjust_proc_create_time(ctime: float) -> float: ... def pids(): ... def pid_exists(pid): ... -def is_zombie(pid): ... def wrap_exceptions(fun): ... def wrap_exceptions_procfs(inst) -> AbstractContextManager[None]: ... diff --git a/stubs/psutil/psutil/_psosx.pyi b/stubs/psutil/psutil/_psosx.pyi index 1c74d57bb570..cff4e93ea9b3 100644 --- a/stubs/psutil/psutil/_psosx.pyi +++ b/stubs/psutil/psutil/_psosx.pyi @@ -18,7 +18,7 @@ if sys.platform == "darwin": usage_percent as usage_percent, ) - from . import _common, _psposix, _psutil_osx, _psutil_posix + from . import _common, _psposix, _psutil_osx _P = ParamSpec("_P") _R = TypeVar("_R") @@ -75,7 +75,7 @@ if sys.platform == "darwin": def sensors_battery() -> _common.sbattery | None: ... net_io_counters = _psutil_osx.net_io_counters - net_if_addrs = _psutil_posix.net_if_addrs + net_if_addrs = _psutil_osx.net_if_addrs def net_connections(kind: str = "inet") -> list[_common.sconn]: ... def net_if_stats() -> dict[str, _common.snicstats]: ... def boot_time() -> float: ... @@ -85,7 +85,6 @@ if sys.platform == "darwin": def pids() -> list[int]: ... pid_exists = _psposix.pid_exists def wrap_exceptions(fun: Callable[_P, _R]) -> Callable[_P, _R]: ... - def is_zombie(pid: int) -> bool: ... class Process: __slots__ = ["_cache", "_name", "_ppid", "pid"] diff --git a/stubs/psutil/psutil/_psutil_aix.pyi b/stubs/psutil/psutil/_psutil_aix.pyi new file mode 100644 index 000000000000..654cf7691924 --- /dev/null +++ b/stubs/psutil/psutil/_psutil_aix.pyi @@ -0,0 +1,53 @@ +from _typeshed import Incomplete + +# TODO: Add POSIX constants and check their aviability (see psutil_posix_add_constants) +AF_LINK: Incomplete + +def getpagesize() -> int: ... +def net_if_addrs(): ... +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: ... + +version: Incomplete +SIDL: Incomplete +SZOMB: Incomplete +SACTIVE: Incomplete +SSWAP: Incomplete +SSTOP: Incomplete +TCPS_CLOSED: Incomplete +TCPS_CLOSING: Incomplete +TCPS_CLOSE_WAIT: Incomplete +TCPS_LISTEN: Incomplete +TCPS_ESTABLISHED: Incomplete +TCPS_SYN_SENT: Incomplete +TCPS_SYN_RCVD: Incomplete +TCPS_FIN_WAIT_1: Incomplete +TCPS_FIN_WAIT_2: Incomplete +TCPS_LAST_ACK: Incomplete +TCPS_TIME_WAIT: Incomplete +PSUTIL_CONN_NONE: Incomplete + +def proc_args(pid: int, /) -> list[str]: ... +def proc_basic_info(pid: int, procfs_path: str, /): ... +def proc_cpu_times(pid: int, procfs_path: str, /): ... +def proc_cred(pid: int, procfs_path: str, /): ... +def proc_environ(pid: int, /): ... +def proc_name(pid: int, procfs_path: str, /): ... +def proc_threads(pid: int, /): ... +def proc_io_counters(pid: int, /): ... +def proc_num_ctx_switches(requested_pid: int, /): ... +def boot_time(): ... +def disk_io_counters(): ... +def disk_partitions(): ... +def per_cpu_times(): ... +def swap_mem(): ... +def virtual_mem(): ... +def net_io_counters(): ... +def cpu_stats(): ... +def net_connections(requested_pid: int, /): ... +def net_if_stats(nic_name: str, /): ... +def check_pid_range(pid: int, /) -> None: ... +def set_debug(value: bool, /) -> None: ... diff --git a/stubs/psutil/psutil/_psutil_bsd.pyi b/stubs/psutil/psutil/_psutil_bsd.pyi new file mode 100644 index 000000000000..8d080e7564d0 --- /dev/null +++ b/stubs/psutil/psutil/_psutil_bsd.pyi @@ -0,0 +1,73 @@ +from _typeshed import Incomplete + +# TODO: Add POSIX constants and check their aviability (see psutil_posix_add_constants) +AF_LINK: Incomplete + +def getpagesize() -> int: ... +def net_if_addrs(): ... +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 proc_is_zombie(pid: int, /) -> bool: ... + +SIDL: Incomplete +SRUN: Incomplete +SSLEEP: Incomplete +SSTOP: Incomplete +SZOMB: Incomplete +SWAIT: Incomplete # only FreeBSD +SLOCK: Incomplete # only FreeBSD +SDEAD: Incomplete # only OpenBSD and NetBSD +SONPROC: Incomplete # only OpenBSD and NetBSD +SSUSPENDED: Incomplete # only NetBSD +TCPS_CLOSED: Incomplete +TCPS_CLOSING: Incomplete +TCPS_CLOSE_WAIT: Incomplete +TCPS_LISTEN: Incomplete +TCPS_ESTABLISHED: Incomplete +TCPS_SYN_SENT: Incomplete +TCPS_SYN_RECEIVED: Incomplete +TCPS_FIN_WAIT_1: Incomplete +TCPS_FIN_WAIT_2: Incomplete +TCPS_LAST_ACK: Incomplete +TCPS_TIME_WAIT: Incomplete +PSUTIL_CONN_NONE: Incomplete + +def proc_cmdline(*args, **kwargs): ... +def proc_cwd(*args, **kwargs): ... +def proc_environ(*args, **kwargs): ... +def proc_name(*args, **kwargs): ... +def proc_num_fds(*args, **kwargs): ... +def proc_oneshot_info(*args, **kwargs): ... +def proc_open_files(*args, **kwargs): ... +def proc_threads(*args, **kwargs): ... +def proc_num_threads(*args, **kwargs): ... # only FreeBSD and OpenBSD +def proc_cpu_affinity_get(*args, **kwargs): ... # only FreeBSD +def proc_cpu_affinity_set(*args, **kwargs): ... # only FreeBSD +def proc_exe(*args, **kwargs): ... # only FreeBSD +def proc_getrlimit(*args, **kwargs): ... # only FreeBSD +def proc_memory_maps(*args, **kwargs): ... # only FreeBSD +def proc_net_connections(*args, **kwargs): ... # only FreeBSD +def proc_setrlimit(*args, **kwargs): ... # only FreeBSD +def boot_time(*args, **kwargs): ... +def cpu_count_logical(*args, **kwargs): ... +def cpu_stats(*args, **kwargs): ... +def cpu_times(*args, **kwargs): ... +def disk_io_counters(*args, **kwargs): ... +def disk_partitions(*args, **kwargs): ... +def net_connections(*args, **kwargs): ... +def net_io_counters(*args, **kwargs): ... +def per_cpu_times(*args, **kwargs): ... +def pids(*args, **kwargs): ... +def swap_mem(*args, **kwargs): ... +def users(*args, **kwargs): ... +def virtual_mem(*args, **kwargs): ... +def cpu_freq(*args, **kwargs): ... # only FreeBSD and OpenBSD +def cpu_topology(*args, **kwargs): ... # only FreeBSD +def sensors_battery(*args, **kwargs): ... # only FreeBSD +def sensors_cpu_temperature(*args, **kwargs): ... # only FreeBSD +def check_pid_range(*args, **kwargs): ... +def set_debug(*args, **kwargs): ... diff --git a/stubs/psutil/psutil/_psutil_linux.pyi b/stubs/psutil/psutil/_psutil_linux.pyi index 41f661385762..2c44a4cd5ded 100644 --- a/stubs/psutil/psutil/_psutil_linux.pyi +++ b/stubs/psutil/psutil/_psutil_linux.pyi @@ -1,14 +1,45 @@ +from _typeshed import Incomplete +from typing import Final + +# TODO: Add POSIX constants and check their aviability (see psutil_posix_add_constants) +RLIM_INFINITY: Final[int] +RLIMIT_AS: Final[int] +RLIMIT_CORE: Final[int] +RLIMIT_CPU: Final[int] +RLIMIT_DATA: Final[int] +RLIMIT_FSIZE: Final[int] +RLIMIT_LOCKS: Final[int] +RLIMIT_MEMLOCK: Final[int] +RLIMIT_MSGQUEUE: Final[int] +RLIMIT_NICE: Final[int] +RLIMIT_NOFILE: Final[int] +RLIMIT_NPROC: Final[int] +RLIMIT_RSS: Final[int] +RLIMIT_RTPRIO: Final[int] +RLIMIT_RTTIME: Final[int] +RLIMIT_SIGPENDING: Final[int] +RLIMIT_STACK: Final[int] + +def getpagesize() -> int: ... +def net_if_addrs(): ... +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, ...]]: ... + +version: int DUPLEX_FULL: int DUPLEX_HALF: int DUPLEX_UNKNOWN: int -version: int -def check_pid_range(pid: int, /) -> None: ... -def disk_partitions(*args, **kwargs): ... -def linux_sysinfo(*args, **kwargs): ... -def net_if_duplex_speed(*args, **kwargs): ... -def proc_cpu_affinity_get(*args, **kwargs): ... -def proc_cpu_affinity_set(*args, **kwargs): ... -def proc_ioprio_get(*args, **kwargs): ... +def proc_ioprio_get(pid: int, /): ... def proc_ioprio_set(*args, **kwargs): ... -def set_debug(*args, **kwargs): ... +def proc_cpu_affinity_get(pid: int, /): ... +def proc_cpu_affinity_set(*args, **kwargs): ... +def disk_partitions(mtab_path: str, /): ... +def net_if_duplex_speed(nic_name: str, /): ... +def linux_sysinfo() -> tuple[int, int, int, int, int, int, int]: ... +def check_pid_range(pid: int, /) -> None: ... +def set_debug(value: bool, /) -> None: ... diff --git a/stubs/psutil/psutil/_psutil_osx.pyi b/stubs/psutil/psutil/_psutil_osx.pyi index 2b27ee37863d..712d0fa93401 100644 --- a/stubs/psutil/psutil/_psutil_osx.pyi +++ b/stubs/psutil/psutil/_psutil_osx.pyi @@ -1,13 +1,27 @@ import sys if sys.platform == "darwin": - from _typeshed import StrOrBytesPath + from _typeshed import Incomplete, StrOrBytesPath from collections.abc import Sequence from socket import AddressFamily, SocketKind from typing import Final, TypeVar _T = TypeVar("_T") + # TODO: Add POSIX constants and check their aviability (see psutil_posix_add_constants) + AF_LINK: Incomplete + + def getpagesize() -> int: ... + def net_if_addrs(): ... + 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 proc_is_zombie(pid: int, /) -> bool: ... + version: Final[int] SIDL: Final = 1 SRUN: Final = 2 diff --git a/stubs/psutil/psutil/_psutil_posix.pyi b/stubs/psutil/psutil/_psutil_posix.pyi deleted file mode 100644 index 42ab74cb09e0..000000000000 --- a/stubs/psutil/psutil/_psutil_posix.pyi +++ /dev/null @@ -1,36 +0,0 @@ -import sys -from _typeshed import Incomplete -from typing import Final - -if sys.platform == "linux": - RLIMIT_AS: Final[int] - RLIMIT_CORE: Final[int] - RLIMIT_CPU: Final[int] - RLIMIT_DATA: Final[int] - RLIMIT_FSIZE: Final[int] - RLIMIT_LOCKS: Final[int] - RLIMIT_MEMLOCK: Final[int] - RLIMIT_MSGQUEUE: Final[int] - RLIMIT_NICE: Final[int] - RLIMIT_NOFILE: Final[int] - RLIMIT_NPROC: Final[int] - RLIMIT_RSS: Final[int] - RLIMIT_RTPRIO: Final[int] - RLIMIT_RTTIME: Final[int] - RLIMIT_SIGPENDING: Final[int] - RLIMIT_STACK: Final[int] - RLIM_INFINITY: Final[int] - -def getpagesize() -> int: ... -def getpriority(pid: int, /) -> int: ... -def net_if_addrs() -> list[tuple[str, int, str | None, 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: ... - -if sys.platform == "darwin": - AF_LINK: Final[int] - def net_if_duplex_speed(nic_name: str, /) -> list[int]: ... - -def users() -> list[tuple[Incomplete, ...]]: ... -def setpriority(pid: int, priority: int, /) -> None: ... diff --git a/stubs/psutil/psutil/_psutil_sunos.pyi b/stubs/psutil/psutil/_psutil_sunos.pyi new file mode 100644 index 000000000000..9539ebed9f37 --- /dev/null +++ b/stubs/psutil/psutil/_psutil_sunos.pyi @@ -0,0 +1,59 @@ +from _typeshed import Incomplete + +# TODO: Add POSIX constants and check their aviability (see psutil_posix_add_constants) +AF_LINK: Incomplete + +def getpagesize() -> int: ... +def net_if_addrs(): ... +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, ...]]: ... + +version: Incomplete +SSLEEP: Incomplete +SRUN: Incomplete +SZOMB: Incomplete +SSTOP: Incomplete +SIDL: Incomplete +SONPROC: Incomplete +SWAIT: Incomplete +PRNODEV: Incomplete +TCPS_CLOSED: Incomplete +TCPS_CLOSING: Incomplete +TCPS_CLOSE_WAIT: Incomplete +TCPS_LISTEN: Incomplete +TCPS_ESTABLISHED: Incomplete +TCPS_SYN_SENT: Incomplete +TCPS_SYN_RCVD: Incomplete +TCPS_FIN_WAIT_1: Incomplete +TCPS_FIN_WAIT_2: Incomplete +TCPS_LAST_ACK: Incomplete +TCPS_TIME_WAIT: Incomplete +TCPS_IDLE: Incomplete +TCPS_BOUND: Incomplete +PSUTIL_CONN_NONE: Incomplete + +def proc_basic_info(pid: int, procfs_path: str, /) -> tuple[Incomplete, ...]: ... +def proc_cpu_num(pid: int, procfs_path: str, /): ... +def proc_cpu_times(pid: int, procfs_path: str, /): ... +def proc_cred(pid: int, procfs_path: str, /): ... +def proc_environ(pid: int, procfs_path: str, /): ... +def proc_memory_maps(pid: int, procfs_path: str, /): ... +def proc_name_and_args(pid: int, procfs_path: str, /): ... +def proc_num_ctx_switches(pid: int, procfs_path: str, /): ... +def query_process_thread(pid: int, tid: int, procfs_path: str, /): ... +def boot_time(): ... +def cpu_count_cores(): ... +def cpu_stats(): ... +def disk_io_counters(): ... +def disk_partitions(): ... +def net_connections(pid: int, /): ... +def net_if_stats(): ... +def net_io_counters(): ... +def per_cpu_times(): ... +def swap_mem(): ... +def check_pid_range(pid: int, /): ... +def set_debug(value: bool, /) -> None: ...