10000 Further annotations for the psutil module (#6066) · python/typeshed@2217ac8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2217ac8

Browse files
authored
Further annotations for the psutil module (#6066)
1 parent 3bc309d commit 2217ac8

File tree

1 file changed

+34
-21
lines changed

1 file changed

+34
-21
lines changed

stubs/psutil/psutil/__init__.pyi

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from typing import Any, ContextManager
2+
from typing import Any, Callable, ContextManager, Iterable, Iterator
33

44
from ._common import (
55
AIX as AIX,
@@ -54,6 +54,17 @@ from ._common import (
5454
popenfile,
5555
pthread,
5656
puids,
57+
sconn,
58+
scpufreq,
59+
scpustats,
60+
sdiskio,
61+
sdiskpart,
62+
sdiskusage,
63+
snetio,
64+
snicaddr,
65+
snicstats,
66+
sswap,
67+
suser,
5768
)
5869

5970
if sys.platform == "linux":
@@ -154,26 +165,28 @@ class Popen(Process):
154165
def __getattribute__(self, name): ...
155166
def wait(self, timeout: Any | None = ...): ...
156167

157-
def pids(): ...
158-
def pid_exists(pid): ...
159-
def process_iter(attrs: Any | None = ..., ad_value: Any | None = ...): ...
160-
def wait_procs(procs, timeout: Any | None = ..., callback: Any | None = ...): ...
161-
def cpu_count(logical: bool = ...): ...
168+
def pids() -> list[int]: ...
169+
def pid_exists(pid: int) -> bool: ...
170+
def process_iter(attrs: Any | None = ..., ad_value: Any | None = ...) -> Iterator[Process]: ...
171+
def wait_procs(
172+
procs: Iterable[Process], timeout: float | None = ..., callback: Callable[[Process], Any] | None = ...
173+
) -> tuple[list[Process], list[Process]]: ...
174+
def cpu_count(logical: bool = ...) -> int: ...
162175
def cpu_times(percpu: bool = ...): ...
163-
def cpu_percent(interval: Any | None = ..., percpu: bool = ...): ...
164-
def cpu_times_percent(interval: Any | None = ..., percpu: bool = ...): ...
165-
def cpu_stats(): ...
166-
def cpu_freq(percpu: bool = ...): ...
167-
def getloadavg(): ...
176+
def cpu_percent(interval: float | None = ..., percpu: bool = ...) -> float: ...
177+
def cpu_times_percent(interval: float | None = ..., percpu: bool = ...): ...
178+
def cpu_stats() -> scpustats: ...
179+
def cpu_freq(percpu: bool = ...) -> scpufreq: ...
180+
def getloadavg() -> tuple[float, float, float]: ...
168181
def virtual_memory(): ...
169-
def swap_memory(): ...
170-
def disk_usage(path): ...
171-
def disk_partitions(all: bool = ...): ...
172-
def disk_io_counters(perdisk: bool = ..., nowrap: bool = ...): ...
173-
def net_io_counters(pernic: bool = ..., nowrap: bool = ...): ...
174-
def net_connections(kind: str = ...): ...
175-
def net_if_addrs(): ...
176-
def net_if_stats(): ...
182+
def swap_memory() -> sswap: ...
183+
def disk_usage(path: str) -> sdiskusage: ...
184+
def disk_partitions(all: bool = ...) -> list[sdiskpart]: ...
185+
def disk_io_counters(perdisk: bool = ..., nowrap: bool = ...) -> sdiskio: ...
186+
def net_io_counters(pernic: bool = ..., nowrap: bool = ...) -> snetio: ...
187+
def net_connections(kind: str = ...) -> list[sconn]: ...
188+
def net_if_addrs() -> dict[str, list[snicaddr]]: ...
189+
def net_if_stats() -> dict[str, snicstats]: ...
177190

178191
if sys.platform == "linux":
179192
def sensors_temperatures(fahrenheit: bool = ...): ...
@@ -182,8 +195,8 @@ if sys.platform == "linux":
182195
if sys.platform != "win32":
183196
def sensors_battery(): ...
184197

185-
def boot_time(): ...
186-
def users(): ...
198+
def boot_time() -> float: ...
199+
def users() -> list[suser]: ...
187200

188201
if sys.platform == "linux":
189202
RLIMIT_AS: int

0 commit comments

Comments
 (0)
0