|
1 | | -from _typeshed import Incomplete |
2 | | -from typing import NamedTuple |
| 1 | +import sys |
3 | 2 |
|
4 | | -from psutil._common import ( |
5 | | - NIC_DUPLEX_FULL as NIC_DUPLEX_FULL, |
6 | | - NIC_DUPLEX_HALF as NIC_DUPLEX_HALF, |
7 | | - NIC_DUPLEX_UNKNOWN as NIC_DUPLEX_UNKNOWN, |
8 | | - AccessDenied as AccessDenied, |
9 | | - NoSuchProcess as NoSuchProcess, |
10 | | - ZombieProcess as ZombieProcess, |
11 | | - conn_to_ntuple as conn_to_ntuple, |
12 | | - get_procfs_path as get_procfs_path, |
13 | | - memoize_when_activated as memoize_when_activated, |
14 | | - usage_percent as usage_percent, |
15 | | -) |
| 3 | +# sys.platform.startswith("aix"): |
| 4 | +if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": |
| 5 | + from collections.abc import Callable |
| 6 | + from typing import Final, Literal, NamedTuple, TypeVar, overload |
| 7 | + from typing_extensions import ParamSpec |
16 | 8 |
|
17 | | -__extra__all__: Incomplete |
18 | | -HAS_THREADS: Incomplete |
19 | | -HAS_NET_IO_COUNTERS: Incomplete |
20 | | -HAS_PROC_IO_COUNTERS: Incomplete |
21 | | -PAGE_SIZE: Incomplete |
22 | | -AF_LINK: Incomplete |
23 | | -PROC_STATUSES: Incomplete |
24 | | -TCP_STATUSES: Incomplete |
25 | | -proc_info_map: Incomplete |
| 9 | + from psutil._common import ( |
| 10 | + NIC_DUPLEX_FULL as NIC_DUPLEX_FULL, |
| 11 | + NIC_DUPLEX_HALF as NIC_DUPLEX_HALF, |
| 12 | + NIC_DUPLEX_UNKNOWN as NIC_DUPLEX_UNKNOWN, |
| 13 | + AccessDenied as AccessDenied, |
| 14 | + NoSuchProcess as NoSuchProcess, |
| 15 | + ZombieProcess as ZombieProcess, |
| 16 | + conn_to_ntuple as conn_to_ntuple, |
| 17 | + get_procfs_path as get_procfs_path, |
| 18 | + memoize_when_activated as memoize_when_activated, |
| 19 | + usage_percent as usage_percent, |
| 20 | + ) |
26 | 21 |
|
27 | | -class pmem(NamedTuple): |
28 | | - rss: Incomplete |
29 | | - vms: Incomplete |
| 22 | + from . import _common, _psposix, _psutil_aix |
30 | 23 |
|
31 | | -pfullmem = pmem |
| 24 | + __extra__all__: Final[list[str]] |
| 25 | + HAS_THREADS: Final[bool] |
| 26 | + HAS_NET_IO_COUNTERS: Final[bool] |
| 27 | + HAS_PROC_IO_COUNTERS: Final[bool] |
| 28 | + PAGE_SIZE: Final[int] |
| 29 | + AF_LINK: Final = 18 |
| 30 | + PROC_STATUSES: Final[dict[int, str]] |
| 31 | + TCP_STATUSES: Final[dict[int, str]] |
| 32 | + proc_info_map: Final[dict[str, int]] |
32 | 33 |
|
33 | | -class scputimes(NamedTuple): |
34 | | - user: float |
35 | | - system: float |
36 | | - idle: float |
37 | | - iowait: float |
| 34 | + class pmem(NamedTuple): |
| 35 | + rss: int |
| 36 | + vms: int |
38 | 37 |
|
39 | | -class svmem(NamedTuple): |
40 | | - total: Incomplete |
41 | | - available: Incomplete |
42 | | - percent: Incomplete |
43 | | - used: Incomplete |
44 | | - free: Incomplete |
| 38 | + pfullmem = pmem |
45 | 39 |
|
46 | | -def virtual_memory(): ... |
47 | | -def swap_memory(): ... |
48 | | -def cpu_times(): ... |
49 | | -def per_cpu_times(): ... |
50 | | -def cpu_count_logical(): ... |
51 | | -def cpu_count_cores(): ... |
52 | | -def cpu_stats(): ... |
| 40 | + class scputimes(NamedTuple): |
| 41 | + user: float |
| 42 | + system: float |
| 43 | + idle: float |
| 44 | + iowait: float |
53 | 45 |
|
54 | | -disk_io_counters: Incomplete |
55 | | -disk_usage: Incomplete |
| 46 | + class svmem(NamedTuple): |
| 47 | + total: int |
| 48 | + available: int |
| 49 | + percent: float |
| 50 | + used: int |
| 51 | + free: int |
56 | 52 |
|
57 | | -def disk_partitions(all: bool = ...): ... |
| 53 | + _P = ParamSpec("_P") |
| 54 | + _R = TypeVar("_R") |
58 | 55 |
|
59 | | -net_if_addrs: Incomplete |
60 | | -net_io_counters: Incomplete |
| 56 | + def virtual_memory() -> svmem: ... |
| 57 | + def swap_memory() -> _common.sswap: ... |
| 58 | + def cpu_times() -> scputimes: ... |
| 59 | + def per_cpu_times() -> list[scputimes]: ... |
| 60 | + def cpu_count_logical() -> int | None: ... |
| 61 | + def cpu_count_cores() -> int | None: ... |
| 62 | + def cpu_stats() -> _common.scpustats: ... |
61 | 63 |
|
62 | | -def net_connections(kind, _pid: int = ...): ... |
63 | | -def net_if_stats(): ... |
64 | | -def boot_time(): ... |
65 | | -def users(): ... |
66 | | -def pids(): ... |
67 | | -def pid_exists(pid): ... |
68 | | -def wrap_exceptions(fun): ... |
| 64 | + disk_io_counters = _psutil_aix.disk_io_counters |
| 65 | + disk_usage = _psposix.disk_usage |
69 | 66 |
|
70 | | -class Process: |
71 | | - pid: Incomplete |
72 | | - def __init__(self, pid) -> None: ... |
73 | | - def oneshot_enter(self) -> None: ... |
74 | | - def oneshot_exit(self) -> None: ... |
75 | | - def name(self): ... |
76 | | - def exe(self): ... |
77 | | - def cmdline(self): ... |
78 | | - def environ(self): ... |
79 | | - def create_time(self): ... |
80 | | - def num_threads(self): ... |
81 | | - def threads(self): ... |
82 | | - def net_connections(self, kind: str = ...): ... |
83 | | - def nice_get(self): ... |
84 | | - def nice_set(self, value): ... |
85 | | - def ppid(self): ... |
86 | | - def uids(self): ... |
87 | | - def gids(self): ... |
88 | | - def cpu_times(self): ... |
89 | | - def terminal(self): ... |
90 | | - def cwd(self): ... |
91 | | - def memory_info(self): ... |
92 | | - memory_full_info: Incomplete |
93 | | - def status(self): ... |
94 | | - def open_files(self): ... |
95 | | - def num_fds(self): ... |
96 | | - def num_ctx_switches(self): ... |
97 | | - def wait(self, timeout: Incomplete | None = ...): ... |
98 | | - def io_counters(self): ... |
| 67 | + def disk_partitions(all: bool = False) -> list[_common.sdiskpart]: ... |
| 68 | + |
| 69 | + net_if_addrs = _psutil_aix.net_if_addrs |
| 70 | + net_io_counters = _psutil_aix.net_io_counters |
| 71 | + |
| 72 | + @overload |
| 73 | + def net_connections(kind: str, _pid: Literal[-1] = -1) -> list[_common.sconn]: ... |
| 74 | + @overload |
| 75 | + def net_connections(kind: str, _pid: int = -1) -> list[_common.pconn]: ... |
| 76 | + def net_if_stats() -> dict[str, _common.snicstats]: ... |
| 77 | + def boot_time() -> float: ... |
| 78 | + def users() -> list[_common.suser]: ... |
| 79 | + def pids() -> list[int]: ... |
| 80 | + def pid_exists(pid: int | str) -> bool: ... |
| 81 | + def wrap_exceptions(fun: Callable[_P, _R]) -> Callable[_P, _R]: ... |
| 82 | + |
| 83 | + class Process: |
| 84 | + __slots__ = ["_cache", "_name", "_ppid", "_procfs_path", "pid"] |
| 85 | + pid: int |
| 86 | + def __init__(self, pid: int) -> None: ... |
| 87 | + def oneshot_enter(self) -> None: ... |
| 88 | + def oneshot_exit(self) -> None: ... |
| 89 | + def name(self) -> str: ... |
| 90 | + def exe(self) -> str: ... |
| 91 | + def cmdline(self) -> list[str]: ... |
| 92 | + def environ(self) -> dict[str, str]: ... |
| 93 | + def create_time(self) -> float: ... |
| 94 | + def num_threads(self) -> int: ... |
| 95 | + def threads(self) -> list[_common.pthread]: ... |
| 96 | + def net_connections(self, kind: str = "inet") -> list[_common.pconn]: ... |
| 97 | + def nice_get(self) -> int: ... |
| 98 | + def nice_set(self, value: int) -> None: ... |
| 99 | + def ppid(self) -> int: ... |
| 100 | + def uids(self) -> _common.puids: ... |
| 101 | + def gids(self) -> _common.puids: ... |
| 102 | + def cpu_times(self) -> _common.pcputimes: ... |
| 103 | + def terminal(self) -> str | None: ... |
| 104 | + def cwd(self) -> str: ... |
| 105 | + def memory_info(self) -> pmem: ... |
| 106 | + memory_full_info = memory_info |
| 107 | + def status(self) -> str: ... |
| 108 | + def open_files(self) -> list[_common.popenfile]: ... |
| 109 | + def num_fds(self) -> int: ... |
| 110 | + def num_ctx_switches(self) -> _common.pctxsw: ... |
| 111 | + def wait(self, timeout: float | None = None): ... |
| 112 | + def io_counters(self) -> _common.pio: ... |
0 commit comments