diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index b3d95ae0c..8f4bb75ba 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -43,6 +43,7 @@ "stubs/Pillow", "stubs/paramiko", "stubs/protobuf", + "stubs/psutil", "stubs/Pygments", "stubs/PyMySQL", "stubs/python-dateutil", diff --git a/stubs/psutil/@tests/stubtest_allowlist.txt b/stubs/psutil/@tests/stubtest_allowlist.txt new file mode 100644 index 000000000..1f62a50cb --- /dev/null +++ b/stubs/psutil/@tests/stubtest_allowlist.txt @@ -0,0 +1,4 @@ +psutil._psbsd +psutil._psosx +psutil._psutil_windows +psutil._pswindows diff --git a/stubs/psutil/METADATA.toml b/stubs/psutil/METADATA.toml new file mode 100644 index 000000000..0948fc580 --- /dev/null +++ b/stubs/psutil/METADATA.toml @@ -0,0 +1 @@ +version = "5.8" diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi new file mode 100644 index 000000000..9544c649d --- /dev/null +++ b/stubs/psutil/psutil/__init__.pyi @@ -0,0 +1,196 @@ +import sys +from typing import Any + +from ._common import ( + AIX as AIX, + BSD as BSD, + CONN_CLOSE as CONN_CLOSE, + CONN_CLOSE_WAIT as CONN_CLOSE_WAIT, + CONN_CLOSING as CONN_CLOSING, + CONN_ESTABLISHED as CONN_ESTABLISHED, + CONN_FIN_WAIT1 as CONN_FIN_WAIT1, + CONN_FIN_WAIT2 as CONN_FIN_WAIT2, + CONN_LAST_ACK as CONN_LAST_ACK, + CONN_LISTEN as CONN_LISTEN, + CONN_NONE as CONN_NONE, + CONN_SYN_RECV as CONN_SYN_RECV, + CONN_SYN_SENT as CONN_SYN_SENT, + CONN_TIME_WAIT as CONN_TIME_WAIT, + FREEBSD as FREEBSD, + LINUX as LINUX, + MACOS as MACOS, + NETBSD as NETBSD, + NIC_DUPLEX_FULL as NIC_DUPLEX_FULL, + NIC_DUPLEX_HALF as NIC_DUPLEX_HALF, + NIC_DUPLEX_UNKNOWN as NIC_DUPLEX_UNKNOWN, + OPENBSD as OPENBSD, + OSX as OSX, + POSIX as POSIX, + POWER_TIME_UNKNOWN as POWER_TIME_UNKNOWN, + POWER_TIME_UNLIMITED as POWER_TIME_UNLIMITED, + STATUS_DEAD as STATUS_DEAD, + STATUS_DISK_SLEEP as STATUS_DISK_SLEEP, + STATUS_IDLE as STATUS_IDLE, + STATUS_LOCKED as STATUS_LOCKED, + STATUS_PARKED as STATUS_PARKED, + STATUS_RUNNING as STATUS_RUNNING, + STATUS_SLEEPING as STATUS_SLEEPING, + STATUS_STOPPED as STATUS_STOPPED, + STATUS_TRACING_STOP as STATUS_TRACING_STOP, + STATUS_WAITING as STATUS_WAITING, + STATUS_WAKING as STATUS_WAKING, + STATUS_ZOMBIE as STATUS_ZOMBIE, + SUNOS as SUNOS, + WINDOWS as WINDOWS, + AccessDenied as AccessDenied, + Error as Error, + NoSuchProcess as NoSuchProcess, + TimeoutExpired as TimeoutExpired, + ZombieProcess as ZombieProcess, +) + +if sys.platform == "linux": + from ._pslinux import ( + IOPRIO_CLASS_BE as IOPRIO_CLASS_BE, + IOPRIO_CLASS_IDLE as IOPRIO_CLASS_IDLE, + IOPRIO_CLASS_NONE as IOPRIO_CLASS_NONE, + IOPRIO_CLASS_RT as IOPRIO_CLASS_RT, + ) +if sys.platform == "win32": + from ._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, + IDLE_PRIORITY_CLASS as IDLE_PRIORITY_CLASS, + NORMAL_PRIORITY_CLASS as NORMAL_PRIORITY_CLASS, + REALTIME_PRIORITY_CLASS as REALTIME_PRIORITY_CLASS, + ) + from ._pswindows import ( + CONN_DELETE_TCB as CONN_DELETE_TCB, + IOPRIO_HIGH as IOPRIO_HIGH, + IOPRIO_LOW as IOPRIO_LOW, + IOPRIO_NORMAL as IOPRIO_NORMAL, + IOPRIO_VERYLOW as IOPRIO_VERYLOW, + win_service_iter as win_service_iter, + ) + +if sys.platform == "linux": + PROCFS_PATH: str +AF_LINK: Any +version_info: Any +__version__: Any + +class Process: + def __init__(self, pid: Any | None = ...) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def __hash__(self): ... + @property + def pid(self): ... + def oneshot(self) -> None: ... + def as_dict(self, attrs: Any | None = ..., ad_value: Any | None = ...): ... + def parent(self): ... + def parents(self): ... + def is_running(self): ... + def ppid(self): ... + def name(self): ... + def exe(self): ... + def cmdline(self): ... + def status(self): ... + def username(self): ... + def create_time(self): ... + def cwd(self): ... + def nice(self, value: Any | None = ...): ... + def uids(self): ... + def gids(self): ... + def terminal(self): ... + def num_fds(self): ... + if sys.platform != "darwin": + def io_counters(self): ... + def ionice(self, ioclass: Any | None = ..., value: Any | None = ...): ... + if sys.platform == "linux": + def rlimit(self, resource, limits: Any | None = ...): ... + if sys.platform != "darwin": + def cpu_affinity(self, cpus: Any | None = ...): ... + if sys.platform == "linux": + def cpu_num(self): ... + def environ(self): ... + if sys.platform == "win32": + def num_handles(self): ... + def num_ctx_switches(self): ... + def num_threads(self): ... + def threads(self): ... + def children(self, recursive: bool = ...): ... + def cpu_percent(self, interval: Any | None = ...): ... + def cpu_times(self): ... + def memory_info(self): ... + def memory_info_ex(self): ... + def memory_full_info(self): ... + def memory_percent(self, memtype: str = ...): ... + if sys.platform != "darwin": + def memory_maps(self, grouped: bool = ...): ... + def open_files(self): ... + def connections(self, kind: str = ...): ... + def send_signal(self, sig) -> None: ... + def suspend(self) -> None: ... + def resume(self) -> None: ... + def terminate(self) -> None: ... + def kill(self) -> None: ... + def wait(self, timeout: Any | None = ...): ... + +class Popen(Process): + def __init__(self, *args, **kwargs) -> None: ... + def __dir__(self): ... + def __enter__(self): ... + def __exit__(self, *args, **kwargs): ... + def __getattribute__(self, name): ... + def wait(self, timeout: Any | None = ...): ... + +def pids(): ... +def pid_exists(pid): ... +def process_iter(attrs: Any | None = ..., ad_value: Any | None = ...): ... +def wait_procs(procs, timeout: Any | None = ..., callback: Any | None = ...): ... +def cpu_count(logical: bool = ...): ... +def cpu_times(percpu: bool = ...): ... +def cpu_percent(interval: Any | None = ..., percpu: bool = ...): ... +def cpu_times_percent(interval: Any | None = ..., percpu: bool = ...): ... +def cpu_stats(): ... +def cpu_freq(percpu: bool = ...): ... +def getloadavg(): ... +def virtual_memory(): ... +def swap_memory(): ... +def disk_usage(path): ... +def disk_partitions(all: bool = ...): ... +def disk_io_counters(perdisk: bool = ..., nowrap: bool = ...): ... +def net_io_counters(pernic: bool = ..., nowrap: bool = ...): ... +def net_connections(kind: str = ...): ... +def net_if_addrs(): ... +def net_if_stats(): ... + +if sys.platform == "linux": + def sensors_temperatures(fahrenheit: bool = ...): ... + def sensors_fans(): ... + +if sys.platform != "win32": + def sensors_battery(): ... + +def boot_time(): ... +def users(): ... + +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 new file mode 100644 index 000000000..3cdd50fdc --- /dev/null +++ b/stubs/psutil/psutil/_common.pyi @@ -0,0 +1,268 @@ +import enum +from typing import Any, NamedTuple + +POSIX: Any +WINDOWS: Any +LINUX: Any +MACOS: Any +OSX: Any +FREEBSD: Any +OPENBSD: Any +NETBSD: Any +BSD: Any +SUNOS: Any +AIX: Any +STATUS_RUNNING: str +STATUS_SLEEPING: str +STATUS_DISK_SLEEP: str +STATUS_STOPPED: str +STATUS_TRACING_STOP: str +STATUS_ZOMBIE: str +STATUS_DEAD: str +STATUS_WAKE_KILL: str +STATUS_WAKING: str +STATUS_IDLE: str +STATUS_LOCKED: str +STATUS_WAITING: str +STATUS_SUSPENDED: str +STATUS_PARKED: str +CONN_ESTABLISHED: str +CONN_SYN_SENT: str +CONN_SYN_RECV: str +CONN_FIN_WAIT1: str +CONN_FIN_WAIT2: str +CONN_TIME_WAIT: str +CONN_CLOSE: str +CONN_CLOSE_WAIT: str +CONN_LAST_ACK: str +CONN_LISTEN: str +CONN_CLOSING: str +CONN_NONE: str +NIC_DUPLEX_FULL: int +NIC_DUPLEX_HALF: int +NIC_DUPLEX_UNKNOWN: int + +class NicDuplex(enum.IntEnum): + NIC_DUPLEX_FULL: int + NIC_DUPLEX_HALF: int + NIC_DUPLEX_UNKNOWN: int + +POWER_TIME_UNKNOWN: int +POWER_TIME_UNLIMITED: int + +class BatteryTime(enum.IntEnum): + POWER_TIME_UNKNOWN: int + POWER_TIME_UNLIMITED: int + +ENCODING: Any +ENCODING_ERRS: Any + +class sswap(NamedTuple): + total: Any + used: Any + free: Any + percent: Any + sin: Any + sout: Any + +class sdiskusage(NamedTuple): + total: Any + used: Any + free: Any + percent: Any + +class sdiskio(NamedTuple): + read_count: Any + write_count: Any + read_bytes: Any + write_bytes: Any + read_time: Any + write_time: Any + +class sdiskpart(NamedTuple): + device: Any + mountpoint: Any + fstype: Any + opts: Any + maxfile: Any + maxpath: Any + +class snetio(NamedTuple): + bytes_sent: Any + bytes_recv: Any + packets_sent: Any + packets_recv: Any + errin: Any + errout: Any + dropin: Any + dropout: Any + +class suser(NamedTuple): + name: Any + terminal: Any + host: Any + started: Any + pid: Any + +class sconn(NamedTuple): + fd: Any + family: Any + type: Any + laddr: Any + raddr: Any + status: Any + pid: Any + +class snicaddr(NamedTuple): + family: Any + address: Any + netmask: Any + broadcast: Any + ptp: Any + +class snicstats(NamedTuple): + isup: Any + duplex: Any + speed: Any + mtu: Any + +class scpustats(NamedTuple): + ctx_switches: Any + interrupts: Any + soft_interrupts: Any + syscalls: Any + +class scpufreq(NamedTuple): + current: Any + min: Any + max: Any + +class shwtemp(NamedTuple): + label: Any + current: Any + high: Any + critical: Any + +class sbattery(NamedTuple): + percent: Any + secsleft: Any + power_plugged: Any + +class sfan(NamedTuple): + label: Any + current: Any + +class pcputimes(NamedTuple): + user: Any + system: Any + children_user: Any + children_system: Any + +class popenfile(NamedTuple): + path: Any + fd: Any + +class pthread(NamedTuple): + id: Any + user_time: Any + system_time: Any + +class puids(NamedTuple): + real: Any + effective: Any + saved: Any + +class pgids(NamedTuple): + real: Any + effective: Any + saved: Any + +class pio(NamedTuple): + read_count: Any + write_count: Any + read_bytes: Any + write_bytes: Any + +class pionice(NamedTuple): + ioclass: Any + value: Any + +class pctxsw(NamedTuple): + voluntary: Any + involuntary: Any + +class pconn(NamedTuple): + fd: Any + family: Any + type: Any + laddr: Any + raddr: Any + status: Any + +class addr(NamedTuple): + ip: Any + port: Any + +conn_tmap: Any + +class Error(Exception): + __module__: str + msg: Any + def __init__(self, msg: str = ...) -> None: ... + +class NoSuchProcess(Error): + __module__: str + pid: Any + name: Any + msg: Any + def __init__(self, pid, name: Any | None = ..., msg: Any | None = ...) -> None: ... + +class ZombieProcess(NoSuchProcess): + __module__: str + pid: Any + ppid: Any + name: Any + msg: Any + def __init__(self, pid, name: Any | None = ..., ppid: Any | None = ..., msg: Any | None = ...) -> None: ... + +class AccessDenied(Error): + __module__: str + pid: Any + name: Any + msg: Any + def __init__(self, pid: Any | None = ..., name: Any | None = ..., msg: Any | None = ...) -> None: ... + +class TimeoutExpired(Error): + __module__: str + seconds: Any + pid: Any + name: Any + def __init__(self, seconds, pid: Any | None = ..., name: Any | None = ...) -> None: ... + +def usage_percent(used, total, round_: Any | None = ...): ... +def memoize(fun): ... +def isfile_strict(path): ... +def path_exists_strict(path): ... +def supports_ipv6(): ... +def parse_environ_block(data): ... +def sockfam_to_enum(num): ... +def socktype_to_enum(num): ... +def conn_to_ntuple(fd, fam, type_, laddr, raddr, status, status_map, pid: Any | None = ...): ... +def deprecated_method(replacement): ... + +class _WrapNumbers: + lock: Any + cache: Any + reminders: Any + reminder_keys: Any + def __init__(self) -> None: ... + def run(self, input_dict, name): ... + def cache_clear(self, name: Any | None = ...) -> None: ... + def cache_info(self): ... + +def wrap_numbers(input_dict, name): ... +def bytes2human(n, format: str = ...): ... +def term_supports_colors(file=...): ... +def hilite(s, color: Any | None = ..., bold: bool = ...): ... +def print_color(s, color: Any | None = ..., bold: bool = ..., file=...) -> None: ... +def debug(msg) -> None: ... diff --git a/stubs/psutil/psutil/_compat.pyi b/stubs/psutil/psutil/_compat.pyi new file mode 100644 index 000000000..b4efc9d98 --- /dev/null +++ b/stubs/psutil/psutil/_compat.pyi @@ -0,0 +1,6 @@ +FileNotFoundError = FileNotFoundError +PermissionError = PermissionError +ProcessLookupError = ProcessLookupError +InterruptedError = InterruptedError +ChildProcessError = ChildProcessError +FileExistsError = FileExistsError diff --git a/stubs/psutil/psutil/_psbsd.pyi b/stubs/psutil/psutil/_psbsd.pyi new file mode 100644 index 000000000..f61436c73 --- /dev/null +++ b/stubs/psutil/psutil/_psbsd.pyi @@ -0,0 +1,162 @@ +from typing import Any, NamedTuple + +from ._common import ( + FREEBSD as FREEBSD, + NETBSD as NETBSD, + OPENBSD as OPENBSD, + AccessDenied as AccessDenied, + NoSuchProcess as NoSuchProcess, + ZombieProcess as ZombieProcess, + conn_tmap as conn_tmap, + conn_to_ntuple as conn_to_ntuple, + memoize as memoize, + usage_percent as usage_percent, +) + +__extra__all__: Any +PROC_STATUSES: Any +TCP_STATUSES: Any +PAGESIZE: Any +AF_LINK: Any +HAS_PER_CPU_TIMES: Any +HAS_PROC_NUM_THREADS: Any +HAS_PROC_OPEN_FILES: Any +HAS_PROC_NUM_FDS: Any +kinfo_proc_map: Any + +class svmem(NamedTuple): + total: Any + available: Any + percent: Any + used: Any + free: Any + active: Any + inactive: Any + buffers: Any + cached: Any + shared: Any + wired: Any + +class scputimes(NamedTuple): + user: Any + nice: Any + system: Any + idle: Any + irq: Any + +class pmem(NamedTuple): + rss: Any + vms: Any + text: Any + data: Any + stack: Any + +pfullmem = pmem + +class pcputimes(NamedTuple): + user: Any + system: Any + children_user: Any + children_system: Any + +class pmmap_grouped(NamedTuple): + path: Any + rss: Any + private: Any + ref_count: Any + shadow_count: Any + +class pmmap_ext(NamedTuple): + addr: Any + perms: Any + path: Any + rss: Any + private: Any + ref_count: Any + shadow_count: Any + +class sdiskio(NamedTuple): + read_count: Any + write_count: Any + read_bytes: Any + write_bytes: Any + read_time: Any + write_time: Any + busy_time: Any + +def virtual_memory(): ... +def swap_memory(): ... +def cpu_times(): ... +def per_cpu_times(): ... +def cpu_count_logical(): ... +def cpu_count_physical(): ... +def cpu_stats(): ... +def disk_partitions(all: bool = ...): ... + +disk_usage: Any +disk_io_counters: Any +net_io_counters: Any +net_if_addrs: Any + +def net_if_stats(): ... +def net_connections(kind): ... +def sensors_battery(): ... +def sensors_temperatures(): ... +def cpu_freq(): ... +def boot_time(): ... +def users(): ... +def pids(): ... +def pid_exists(pid): ... +def is_zombie(pid): ... +def wrap_exceptions(fun): ... +def wrap_exceptions_procfs(inst) -> None: ... + +class Process: + pid: Any + def __init__(self, pid) -> None: ... + def oneshot(self): ... + def oneshot_enter(self) -> None: ... + def oneshot_exit(self) -> None: ... + def name(self): ... + def exe(self): ... + def cmdline(self): ... + def environ(self): ... + def terminal(self): ... + def ppid(self): ... + def uids(self): ... + def gids(self): ... + def cpu_times(self): ... + def cpu_num(self): ... + def memory_info(self): ... + memory_full_info: Any + def create_time(self): ... + def num_threads(self): ... + def num_ctx_switches(self): ... + def threads(self): ... + def connections(self, kind: str = ...): ... + def wait(self, timeout: Any | None = ...): ... + def nice_get(self): ... + def nice_set(self, value): ... + def status(self): ... + def io_counters(self): ... + def cwd(self): ... + class nt_mmap_grouped(NamedTuple): + path: Any + rss: Any + private: Any + ref_count: Any + shadow_count: Any + class nt_mmap_ext(NamedTuple): + addr: Any + perms: Any + path: Any + rss: Any + private: Any + ref_count: Any + shadow_count: Any + def open_files(self): ... + def num_fds(self): ... + def cpu_affinity_get(self): ... + def cpu_affinity_set(self, cpus) -> None: ... + def memory_maps(self): ... + def rlimit(self, resource, limits: Any | None = ...): ... diff --git a/stubs/psutil/psutil/_pslinux.pyi b/stubs/psutil/psutil/_pslinux.pyi new file mode 100644 index 000000000..6794cfb3b --- /dev/null +++ b/stubs/psutil/psutil/_pslinux.pyi @@ -0,0 +1,206 @@ +import enum +from typing import Any, NamedTuple + +from ._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, + isfile_strict as isfile_strict, + parse_environ_block as parse_environ_block, + path_exists_strict as path_exists_strict, + supports_ipv6 as supports_ipv6, + usage_percent as usage_percent, +) + +__extra__all__: Any +POWER_SUPPLY_PATH: str +HAS_SMAPS: Any +HAS_PROC_IO_PRIORITY: Any +HAS_CPU_AFFINITY: Any +CLOCK_TICKS: Any +PAGESIZE: Any +BOOT_TIME: Any +BIGFILE_BUFFERING: Any +LITTLE_ENDIAN: Any +DISK_SECTOR_SIZE: int +AF_LINK: Any +AddressFamily: Any +IOPRIO_CLASS_NONE: int +IOPRIO_CLASS_RT: int +IOPRIO_CLASS_BE: int +IOPRIO_CLASS_IDLE: int + +class IOPriority(enum.IntEnum): + IOPRIO_CLASS_NONE: int + IOPRIO_CLASS_RT: int + IOPRIO_CLASS_BE: int + IOPRIO_CLASS_IDLE: int + +PROC_STATUSES: Any +TCP_STATUSES: Any + +class svmem(NamedTuple): + total: Any + available: Any + percent: Any + used: Any + free: Any + active: Any + inactive: Any + buffers: Any + cached: Any + shared: Any + slab: Any + +class sdiskio(NamedTuple): + read_count: Any + write_count: Any + read_bytes: Any + write_bytes: Any + read_time: Any + write_time: Any + read_merged_count: Any + write_merged_count: Any + busy_time: Any + +class popenfile(NamedTuple): + path: Any + fd: Any + position: Any + mode: Any + flags: Any + +class pmem(NamedTuple): + rss: Any + vms: Any + shared: Any + text: Any + lib: Any + data: Any + dirty: Any + +pfullmem: Any + +class pmmap_grouped(NamedTuple): + path: Any + rss: Any + size: Any + pss: Any + shared_clean: Any + shared_dirty: Any + private_clean: Any + private_dirty: Any + referenced: Any + anonymous: Any + swap: Any + +pmmap_ext: Any + +class pio(NamedTuple): + read_count: Any + write_count: Any + read_bytes: Any + write_bytes: Any + read_chars: Any + write_chars: Any + +class pcputimes(NamedTuple): + user: Any + system: Any + children_user: Any + children_system: Any + iowait: Any + +def readlink(path): ... +def file_flags_to_mode(flags): ... +def is_storage_device(name): ... +def set_scputimes_ntuple(procfs_path) -> None: ... +def cat(fname, fallback=..., binary: bool = ...): ... + +scputimes: Any +prlimit: Any + +def calculate_avail_vmem(mems): ... +def virtual_memory(): ... +def swap_memory(): ... +def cpu_times(): ... +def per_cpu_times(): ... +def cpu_count_logical(): ... +def cpu_count_physical(): ... +def cpu_stats(): ... +def cpu_freq(): ... + +net_if_addrs: Any + +class _Ipv6UnsupportedError(Exception): ... + +class Connections: + tmap: Any + def __init__(self) -> None: ... + def get_proc_inodes(self, pid): ... + def get_all_inodes(self): ... + @staticmethod + def decode_address(addr, family): ... + @staticmethod + def process_inet(file, family, type_, inodes, filter_pid: Any | None = ...) -> None: ... + @staticmethod + def process_unix(file, family, inodes, filter_pid: Any | None = ...) -> None: ... + def retrieve(self, kind, pid: Any | None = ...): ... + +def net_connections(kind: str = ...): ... +def net_io_counters(): ... +def net_if_stats(): ... + +disk_usage: Any + +def disk_io_counters(perdisk: bool = ...): ... +def disk_partitions(all: bool = ...): ... +def sensors_temperatures(): ... +def sensors_fans(): ... +def sensors_battery(): ... +def users(): ... +def boot_time(): ... +def pids(): ... +def pid_exists(pid): ... +def ppid_map(): ... +def wrap_exceptions(fun): ... + +class Process: + pid: Any + 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 terminal(self): ... + def io_counters(self): ... + def cpu_times(self): ... + def cpu_num(self): ... + def wait(self, timeout: Any | None = ...): ... + def create_time(self): ... + def memory_info(self): ... + def memory_full_info(self, _private_re=..., _pss_re=..., _swap_re=...): ... + def memory_maps(self): ... + def cwd(self): ... + def num_ctx_switches(self, _ctxsw_re=...): ... + def num_threads(self, _num_threads_re=...): ... + def threads(self): ... + def nice_get(self): ... + def nice_set(self, value): ... + def cpu_affinity_get(self): ... + def cpu_affinity_set(self, cpus) -> None: ... + def ionice_get(self): ... + def ionice_set(self, ioclass, value): ... + def rlimit(self, resource_, limits: Any | None = ...): ... + def status(self): ... + def open_files(self): ... + def connections(self, kind: str = ...): ... + def num_fds(self): ... + def ppid(self): ... + def uids(self, _uids_re=...): ... + def gids(self, _gids_re=...): ... diff --git a/stubs/psutil/psutil/_psosx.pyi b/stubs/psutil/psutil/_psosx.pyi new file mode 100644 index 000000000..cd828e436 --- /dev/null +++ b/stubs/psutil/psutil/_psosx.pyi @@ -0,0 +1,103 @@ +from typing import Any, NamedTuple + +from ._common import ( + AccessDenied as AccessDenied, + NoSuchProcess as NoSuchProcess, + ZombieProcess as ZombieProcess, + conn_tmap as conn_tmap, + conn_to_ntuple as conn_to_ntuple, + isfile_strict as isfile_strict, + parse_environ_block as parse_environ_block, + usage_percent as usage_percent, +) + +__extra__all__: Any +PAGESIZE: Any +AF_LINK: Any +TCP_STATUSES: Any +PROC_STATUSES: Any +kinfo_proc_map: Any +pidtaskinfo_map: Any + +class scputimes(NamedTuple): + user: Any + nice: Any + system: Any + idle: Any + +class svmem(NamedTuple): + total: Any + available: Any + percent: Any + used: Any + free: Any + active: Any + inactive: Any + wired: Any + +class pmem(NamedTuple): + rss: Any + vms: Any + pfaults: Any + pageins: Any + +pfullmem: Any + +def virtual_memory(): ... +def swap_memory(): ... +def cpu_times(): ... +def per_cpu_times(): ... +def cpu_count_logical(): ... +def cpu_count_physical(): ... +def cpu_stats(): ... +def cpu_freq(): ... + +disk_usage: Any +disk_io_counters: Any + +def disk_partitions(all: bool = ...): ... +def sensors_battery(): ... + +net_io_counters: Any +net_if_addrs: Any + +def net_connections(kind: str = ...): ... +def net_if_stats(): ... +def boot_time(): ... +def users(): ... +def pids(): ... + +pid_exists: Any + +def is_zombie(pid): ... +def wrap_exceptions(fun): ... +def catch_zombie(proc) -> None: ... + +class Process: + pid: Any + 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 ppid(self): ... + def cwd(self): ... + def uids(self): ... + def gids(self): ... + def terminal(self): ... + def memory_info(self): ... + def memory_full_info(self): ... + def cpu_times(self): ... + def create_time(self): ... + def num_ctx_switches(self): ... + def num_threads(self): ... + def open_files(self): ... + def connections(self, kind: str = ...): ... + def num_fds(self): ... + def wait(self, timeout: Any | None = ...): ... + def nice_get(self): ... + def nice_set(self, value): ... + def status(self): ... + def threads(self): ... diff --git a/stubs/psutil/psutil/_psposix.pyi b/stubs/psutil/psutil/_psposix.pyi new file mode 100644 index 000000000..8b754aff0 --- /dev/null +++ b/stubs/psutil/psutil/_psposix.pyi @@ -0,0 +1,8 @@ +from typing import Any + +def pid_exists(pid): ... +def wait_pid( + pid, timeout: Any | None = ..., proc_name: Any | None = ..., _waitpid=..., _timer=..., _min=..., _sleep=..., _pid_exists=... +): ... +def disk_usage(path): ... +def get_terminal_map(): ... diff --git a/stubs/psutil/psutil/_psutil_linux.pyi b/stubs/psutil/psutil/_psutil_linux.pyi new file mode 100644 index 000000000..949d6a7e7 --- /dev/null +++ b/stubs/psutil/psutil/_psutil_linux.pyi @@ -0,0 +1,16 @@ +from typing import Any + +DUPLEX_FULL: int +DUPLEX_HALF: int +DUPLEX_UNKNOWN: int +version: int + +def disk_partitions(*args, **kwargs) -> Any: ... +def linux_sysinfo(*args, **kwargs) -> Any: ... +def net_if_duplex_speed(*args, **kwargs) -> Any: ... +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_testing(*args, **kwargs) -> Any: ... +def users(*args, **kwargs) -> Any: ... diff --git a/stubs/psutil/psutil/_psutil_posix.pyi b/stubs/psutil/psutil/_psutil_posix.pyi new file mode 100644 index 000000000..91e2302ec --- /dev/null +++ b/stubs/psutil/psutil/_psutil_posix.pyi @@ -0,0 +1,31 @@ +import sys +from typing import Any + +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 + +def getpagesize(*args, **kwargs) -> Any: ... +def getpriority(*args, **kwargs) -> Any: ... +def net_if_addrs(*args, **kwargs) -> Any: ... +def net_if_is_running(*args, **kwargs) -> Any: ... +def net_if_mtu(*args, **kwargs) -> Any: ... + +if sys.platform == "darwin": + 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 new file mode 100644 index 000000000..964e6fa3f --- /dev/null +++ b/stubs/psutil/psutil/_psutil_windows.pyi @@ -0,0 +1,3 @@ +from typing import Any + +def __getattr__(name: str) -> Any: ... # incomplete diff --git a/stubs/psutil/psutil/_pswindows.pyi b/stubs/psutil/psutil/_pswindows.pyi new file mode 100644 index 000000000..6d39f0e75 --- /dev/null +++ b/stubs/psutil/psutil/_pswindows.pyi @@ -0,0 +1,186 @@ +import enum +from typing import Any, NamedTuple + +from ._common import ( + ENCODING as ENCODING, + ENCODING_ERRS as ENCODING_ERRS, + AccessDenied as AccessDenied, + NoSuchProcess as NoSuchProcess, + TimeoutExpired as TimeoutExpired, + conn_tmap as conn_tmap, + conn_to_ntuple as conn_to_ntuple, + debug as debug, + isfile_strict as isfile_strict, + memoize as memoize, + parse_environ_block as parse_environ_block, + usage_percent as usage_percent, +) +from ._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, + IDLE_PRIORITY_CLASS as IDLE_PRIORITY_CLASS, + NORMAL_PRIORITY_CLASS as NORMAL_PRIORITY_CLASS, + REALTIME_PRIORITY_CLASS as REALTIME_PRIORITY_CLASS, +) + +msg: str +__extra__all__: Any +CONN_DELETE_TCB: str +ERROR_PARTIAL_COPY: int +PYPY: Any +AF_LINK: int +AddressFamily: Any +TCP_STATUSES: Any + +class Priority(enum.IntEnum): + ABOVE_NORMAL_PRIORITY_CLASS: Any + BELOW_NORMAL_PRIORITY_CLASS: Any + HIGH_PRIORITY_CLASS: Any + IDLE_PRIORITY_CLASS: Any + NORMAL_PRIORITY_CLASS: Any + REALTIME_PRIORITY_CLASS: Any + +IOPRIO_VERYLOW: int +IOPRIO_LOW: int +IOPRIO_NORMAL: int +IOPRIO_HIGH: int + +class IOPriority(enum.IntEnum): + IOPRIO_VERYLOW: int + IOPRIO_LOW: int + IOPRIO_NORMAL: int + IOPRIO_HIGH: int + +pinfo_map: Any + +class scputimes(NamedTuple): + user: Any + system: Any + idle: Any + interrupt: Any + dpc: Any + +class svmem(NamedTuple): + total: Any + available: Any + percent: Any + used: Any + free: Any + +class pmem(NamedTuple): + rss: Any + vms: Any + num_page_faults: Any + peak_wset: Any + wset: Any + peak_paged_pool: Any + paged_pool: Any + peak_nonpaged_pool: Any + nonpaged_pool: Any + pagefile: Any + peak_pagefile: Any + private: Any + +pfullmem: Any + +class pmmap_grouped(NamedTuple): + path: Any + rss: Any + +pmmap_ext: Any + +class pio(NamedTuple): + read_count: Any + write_count: Any + read_bytes: Any + write_bytes: Any + other_count: Any + other_bytes: Any + +def convert_dos_path(s): ... +def py2_strencode(s): ... +def getpagesize(): ... +def virtual_memory(): ... +def swap_memory(): ... + +disk_io_counters: Any + +def disk_usage(path): ... +def disk_partitions(all): ... +def cpu_times(): ... +def per_cpu_times(): ... +def cpu_count_logical(): ... +def cpu_count_physical(): ... +def cpu_stats(): ... +def cpu_freq(): ... +def getloadavg(): ... +def net_connections(kind, _pid: int = ...): ... +def net_if_stats(): ... +def net_io_counters(): ... +def net_if_addrs(): ... +def sensors_battery(): ... +def boot_time(): ... +def users(): ... +def win_service_iter() -> None: ... +def win_service_get(name): ... + +class WindowsService: + def __init__(self, name, display_name) -> None: ... + def __eq__(self, other): ... + def __ne__(self, other): ... + def name(self): ... + def display_name(self): ... + def binpath(self): ... + def username(self): ... + def start_type(self): ... + def pid(self): ... + def status(self): ... + def description(self): ... + def as_dict(self): ... + +pids: Any +pid_exists: Any +ppid_map: Any + +def is_permission_err(exc): ... +def convert_oserror(exc, pid: Any | None = ..., name: Any | None = ...): ... +def wrap_exceptions(fun): ... +def retry_error_partial_copy(fun): ... + +class Process: + pid: Any + 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 ppid(self): ... + def memory_info(self): ... + def memory_full_info(self): ... + def memory_maps(self) -> None: ... + def kill(self): ... + def send_signal(self, sig) -> None: ... + def wait(self, timeout: Any | None = ...): ... + def username(self): ... + def create_time(self): ... + def num_threads(self): ... + def threads(self): ... + def cpu_times(self): ... + def suspend(self) -> None: ... + def resume(self) -> None: ... + def cwd(self): ... + def open_files(self): ... + def connections(self, kind: str = ...): ... + def nice_get(self): ... + def nice_set(self, value): ... + def ionice_get(self): ... + def ionice_set(self, ioclass, value) -> None: ... + def io_counters(self): ... + def status(self): ... + def cpu_affinity_get(self): ... + def cpu_affinity_set(self, value): ... + def num_handles(self): ... + def num_ctx_switches(self): ...