massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / psutil / psutil / _common.pyi
1 import enum
2 from _typeshed import StrOrBytesPath, SupportsWrite
3 from socket import AddressFamily, SocketKind
4 from typing import Any, Callable, NamedTuple, TypeVar, overload
5 from typing_extensions import Literal
6
7 POSIX: bool
8 WINDOWS: bool
9 LINUX: bool
10 MACOS: bool
11 OSX: bool
12 FREEBSD: bool
13 OPENBSD: bool
14 NETBSD: bool
15 BSD: bool
16 SUNOS: bool
17 AIX: bool
18
19 STATUS_RUNNING: Literal["running"]
20 STATUS_SLEEPING: Literal["sleeping"]
21 STATUS_DISK_SLEEP: Literal["disk-sleep"]
22 STATUS_STOPPED: Literal["stopped"]
23 STATUS_TRACING_STOP: Literal["tracing-stop"]
24 STATUS_ZOMBIE: Literal["zombie"]
25 STATUS_DEAD: Literal["dead"]
26 STATUS_WAKE_KILL: Literal["wake-kill"]
27 STATUS_WAKING: Literal["waking"]
28 STATUS_IDLE: Literal["idle"]
29 STATUS_LOCKED: Literal["locked"]
30 STATUS_WAITING: Literal["waiting"]
31 STATUS_SUSPENDED: Literal["suspended"]
32 STATUS_PARKED: Literal["parked"]
33
34 _Status = Literal[
35     "running",
36     "sleeping",
37     "disk-sleep",
38     "stopped",
39     "tracing-stop",
40     "zombie",
41     "dead",
42     "wake-kill",
43     "waking",
44     "idle",
45     "locked",
46     "waiting",
47     "suspended",
48     "parked",
49 ]
50
51 CONN_ESTABLISHED: str
52 CONN_SYN_SENT: str
53 CONN_SYN_RECV: str
54 CONN_FIN_WAIT1: str
55 CONN_FIN_WAIT2: str
56 CONN_TIME_WAIT: str
57 CONN_CLOSE: str
58 CONN_CLOSE_WAIT: str
59 CONN_LAST_ACK: str
60 CONN_LISTEN: str
61 CONN_CLOSING: str
62 CONN_NONE: str
63 NIC_DUPLEX_FULL: int
64 NIC_DUPLEX_HALF: int
65 NIC_DUPLEX_UNKNOWN: int
66
67 class NicDuplex(enum.IntEnum):
68     NIC_DUPLEX_FULL: int
69     NIC_DUPLEX_HALF: int
70     NIC_DUPLEX_UNKNOWN: int
71
72 POWER_TIME_UNKNOWN: int
73 POWER_TIME_UNLIMITED: int
74
75 class BatteryTime(enum.IntEnum):
76     POWER_TIME_UNKNOWN: int
77     POWER_TIME_UNLIMITED: int
78
79 ENCODING: str
80 ENCODING_ERRS: str
81
82 class sswap(NamedTuple):
83     total: int
84     used: int
85     free: int
86     percent: float
87     sin: int
88     sout: int
89
90 class sdiskusage(NamedTuple):
91     total: int
92     used: int
93     free: int
94     percent: float
95
96 class sdiskio(NamedTuple):
97     read_count: int
98     write_count: int
99     read_bytes: int
100     write_bytes: int
101     read_time: int
102     write_time: int
103
104 class sdiskpart(NamedTuple):
105     device: str
106     mountpoint: str
107     fstype: str
108     opts: str
109     maxfile: int
110     maxpath: int
111
112 class snetio(NamedTuple):
113     bytes_sent: int
114     bytes_recv: int
115     packets_sent: int
116     packets_recv: int
117     errin: int
118     errout: int
119     dropin: int
120     dropout: int
121
122 class suser(NamedTuple):
123     name: str
124     terminal: str | None
125     host: str | None
126     started: float
127     pid: str
128
129 class sconn(NamedTuple):
130     fd: int
131     family: AddressFamily
132     type: SocketKind
133     laddr: str
134     raddr: str
135     status: str
136     pid: int
137
138 class snicaddr(NamedTuple):
139     family: AddressFamily
140     address: str
141     netmask: str | None
142     broadcast: str | None
143     ptp: str | None
144
145 class snicstats(NamedTuple):
146     isup: bool
147     duplex: int
148     speed: int
149     mtu: int
150
151 class scpustats(NamedTuple):
152     ctx_switches: int
153     interrupts: int
154     soft_interrupts: int
155     syscalls: int
156
157 class scpufreq(NamedTuple):
158     current: float
159     min: float
160     max: float
161
162 class shwtemp(NamedTuple):
163     label: str
164     current: float
165     high: float | None
166     critical: float | None
167
168 class sbattery(NamedTuple):
169     percent: int
170     secsleft: int
171     power_plugged: bool
172
173 class sfan(NamedTuple):
174     label: str
175     current: int
176
177 class pcputimes(NamedTuple):
178     user: float
179     system: float
180     children_user: float
181     children_system: float
182
183 class popenfile(NamedTuple):
184     path: str
185     fd: int
186
187 class pthread(NamedTuple):
188     id: int
189     user_time: float
190     system_time: float
191
192 class puids(NamedTuple):
193     real: int
194     effective: int
195     saved: int
196
197 class pgids(NamedTuple):
198     real: int
199     effective: int
200     saved: int
201
202 class pio(NamedTuple):
203     read_count: int
204     write_count: int
205     read_bytes: int
206     write_bytes: int
207
208 class pionice(NamedTuple):
209     ioclass: int
210     value: int
211
212 class pctxsw(NamedTuple):
213     voluntary: int
214     involuntary: int
215
216 class pconn(NamedTuple):
217     fd: int
218     family: AddressFamily
219     type: SocketKind
220     laddr: addr
221     raddr: addr
222     status: str
223
224 class addr(NamedTuple):
225     ip: str
226     port: int
227
228 conn_tmap: dict[str, tuple[list[AddressFamily], list[SocketKind]]]
229
230 class Error(Exception):
231     __module__: str
232     msg: Any
233     def __init__(self, msg: str = ...) -> None: ...
234
235 class NoSuchProcess(Error):
236     __module__: str
237     pid: Any
238     name: Any
239     msg: Any
240     def __init__(self, pid, name: Any | None = ..., msg: Any | None = ...) -> None: ...
241
242 class ZombieProcess(NoSuchProcess):
243     __module__: str
244     pid: Any
245     ppid: Any
246     name: Any
247     msg: Any
248     def __init__(self, pid, name: Any | None = ..., ppid: Any | None = ..., msg: Any | None = ...) -> None: ...
249
250 class AccessDenied(Error):
251     __module__: str
252     pid: Any
253     name: Any
254     msg: Any
255     def __init__(self, pid: Any | None = ..., name: Any | None = ..., msg: Any | None = ...) -> None: ...
256
257 class TimeoutExpired(Error):
258     __module__: str
259     seconds: Any
260     pid: Any
261     name: Any
262     def __init__(self, seconds, pid: Any | None = ..., name: Any | None = ...) -> None: ...
263
264 _Func = TypeVar("_Func", bound=Callable[..., Any])
265
266 def usage_percent(used, total, round_: int | None = ...) -> float: ...
267 def memoize(fun: _Func) -> _Func: ...
268 def memoize_when_activated(fun: _Func) -> _Func: ...
269 def isfile_strict(path: StrOrBytesPath) -> bool: ...
270 def path_exists_strict(path: StrOrBytesPath) -> bool: ...
271 def supports_ipv6() -> bool: ...
272 def parse_environ_block(data): ...
273 def sockfam_to_enum(num: int) -> AddressFamily: ...
274 def socktype_to_enum(num: int) -> SocketKind: ...
275 @overload
276 def conn_to_ntuple(fd: int, fam: int, type_: int, laddr, raddr, status: str, status_map, pid: int) -> sconn: ...
277 @overload
278 def conn_to_ntuple(fd: int, fam: int, type_: int, laddr, raddr, status: str, status_map, pid: None = ...) -> pconn: ...
279 def deprecated_method(replacement: str) -> Callable[[_Func], _Func]: ...
280
281 class _WrapNumbers:
282     lock: Any
283     cache: Any
284     reminders: Any
285     reminder_keys: Any
286     def __init__(self) -> None: ...
287     def run(self, input_dict, name): ...
288     def cache_clear(self, name: Any | None = ...) -> None: ...
289     def cache_info(self): ...
290
291 def wrap_numbers(input_dict, name: str): ...
292 def bytes2human(n: int, format: str = ...) -> str: ...
293 def get_procfs_path() -> str: ...
294 def term_supports_colors(file: SupportsWrite[str] = ...) -> bool: ...
295 def hilite(s: str, color: str | None = ..., bold: bool = ...) -> str: ...
296 def print_color(s: str, color: str | None = ..., bold: bool = ..., file: SupportsWrite[str] = ...) -> None: ...
297 def debug(msg) -> None: ...