diff --git a/stubs/psutil/@tests/stubtest_allowlist.txt b/stubs/psutil/@tests/stubtest_allowlist.txt index 785a98e07685..0ced949877a2 100644 --- a/stubs/psutil/@tests/stubtest_allowlist.txt +++ b/stubs/psutil/@tests/stubtest_allowlist.txt @@ -1,6 +1,3 @@ -# TODO: missing from stub -psutil.__all__ - # Stubtest does not support these platforms psutil._psaix psutil._psbsd diff --git a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt index 2606ecbdf50b..f1bc464326a5 100644 --- a/stubs/psutil/@tests/stubtest_allowlist_darwin.txt +++ b/stubs/psutil/@tests/stubtest_allowlist_darwin.txt @@ -6,3 +6,4 @@ psutil._psutil_windows # not always available on ARM64, but we test there psutil.cpu_freq psutil._psosx.cpu_freq +psutil.__all__ # cpu_freq is only added to __all__ at runtime when it is available diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi index b49b1a1fb3d4..721f59282c7c 100644 --- a/stubs/psutil/psutil/__init__.pyi +++ b/stubs/psutil/psutil/__init__.pyi @@ -57,6 +57,132 @@ from psutil._common import ( from . import _ntuples as _ntp +__all__ = [ + # exceptions + "Error", + "NoSuchProcess", + "ZombieProcess", + "AccessDenied", + "TimeoutExpired", + # constants + "version_info", + "__version__", + "STATUS_RUNNING", + "STATUS_IDLE", + "STATUS_SLEEPING", + "STATUS_DISK_SLEEP", + "STATUS_STOPPED", + "STATUS_TRACING_STOP", + "STATUS_ZOMBIE", + "STATUS_DEAD", + "STATUS_WAKING", + "STATUS_LOCKED", + "STATUS_WAITING", + "STATUS_PARKED", + "CONN_ESTABLISHED", + "CONN_SYN_SENT", + "CONN_SYN_RECV", + "CONN_FIN_WAIT1", + "CONN_FIN_WAIT2", + "CONN_TIME_WAIT", + "CONN_CLOSE", + "CONN_CLOSE_WAIT", + "CONN_LAST_ACK", + "CONN_LISTEN", + "CONN_CLOSING", + "CONN_NONE", + "AF_LINK", + "NIC_DUPLEX_FULL", + "NIC_DUPLEX_HALF", + "NIC_DUPLEX_UNKNOWN", + "POWER_TIME_UNKNOWN", + "POWER_TIME_UNLIMITED", + "BSD", + "FREEBSD", + "LINUX", + "NETBSD", + "OPENBSD", + "MACOS", + "OSX", + "POSIX", + "SUNOS", + "WINDOWS", + "AIX", + # classes + "Process", + "Popen", + # functions + "pid_exists", + "pids", + "process_iter", + "wait_procs", + "virtual_memory", + "swap_memory", + "cpu_times", + "cpu_percent", + "cpu_times_percent", + "cpu_count", + "cpu_stats", + "cpu_freq", + "getloadavg", + "net_io_counters", + "net_connections", + "net_if_addrs", + "net_if_stats", + "disk_io_counters", + "disk_partitions", + "disk_usage", + "sensors_battery", + "users", + "boot_time", + "heap_info", + "heap_trim", +] + +if sys.platform == "linux": + __all__ += [ + "PROCFS_PATH", + "IOPRIO_CLASS_NONE", + "IOPRIO_CLASS_RT", + "IOPRIO_CLASS_BE", + "IOPRIO_CLASS_IDLE", + "RLIMIT_AS", + "RLIMIT_CORE", + "RLIMIT_CPU", + "RLIMIT_DATA", + "RLIMIT_FSIZE", + "RLIMIT_LOCKS", + "RLIMIT_MEMLOCK", + "RLIMIT_MSGQUEUE", + "RLIMIT_NICE", + "RLIMIT_NOFILE", + "RLIMIT_NPROC", + "RLIMIT_RSS", + "RLIMIT_RTPRIO", + "RLIMIT_RTTIME", + "RLIMIT_SIGPENDING", + "RLIMIT_STACK", + "RLIM_INFINITY", + "sensors_temperatures", + "sensors_fans", + ] +elif sys.platform == "win32": + __all__ += [ + "win_service_iter", + "win_service_get", + "ABOVE_NORMAL_PRIORITY_CLASS", + "BELOW_NORMAL_PRIORITY_CLASS", + "HIGH_PRIORITY_CLASS", + "IDLE_PRIORITY_CLASS", + "NORMAL_PRIORITY_CLASS", + "REALTIME_PRIORITY_CLASS", + "IOPRIO_VERYLOW", + "IOPRIO_LOW", + "IOPRIO_NORMAL", + "IOPRIO_HIGH", + "CONN_DELETE_TCB", + ] + if sys.platform == "linux": from ._pslinux import ( IOPRIO_CLASS_BE as IOPRIO_CLASS_BE,