From 75a74ffb6c09b49bc4bae08fc6dc5ea8beed23fc Mon Sep 17 00:00:00 2001 From: Avasam Date: Sat, 12 Nov 2022 19:35:14 -0500 Subject: [PATCH] Run stubtest for psutil on all platforms (#9169) --- stubs/psutil/@tests/stubtest_allowlist.txt | 15 +- .../@tests/stubtest_allowlist_darwin.txt | 4 + .../@tests/stubtest_allowlist_linux.txt | 4 + .../@tests/stubtest_allowlist_win32.txt | 6 + stubs/psutil/METADATA.toml | 4 + stubs/psutil/psutil/__init__.pyi | 67 ++++----- stubs/psutil/psutil/_common.pyi | 6 +- stubs/psutil/psutil/_compat.pyi | 18 +++ stubs/psutil/psutil/_psaix.pyi | 104 ++++++++++++++ stubs/psutil/psutil/_psbsd.pyi | 2 +- stubs/psutil/psutil/_pslinux.pyi | 16 ++- stubs/psutil/psutil/_psosx.pyi | 2 +- stubs/psutil/psutil/_pssunos.pyi | 135 ++++++++++++++++++ stubs/psutil/psutil/_psutil_linux.pyi | 1 + stubs/psutil/psutil/_psutil_osx.pyi | 52 +++++++ stubs/psutil/psutil/_psutil_posix.pyi | 3 + stubs/psutil/psutil/_psutil_windows.pyi | 91 +++++++++++- stubs/psutil/psutil/_pswindows.pyi | 6 +- 18 files changed, 485 insertions(+), 51 deletions(-) create mode 100644 stubs/psutil/@tests/stubtest_allowlist_darwin.txt create mode 100644 stubs/psutil/@tests/stubtest_allowlist_linux.txt create mode 100644 stubs/psutil/@tests/stubtest_allowlist_win32.txt create mode 100644 stubs/psutil/psutil/_psaix.pyi create mode 100644 stubs/psutil/psutil/_pssunos.pyi create mode 100644 stubs/psutil/psutil/_psutil_osx.pyi diff --git a/stubs/psutil/@tests/stubtest_allowlist.txt b/stubs/psutil/@tests/stubtest_allowlist.txt index 1f62a50cb..0b6e1ce09 100644 --- a/stubs/psutil/@tests/stubtest_allowlist.txt +++ b/stubs/psutil/@tests/stubtest_allowlist.txt @@ -1,4 +1,13 @@ +# These super() dunders don't seem to be particularly useful, +# and having them pop up on autocomplete suggestions would be annoying +psutil._compat.super.__self__ +psutil._compat.super.__self_class__ +psutil._compat.super.__thisclass__ + +# Stubtest does not support these platforms +psutil._psaix psutil._psbsd -psutil._psosx -psutil._psutil_windows -psutil._pswindows +psutil._pssunos + +# Test utilities +psutil.tests.* diff --git a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt new file mode 100644 index 000000000..4cf5ba5d3 --- /dev/null +++ b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt @@ -0,0 +1,4 @@ +psutil._pslinux +psutil._psutil_linux +psutil._psutil_windows +psutil._pswindows diff --git a/stubs/psutil/@tests/stubtest_allowlist_linux.txt b/stubs/psutil/@tests/stubtest_allowlist_linux.txt new file mode 100644 index 000000000..eb279310d --- /dev/null +++ b/stubs/psutil/@tests/stubtest_allowlist_linux.txt @@ -0,0 +1,4 @@ +psutil._psosx +psutil._psutil_windows +psutil._psutil_osx +psutil._pswindows diff --git a/stubs/psutil/@tests/stubtest_allowlist_win32.txt b/stubs/psutil/@tests/stubtest_allowlist_win32.txt new file mode 100644 index 000000000..4fa870ef8 --- /dev/null +++ b/stubs/psutil/@tests/stubtest_allowlist_win32.txt @@ -0,0 +1,6 @@ +psutil._pslinux +psutil._psosx + +psutil._psutil_linux +psutil._psutil_osx +psutil._psutil_posix diff --git a/stubs/psutil/METADATA.toml b/stubs/psutil/METADATA.toml index 96a1afa55..245a0dec8 100644 --- a/stubs/psutil/METADATA.toml +++ b/stubs/psutil/METADATA.toml @@ -1 +1,5 @@ version = "5.9.*" + +[tool.stubtest] +ignore_missing_stub = false +platforms = ["win32", "linux", "darwin"] diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi index 2ffb5465f..ba93204d9 100644 --- a/stubs/psutil/psutil/__init__.pyi +++ b/stubs/psutil/psutil/__init__.pyi @@ -5,7 +5,7 @@ from contextlib import AbstractContextManager from typing import Any, overload from typing_extensions import Literal, TypeAlias -from ._common import ( +from psutil._common import ( AIX as AIX, BSD as BSD, CONN_CLOSE as CONN_CLOSE, @@ -59,7 +59,6 @@ from ._common import ( popenfile, pthread, puids, - sbattery, sconn, scpufreq, scpustats, @@ -82,6 +81,26 @@ if sys.platform == "linux": IOPRIO_CLASS_NONE as IOPRIO_CLASS_NONE, IOPRIO_CLASS_RT as IOPRIO_CLASS_RT, ) + def sensors_temperatures(fahrenheit: bool = ...) -> dict[str, list[shwtemp]]: ... + def sensors_fans() -> dict[str, list[sfan]]: ... + PROCFS_PATH: str + RLIMIT_AS: int + RLIMIT_CORE: int + RLIMIT_CPU: int + RLIMIT_DATA: int + RLIMIT_FSIZE: int + RLIMIT_LOCKS: int + RLIMIT_MEMLOCK: int + RLIMIT_MSGQUEUE: int + RLIMIT_NICE: int + RLIMIT_NOFILE: int + RLIMIT_NPROC: int + RLIMIT_RSS: int + RLIMIT_RTPRIO: int + RLIMIT_RTTIME: int + RLIMIT_SIGPENDING: int + RLIMIT_STACK: int + RLIM_INFINITY: int if sys.platform == "win32": from ._psutil_windows import ( ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS, @@ -102,18 +121,18 @@ if sys.platform == "win32": ) if sys.platform == "linux": - from ._pslinux import pfullmem, pmem, svmem + from ._pslinux import pfullmem, pmem, sensors_battery as sensors_battery, svmem elif sys.platform == "darwin": - from ._psosx import pfullmem, pmem, svmem + from ._psosx import pfullmem, pmem, sensors_battery as sensors_battery, svmem elif sys.platform == "win32": - from ._pswindows import pfullmem, pmem, svmem + from ._pswindows import pfullmem, pmem, sensors_battery as sensors_battery, svmem else: class pmem(Any): ... class pfullmem(Any): ... class svmem(Any): ... -if sys.platform == "linux": - PROCFS_PATH: str + def sensors_battery(): ... + AF_LINK: int version_info: tuple[int, int, int] __version__: str @@ -167,11 +186,10 @@ class Process: if sys.platform != "darwin": def io_counters(self): ... def ionice(self, ioclass: int | None = ..., value: int | None = ...) -> pionice: ... + def cpu_affinity(self, cpus: list[int] | None = ...) -> list[int] | None: ... + def memory_maps(self, grouped: bool = ...): ... if sys.platform == "linux": def rlimit(self, resource: int, limits: tuple[int, int] | None = ...) -> tuple[int, int]: ... - if sys.platform != "darwin": - def cpu_affinity(self, cpus: list[int] | None = ...) -> list[int] | None: ... - if sys.platform == "linux": def cpu_num(self) -> int: ... def environ(self) -> dict[str, str]: ... @@ -188,9 +206,6 @@ class Process: def memory_info_ex(self) -> pmem: ... def memory_full_info(self) -> pfullmem: ... def memory_percent(self, memtype: str = ...) -> float: ... - if sys.platform != "darwin": - def memory_maps(self, grouped: bool = ...): ... - def open_files(self) -> list[popenfile]: ... def connections(self, kind: str = ...) -> list[pconn]: ... def send_signal(self, sig: int) -> None: ... @@ -236,31 +251,5 @@ def net_io_counters(pernic: Literal[True], nowrap: bool = ...) -> dict[str, snet def net_connections(kind: str = ...) -> list[sconn]: ... def net_if_addrs() -> dict[str, list[snicaddr]]: ... def net_if_stats() -> dict[str, snicstats]: ... - -if sys.platform == "linux": - def sensors_temperatures(fahrenheit: bool = ...) -> dict[str, list[shwtemp]]: ... - def sensors_fans() -> dict[str, list[sfan]]: ... - -if sys.platform != "win32": - def sensors_battery() -> sbattery | None: ... - def boot_time() -> float: ... def users() -> list[suser]: ... - -if sys.platform == "linux": - RLIMIT_AS: int - RLIMIT_CORE: int - RLIMIT_CPU: int - RLIMIT_DATA: int - RLIMIT_FSIZE: int - RLIMIT_LOCKS: int - RLIMIT_MEMLOCK: int - RLIMIT_MSGQUEUE: int - RLIMIT_NICE: int - RLIMIT_NOFILE: int - RLIMIT_NPROC: int - RLIMIT_RSS: int - RLIMIT_RTPRIO: int - RLIMIT_SIGPENDING: int - RLIMIT_STACK: int - RLIM_INFINITY: int diff --git a/stubs/psutil/psutil/_common.pyi b/stubs/psutil/psutil/_common.pyi index ecc56984a..a7b2e5b78 100644 --- a/stubs/psutil/psutil/_common.pyi +++ b/stubs/psutil/psutil/_common.pyi @@ -1,7 +1,7 @@ import enum from _typeshed import StrOrBytesPath, SupportsWrite from collections.abc import Callable -from socket import AddressFamily, SocketKind +from socket import AF_INET6 as AF_INET6, AddressFamily, SocketKind from typing import Any, NamedTuple, TypeVar, overload from typing_extensions import Literal @@ -274,6 +274,10 @@ class _WrapNumbers: def cache_info(self): ... def wrap_numbers(input_dict, name: str): ... +def open_binary(fname): ... +def open_text(fname): ... +def cat(fname, fallback=..., _open=...): ... +def bcat(fname, fallback=...): ... def bytes2human(n: int, format: str = ...) -> str: ... def get_procfs_path() -> str: ... def term_supports_colors(file: SupportsWrite[str] = ...) -> bool: ... diff --git a/stubs/psutil/psutil/_compat.pyi b/stubs/psutil/psutil/_compat.pyi index 4031e23fd..410a291fb 100644 --- a/stubs/psutil/psutil/_compat.pyi +++ b/stubs/psutil/psutil/_compat.pyi @@ -5,4 +5,22 @@ from builtins import ( InterruptedError as InterruptedError, PermissionError as PermissionError, ProcessLookupError as ProcessLookupError, + range as range, + super as super, ) +from contextlib import redirect_stderr as redirect_stderr +from functools import lru_cache as lru_cache +from shutil import get_terminal_size as get_terminal_size, which as which +from subprocess import TimeoutExpired +from typing_extensions import Literal + +PY3: Literal[True] +long = int +xrange = range +unicode = str +basestring = str + +def u(s): ... +def b(s): ... + +SubprocessTimeoutExpired = TimeoutExpired diff --git a/stubs/psutil/psutil/_psaix.pyi b/stubs/psutil/psutil/_psaix.pyi new file mode 100644 index 000000000..4b0dabdbe --- /dev/null +++ b/stubs/psutil/psutil/_psaix.pyi @@ -0,0 +1,104 @@ +from _typeshed import Incomplete +from typing import NamedTuple + +from psutil._common import ( + NIC_DUPLEX_FULL as NIC_DUPLEX_FULL, + NIC_DUPLEX_HALF as NIC_DUPLEX_HALF, + NIC_DUPLEX_UNKNOWN as NIC_DUPLEX_UNKNOWN, + AccessDenied as AccessDenied, + NoSuchProcess as NoSuchProcess, + ZombieProcess as ZombieProcess, + conn_to_ntuple as conn_to_ntuple, + get_procfs_path as get_procfs_path, + memoize_when_activated as memoize_when_activated, + usage_percent as usage_percent, +) +from psutil._compat import ( + PY3 as PY3, + FileNotFoundError as FileNotFoundError, + PermissionError as PermissionError, + ProcessLookupError as ProcessLookupError, +) + +__extra__all__: Incomplete +HAS_THREADS: Incomplete +HAS_NET_IO_COUNTERS: Incomplete +HAS_PROC_IO_COUNTERS: Incomplete +PAGE_SIZE: Incomplete +AF_LINK: Incomplete +PROC_STATUSES: Incomplete +TCP_STATUSES: Incomplete +proc_info_map: Incomplete + +class pmem(NamedTuple): + rss: Incomplete + vms: Incomplete + +pfullmem = pmem + +class scputimes(NamedTuple): + user: Incomplete + system: Incomplete + idle: Incomplete + iowait: Incomplete + +class svmem(NamedTuple): + total: Incomplete + available: Incomplete + percent: Incomplete + used: Incomplete + free: Incomplete + +def virtual_memory(): ... +def swap_memory(): ... +def cpu_times(): ... +def per_cpu_times(): ... +def cpu_count_logical(): ... +def cpu_count_cores(): ... +def cpu_stats(): ... + +disk_io_counters: Incomplete +disk_usage: Incomplete + +def disk_partitions(all: bool = ...): ... + +net_if_addrs: Incomplete +net_io_counters: Incomplete + +def net_connections(kind, _pid: int = ...): ... +def net_if_stats(): ... +def boot_time(): ... +def users(): ... +def pids(): ... +def pid_exists(pid): ... +def wrap_exceptions(fun): ... + +class Process: + pid: Incomplete + def __init__(self, pid) -> None: ... + def oneshot_enter(self) -> None: ... + def oneshot_exit(self) -> None: ... + def name(self): ... + def exe(self): ... + def cmdline(self): ... + def environ(self): ... + def create_time(self): ... + def num_threads(self): ... + def threads(self): ... + def connections(self, kind: str = ...): ... + def nice_get(self): ... + def nice_set(self, value): ... + def ppid(self): ... + def uids(self): ... + def gids(self): ... + def cpu_times(self): ... + def terminal(self): ... + def cwd(self): ... + def memory_info(self): ... + memory_full_info: Incomplete + def status(self): ... + def open_files(self): ... + def num_fds(self): ... + def num_ctx_switches(self): ... + def wait(self, timeout: Incomplete | None = ...): ... + def io_counters(self): ... diff --git a/stubs/psutil/psutil/_psbsd.pyi b/stubs/psutil/psutil/_psbsd.pyi index 326025ce0..a967e183e 100644 --- a/stubs/psutil/psutil/_psbsd.pyi +++ b/stubs/psutil/psutil/_psbsd.pyi @@ -1,7 +1,7 @@ from contextlib import AbstractContextManager from typing import Any, NamedTuple -from ._common import ( +from psutil._common import ( FREEBSD as FREEBSD, NETBSD as NETBSD, OPENBSD as OPENBSD, diff --git a/stubs/psutil/psutil/_pslinux.pyi b/stubs/psutil/psutil/_pslinux.pyi index 77efae1e3..68ce9e28d 100644 --- a/stubs/psutil/psutil/_pslinux.pyi +++ b/stubs/psutil/psutil/_pslinux.pyi @@ -1,7 +1,8 @@ import enum +from _typeshed import Incomplete from typing import Any, NamedTuple -from ._common import ( +from psutil._common import ( NIC_DUPLEX_FULL as NIC_DUPLEX_FULL, NIC_DUPLEX_HALF as NIC_DUPLEX_HALF, NIC_DUPLEX_UNKNOWN as NIC_DUPLEX_UNKNOWN, @@ -14,9 +15,12 @@ from ._common import ( supports_ipv6 as supports_ipv6, usage_percent as usage_percent, ) +from psutil._compat import PY3 as PY3 __extra__all__: Any POWER_SUPPLY_PATH: str +HAS_PROC_SMAPS: bool +HAS_PROC_SMAPS_ROLLUP: bool HAS_PROC_IO_PRIORITY: Any HAS_CPU_AFFINITY: Any CLOCK_TICKS: Any @@ -154,6 +158,16 @@ def net_if_stats(): ... disk_usage: Any def disk_io_counters(perdisk: bool = ...): ... + +class RootFsDeviceFinder: + major: Incomplete + minor: Incomplete + def __init__(self) -> None: ... + def ask_proc_partitions(self): ... + def ask_sys_dev_block(self): ... + def ask_sys_class_block(self): ... + def find(self): ... + def disk_partitions(all: bool = ...): ... def sensors_temperatures(): ... def sensors_fans(): ... diff --git a/stubs/psutil/psutil/_psosx.pyi b/stubs/psutil/psutil/_psosx.pyi index 9afe1213c..7dff9aa91 100644 --- a/stubs/psutil/psutil/_psosx.pyi +++ b/stubs/psutil/psutil/_psosx.pyi @@ -1,6 +1,6 @@ from typing import Any, NamedTuple -from ._common import ( +from psutil._common import ( AccessDenied as AccessDenied, NoSuchProcess as NoSuchProcess, ZombieProcess as ZombieProcess, diff --git a/stubs/psutil/psutil/_pssunos.pyi b/stubs/psutil/psutil/_pssunos.pyi new file mode 100644 index 000000000..22767c5f2 --- /dev/null +++ b/stubs/psutil/psutil/_pssunos.pyi @@ -0,0 +1,135 @@ +from _typeshed import Incomplete +from typing import NamedTuple + +from psutil._common import ( + AF_INET6 as AF_INET6, + AccessDenied as AccessDenied, + NoSuchProcess as NoSuchProcess, + ZombieProcess as ZombieProcess, + debug as debug, + get_procfs_path as get_procfs_path, + isfile_strict as isfile_strict, + memoize_when_activated as memoize_when_activated, + sockfam_to_enum as sockfam_to_enum, + socktype_to_enum as socktype_to_enum, + usage_percent as usage_percent, +) +from psutil._compat import ( + PY3 as PY3, + FileNotFoundError as FileNotFoundError, + PermissionError as PermissionError, + ProcessLookupError as ProcessLookupError, + b as b, +) + +__extra__all__: Incomplete +PAGE_SIZE: Incomplete +AF_LINK: Incomplete +IS_64_BIT: Incomplete +CONN_IDLE: str +CONN_BOUND: str +PROC_STATUSES: Incomplete +TCP_STATUSES: Incomplete +proc_info_map: Incomplete + +class scputimes(NamedTuple): + user: Incomplete + system: Incomplete + idle: Incomplete + iowait: Incomplete + +class pcputimes(NamedTuple): + user: Incomplete + system: Incomplete + children_user: Incomplete + children_system: Incomplete + +class svmem(NamedTuple): + total: Incomplete + available: Incomplete + percent: Incomplete + used: Incomplete + free: Incomplete + +class pmem(NamedTuple): + rss: Incomplete + vms: Incomplete + +pfullmem = pmem + +class pmmap_grouped(NamedTuple): + path: Incomplete + rss: Incomplete + anonymous: Incomplete + locked: Incomplete + +pmmap_ext: Incomplete + +def virtual_memory(): ... +def swap_memory(): ... +def cpu_times(): ... +def per_cpu_times(): ... +def cpu_count_logical(): ... +def cpu_count_cores(): ... +def cpu_stats(): ... + +disk_io_counters: Incomplete +disk_usage: Incomplete + +def disk_partitions(all: bool = ...): ... + +net_io_counters: Incomplete +net_if_addrs: Incomplete + +def net_connections(kind, _pid: int = ...): ... +def net_if_stats(): ... +def boot_time(): ... +def users(): ... +def pids(): ... +def pid_exists(pid): ... +def wrap_exceptions(fun): ... + +class Process: + pid: Incomplete + def __init__(self, pid) -> None: ... + def oneshot_enter(self) -> None: ... + def oneshot_exit(self) -> None: ... + def name(self): ... + def exe(self): ... + def cmdline(self): ... + def environ(self): ... + def create_time(self): ... + def num_threads(self): ... + def nice_get(self): ... + def nice_set(self, value): ... + def ppid(self): ... + def uids(self): ... + def gids(self): ... + def cpu_times(self): ... + def cpu_num(self): ... + def terminal(self): ... + def cwd(self): ... + def memory_info(self): ... + memory_full_info: Incomplete + def status(self): ... + def threads(self): ... + def open_files(self): ... + def connections(self, kind: str = ...): ... + + class nt_mmap_grouped(NamedTuple): + path: Incomplete + rss: Incomplete + anon: Incomplete + locked: Incomplete + + class nt_mmap_ext(NamedTuple): + addr: Incomplete + perms: Incomplete + path: Incomplete + rss: Incomplete + anon: Incomplete + locked: Incomplete + def memory_maps(self): ... + def num_fds(self): ... + def num_ctx_switches(self): ... + def wait(self, timeout: Incomplete | None = ...): ... diff --git a/stubs/psutil/psutil/_psutil_linux.pyi b/stubs/psutil/psutil/_psutil_linux.pyi index 4902db44a..d204ef7ae 100644 --- a/stubs/psutil/psutil/_psutil_linux.pyi +++ b/stubs/psutil/psutil/_psutil_linux.pyi @@ -12,4 +12,5 @@ def proc_cpu_affinity_get(*args, **kwargs) -> Any: ... def proc_cpu_affinity_set(*args, **kwargs) -> Any: ... def proc_ioprio_get(*args, **kwargs) -> Any: ... def proc_ioprio_set(*args, **kwargs) -> Any: ... +def set_debug(*args, **kwargs) -> Any: ... def users(*args, **kwargs) -> Any: ... diff --git a/stubs/psutil/psutil/_psutil_osx.pyi b/stubs/psutil/psutil/_psutil_osx.pyi new file mode 100644 index 000000000..2578efca4 --- /dev/null +++ b/stubs/psutil/psutil/_psutil_osx.pyi @@ -0,0 +1,52 @@ +from typing import Any + +PSUTIL_CONN_NONE: int +SIDL: int +SRUN: int +SSLEEP: int +SSTOP: int +SZOMB: int +TCPS_CLOSED: int +TCPS_CLOSE_WAIT: int +TCPS_CLOSING: int +TCPS_ESTABLISHED: int +TCPS_FIN_WAIT_1: int +TCPS_FIN_WAIT_2: int +TCPS_LAST_ACK: int +TCPS_LISTEN: int +TCPS_SYN_RECEIVED: int +TCPS_SYN_SENT: int +TCPS_TIME_WAIT: int +version: int + +class ZombieProcessError(Exception): ... + +def boot_time(*args, **kwargs) -> Any: ... +def cpu_count_cores(*args, **kwargs) -> Any: ... +def cpu_count_logical(*args, **kwargs) -> Any: ... +def cpu_freq(*args, **kwargs) -> Any: ... +def cpu_stats(*args, **kwargs) -> Any: ... +def cpu_times(*args, **kwargs) -> Any: ... +def disk_io_counters(*args, **kwargs) -> Any: ... +def disk_partitions(*args, **kwargs) -> Any: ... +def disk_usage_used(*args, **kwargs) -> Any: ... +def net_io_counters(*args, **kwargs) -> Any: ... +def per_cpu_times(*args, **kwargs) -> Any: ... +def pids(*args, **kwargs) -> Any: ... +def proc_cmdline(*args, **kwargs) -> Any: ... +def proc_connections(*args, **kwargs) -> Any: ... +def proc_cwd(*args, **kwargs) -> Any: ... +def proc_environ(*args, **kwargs) -> Any: ... +def proc_exe(*args, **kwargs) -> Any: ... +def proc_kinfo_oneshot(*args, **kwargs) -> Any: ... +def proc_memory_uss(*args, **kwargs) -> Any: ... +def proc_name(*args, **kwargs) -> Any: ... +def proc_num_fds(*args, **kwargs) -> Any: ... +def proc_open_files(*args, **kwargs) -> Any: ... +def proc_pidtaskinfo_oneshot(*args, **kwargs) -> Any: ... +def proc_threads(*args, **kwargs) -> Any: ... +def sensors_battery(*args, **kwargs) -> Any: ... +def set_debug(*args, **kwargs) -> Any: ... +def swap_mem(*args, **kwargs) -> Any: ... +def users(*args, **kwargs) -> Any: ... +def virtual_mem(*args, **kwargs) -> Any: ... diff --git a/stubs/psutil/psutil/_psutil_posix.pyi b/stubs/psutil/psutil/_psutil_posix.pyi index 91e2302ec..2a58ee9a4 100644 --- a/stubs/psutil/psutil/_psutil_posix.pyi +++ b/stubs/psutil/psutil/_psutil_posix.pyi @@ -15,6 +15,7 @@ if sys.platform == "linux": RLIMIT_NPROC: int RLIMIT_RSS: int RLIMIT_RTPRIO: int + RLIMIT_RTTIME: int RLIMIT_SIGPENDING: int RLIMIT_STACK: int RLIM_INFINITY: int @@ -22,10 +23,12 @@ if sys.platform == "linux": def getpagesize(*args, **kwargs) -> Any: ... def getpriority(*args, **kwargs) -> Any: ... def net_if_addrs(*args, **kwargs) -> Any: ... +def net_if_flags(*args, **kwargs) -> Any: ... def net_if_is_running(*args, **kwargs) -> Any: ... def net_if_mtu(*args, **kwargs) -> Any: ... if sys.platform == "darwin": + AF_LINK: int def net_if_duplex_speed(*args, **kwargs): ... def setpriority(*args, **kwargs) -> Any: ... diff --git a/stubs/psutil/psutil/_psutil_windows.pyi b/stubs/psutil/psutil/_psutil_windows.pyi index 0f6820f05..def198673 100644 --- a/stubs/psutil/psutil/_psutil_windows.pyi +++ b/stubs/psutil/psutil/_psutil_windows.pyi @@ -1,3 +1,90 @@ -from _typeshed import Incomplete +ABOVE_NORMAL_PRIORITY_CLASS: int +BELOW_NORMAL_PRIORITY_CLASS: int +ERROR_ACCESS_DENIED: int +ERROR_INVALID_NAME: int +ERROR_PRIVILEGE_NOT_HELD: int +ERROR_SERVICE_DOES_NOT_EXIST: int +HIGH_PRIORITY_CLASS: int +IDLE_PRIORITY_CLASS: int +INFINITE: int +MIB_TCP_STATE_CLOSED: int +MIB_TCP_STATE_CLOSE_WAIT: int +MIB_TCP_STATE_CLOSING: int +MIB_TCP_STATE_DELETE_TCB: int +MIB_TCP_STATE_ESTAB: int +MIB_TCP_STATE_FIN_WAIT1: int +MIB_TCP_STATE_FIN_WAIT2: int +MIB_TCP_STATE_LAST_ACK: int +MIB_TCP_STATE_LISTEN: int +MIB_TCP_STATE_SYN_RCVD: int +MIB_TCP_STATE_SYN_SENT: int +MIB_TCP_STATE_TIME_WAIT: int +NORMAL_PRIORITY_CLASS: int +PSUTIL_CONN_NONE: int +REALTIME_PRIORITY_CLASS: int +WINDOWS_10: int +WINDOWS_7: int +WINDOWS_8: int +WINDOWS_8_1: int +WINDOWS_VISTA: int +WINVER: int +version: int -def __getattr__(name: str) -> Incomplete: ... +class TimeoutAbandoned(Exception): ... +class TimeoutExpired(Exception): ... + +def QueryDosDevice(*args, **kwargs): ... # incomplete +def boot_time(*args, **kwargs): ... # incomplete +def cpu_count_cores(*args, **kwargs): ... # incomplete +def cpu_count_logical(*args, **kwargs): ... # incomplete +def cpu_freq(*args, **kwargs): ... # incomplete +def cpu_stats(*args, **kwargs): ... # incomplete +def cpu_times(*args, **kwargs): ... # incomplete +def disk_io_counters(*args, **kwargs): ... # incomplete +def disk_partitions(*args, **kwargs): ... # incomplete +def disk_usage(*args, **kwargs): ... # incomplete +def getloadavg(*args, **kwargs): ... # incomplete +def getpagesize(*args, **kwargs): ... # incomplete +def init_loadavg_counter(*args, **kwargs): ... # incomplete +def net_connections(*args, **kwargs): ... # incomplete +def net_if_addrs(*args, **kwargs): ... # incomplete +def net_if_stats(*args, **kwargs): ... # incomplete +def net_io_counters(*args, **kwargs): ... # incomplete +def per_cpu_times(*args, **kwargs): ... # incomplete +def pid_exists(*args, **kwargs): ... # incomplete +def pids(*args, **kwargs): ... # incomplete +def ppid_map(*args, **kwargs): ... # incomplete +def proc_cmdline(*args, **kwargs): ... # incomplete +def proc_cpu_affinity_get(*args, **kwargs): ... # incomplete +def proc_cpu_affinity_set(*args, **kwargs): ... # incomplete +def proc_cwd(*args, **kwargs): ... # incomplete +def proc_environ(*args, **kwargs): ... # incomplete +def proc_exe(*args, **kwargs): ... # incomplete +def proc_info(*args, **kwargs): ... # incomplete +def proc_io_counters(*args, **kwargs): ... # incomplete +def proc_io_priority_get(*args, **kwargs): ... # incomplete +def proc_io_priority_set(*args, **kwargs): ... # incomplete +def proc_is_suspended(*args, **kwargs): ... # incomplete +def proc_kill(*args, **kwargs): ... # incomplete +def proc_memory_info(*args, **kwargs): ... # incomplete +def proc_memory_maps(*args, **kwargs): ... # incomplete +def proc_memory_uss(*args, **kwargs): ... # incomplete +def proc_num_handles(*args, **kwargs): ... # incomplete +def proc_open_files(*args, **kwargs): ... # incomplete +def proc_priority_get(*args, **kwargs): ... # incomplete +def proc_priority_set(*args, **kwargs): ... # incomplete +def proc_suspend_or_resume(*args, **kwargs): ... # incomplete +def proc_threads(*args, **kwargs): ... # incomplete +def proc_times(*args, **kwargs): ... # incomplete +def proc_username(*args, **kwargs): ... # incomplete +def proc_wait(*args, **kwargs): ... # incomplete +def sensors_battery(*args, **kwargs): ... # incomplete +def set_debug(*args, **kwargs): ... # incomplete +def users(*args, **kwargs): ... # incomplete +def virtual_mem(*args, **kwargs): ... # incomplete +def winservice_enumerate(*args, **kwargs): ... # incomplete +def winservice_query_config(*args, **kwargs): ... # incomplete +def winservice_query_descr(*args, **kwargs): ... # incomplete +def winservice_query_status(*args, **kwargs): ... # incomplete +def winservice_start(*args, **kwargs): ... # incomplete +def winservice_stop(*args, **kwargs): ... # incomplete diff --git a/stubs/psutil/psutil/_pswindows.pyi b/stubs/psutil/psutil/_pswindows.pyi index 5abcc18be..231e407ef 100644 --- a/stubs/psutil/psutil/_pswindows.pyi +++ b/stubs/psutil/psutil/_pswindows.pyi @@ -2,7 +2,7 @@ import enum from collections.abc import Iterable from typing import Any, NamedTuple -from ._common import ( +from psutil._common import ( ENCODING as ENCODING, ENCODING_ERRS as ENCODING_ERRS, AccessDenied as AccessDenied, @@ -16,7 +16,8 @@ from ._common import ( parse_environ_block as parse_environ_block, usage_percent as usage_percent, ) -from ._psutil_windows import ( +from psutil._compat import PY3 as PY3 +from psutil._psutil_windows import ( ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS as BELOW_NORMAL_PRIORITY_CLASS, HIGH_PRIORITY_CLASS as HIGH_PRIORITY_CLASS, @@ -25,7 +26,6 @@ from ._psutil_windows import ( REALTIME_PRIORITY_CLASS as REALTIME_PRIORITY_CLASS, ) -msg: str __extra__all__: Any CONN_DELETE_TCB: str ERROR_PARTIAL_COPY: int