[psutil] Use Incomplete instead of Any (#15010)

This commit is contained in:
Semyon Moroz
2025-11-10 11:58:36 +04:00
committed by GitHub
parent 904ea9ec02
commit e2bc120079
9 changed files with 230 additions and 235 deletions
+2 -2
View File
@@ -172,11 +172,11 @@ class Process:
@property
def pid(self) -> int: ...
# Only present if attrs argument is passed to process_iter
info: dict[str, Any]
info: dict[str, Incomplete]
def oneshot(self) -> AbstractContextManager[None]: ...
def as_dict(
self, attrs: list[str] | tuple[str, ...] | set[str] | frozenset[str] | None = None, ad_value=None
) -> dict[str, Any]: ...
) -> dict[str, Incomplete]: ...
def parent(self) -> Process | None: ...
def parents(self) -> list[Process]: ...
def is_running(self) -> bool: ...
+21 -21
View File
@@ -1,8 +1,8 @@
import enum
from _typeshed import StrOrBytesPath, SupportsWrite
from _typeshed import Incomplete, StrOrBytesPath, SupportsWrite
from collections.abc import Callable
from socket import AF_INET6 as AF_INET6, AddressFamily, SocketKind
from typing import Any, Literal, NamedTuple, TypeVar, overload
from typing import Literal, NamedTuple, TypeVar, overload
POSIX: bool
WINDOWS: bool
@@ -211,39 +211,39 @@ conn_tmap: dict[str, tuple[list[AddressFamily], list[SocketKind]]]
class Error(Exception):
__module__: str
msg: Any
msg: Incomplete
def __init__(self, msg: str = ...) -> None: ...
class NoSuchProcess(Error):
__module__: str
pid: Any
name: Any
msg: Any
pid: Incomplete
name: Incomplete
msg: Incomplete
def __init__(self, pid, name=None, msg=None) -> None: ...
class ZombieProcess(NoSuchProcess):
__module__: str
pid: Any
ppid: Any
name: Any
msg: Any
pid: Incomplete
ppid: Incomplete
name: Incomplete
msg: Incomplete
def __init__(self, pid, name=None, ppid=None, msg=None) -> None: ...
class AccessDenied(Error):
__module__: str
pid: Any
name: Any
msg: Any
pid: Incomplete
name: Incomplete
msg: Incomplete
def __init__(self, pid=None, name=None, msg=None) -> None: ...
class TimeoutExpired(Error):
__module__: str
seconds: Any
pid: Any
name: Any
seconds: Incomplete
pid: Incomplete
name: Incomplete
def __init__(self, seconds, pid=None, name=None) -> None: ...
_Func = TypeVar("_Func", bound=Callable[..., Any])
_Func = TypeVar("_Func", bound=Callable[..., Incomplete])
def usage_percent(used, total, round_: int | None = None) -> float: ...
def memoize(fun: _Func) -> _Func: ...
@@ -261,10 +261,10 @@ def conn_to_ntuple(fd: int, fam: int, type_: int, laddr, raddr, status: str, sta
def deprecated_method(replacement: str) -> Callable[[_Func], _Func]: ...
class _WrapNumbers:
lock: Any
cache: Any
reminders: Any
reminder_keys: Any
lock: Incomplete
cache: Incomplete
reminders: Incomplete
reminder_keys: Incomplete
def __init__(self) -> None: ...
def run(self, input_dict, name): ...
def cache_clear(self, name=None) -> None: ...
+57 -57
View File
@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from contextlib import AbstractContextManager
from typing import Any, NamedTuple
from typing import NamedTuple
from psutil._common import (
FREEBSD as FREEBSD,
@@ -16,16 +16,16 @@ from psutil._common import (
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
__extra__all__: Incomplete
PROC_STATUSES: Incomplete
TCP_STATUSES: Incomplete
PAGESIZE: Incomplete
AF_LINK: Incomplete
HAS_PER_CPU_TIMES: Incomplete
HAS_PROC_NUM_THREADS: Incomplete
HAS_PROC_OPEN_FILES: Incomplete
HAS_PROC_NUM_FDS: Incomplete
kinfo_proc_map: Incomplete
class svmem(NamedTuple):
total: int
@@ -48,44 +48,44 @@ class scputimes(NamedTuple):
irq: float
class pmem(NamedTuple):
rss: Any
vms: Any
text: Any
data: Any
stack: Any
rss: Incomplete
vms: Incomplete
text: Incomplete
data: Incomplete
stack: Incomplete
pfullmem = pmem
class pcputimes(NamedTuple):
user: Any
system: Any
children_user: Any
children_system: Any
user: Incomplete
system: Incomplete
children_user: Incomplete
children_system: Incomplete
class pmmap_grouped(NamedTuple):
path: Any
rss: Any
private: Any
ref_count: Any
shadow_count: Any
path: Incomplete
rss: Incomplete
private: Incomplete
ref_count: Incomplete
shadow_count: Incomplete
class pmmap_ext(NamedTuple):
addr: Any
perms: Any
path: Any
rss: Any
private: Any
ref_count: Any
shadow_count: Any
addr: Incomplete
perms: Incomplete
path: Incomplete
rss: Incomplete
private: Incomplete
ref_count: Incomplete
shadow_count: Incomplete
class sdiskio(NamedTuple):
read_count: Any
write_count: Any
read_bytes: Any
write_bytes: Any
read_time: Any
write_time: Any
busy_time: Any
read_count: Incomplete
write_count: Incomplete
read_bytes: Incomplete
write_bytes: Incomplete
read_time: Incomplete
write_time: Incomplete
busy_time: Incomplete
def virtual_memory() -> svmem: ...
def swap_memory(): ...
@@ -96,10 +96,10 @@ def cpu_count_cores() -> int | None: ...
def cpu_stats(): ...
def disk_partitions(all: bool = ...): ...
disk_usage: Any
disk_io_counters: Any
net_io_counters: Any
net_if_addrs: Any
disk_usage: Incomplete
disk_io_counters: Incomplete
net_io_counters: Incomplete
net_if_addrs: Incomplete
def net_if_stats(): ...
def net_connections(kind): ...
@@ -115,7 +115,7 @@ def wrap_exceptions(fun): ...
def wrap_exceptions_procfs(inst) -> AbstractContextManager[None]: ...
class Process:
pid: Any
pid: Incomplete
def __init__(self, pid) -> None: ...
def oneshot(self): ...
def oneshot_enter(self) -> None: ...
@@ -131,7 +131,7 @@ class Process:
def cpu_times(self): ...
def cpu_num(self): ...
def memory_info(self): ...
memory_full_info: Any
memory_full_info: Incomplete
def create_time(self): ...
def num_threads(self): ...
def num_ctx_switches(self): ...
@@ -145,20 +145,20 @@ class Process:
def cwd(self): ...
class nt_mmap_grouped(NamedTuple):
path: Any
rss: Any
private: Any
ref_count: Any
shadow_count: Any
path: Incomplete
rss: Incomplete
private: Incomplete
ref_count: Incomplete
shadow_count: Incomplete
class nt_mmap_ext(NamedTuple):
addr: Any
perms: Any
path: Any
rss: Any
private: Any
ref_count: Any
shadow_count: Any
addr: Incomplete
perms: Incomplete
path: Incomplete
rss: Incomplete
private: Incomplete
ref_count: Incomplete
shadow_count: Incomplete
def open_files(self): ...
def num_fds(self): ...
+55 -55
View File
@@ -1,6 +1,6 @@
import enum
from _typeshed import Incomplete
from typing import Any, NamedTuple
from typing import NamedTuple
from psutil._common import (
NIC_DUPLEX_FULL as NIC_DUPLEX_FULL,
@@ -16,19 +16,19 @@ from psutil._common import (
usage_percent as usage_percent,
)
__extra__all__: Any
__extra__all__: Incomplete
POWER_SUPPLY_PATH: str
HAS_PROC_SMAPS: bool
HAS_PROC_SMAPS_ROLLUP: bool
HAS_PROC_IO_PRIORITY: Any
HAS_CPU_AFFINITY: Any
CLOCK_TICKS: Any
PAGESIZE: Any
BOOT_TIME: Any
LITTLE_ENDIAN: Any
HAS_PROC_IO_PRIORITY: Incomplete
HAS_CPU_AFFINITY: Incomplete
CLOCK_TICKS: Incomplete
PAGESIZE: Incomplete
BOOT_TIME: Incomplete
LITTLE_ENDIAN: Incomplete
DISK_SECTOR_SIZE: int
AF_LINK: Any
AddressFamily: Any
AF_LINK: Incomplete
AddressFamily: Incomplete
IOPRIO_CLASS_NONE: int
IOPRIO_CLASS_RT: int
IOPRIO_CLASS_BE: int
@@ -40,8 +40,8 @@ class IOPriority(enum.IntEnum):
IOPRIO_CLASS_BE = 2
IOPRIO_CLASS_IDLE = 3
PROC_STATUSES: Any
TCP_STATUSES: Any
PROC_STATUSES: Incomplete
TCP_STATUSES: Incomplete
class svmem(NamedTuple):
total: int
@@ -57,31 +57,31 @@ class svmem(NamedTuple):
slab: int
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
read_count: Incomplete
write_count: Incomplete
read_bytes: Incomplete
write_bytes: Incomplete
read_time: Incomplete
write_time: Incomplete
read_merged_count: Incomplete
write_merged_count: Incomplete
busy_time: Incomplete
class popenfile(NamedTuple):
path: Any
fd: Any
position: Any
mode: Any
flags: Any
path: Incomplete
fd: Incomplete
position: Incomplete
mode: Incomplete
flags: Incomplete
class pmem(NamedTuple):
rss: Any
vms: Any
shared: Any
text: Any
lib: Any
data: Any
dirty: Any
rss: Incomplete
vms: Incomplete
shared: Incomplete
text: Incomplete
lib: Incomplete
data: Incomplete
dirty: Incomplete
class pfullmem(NamedTuple):
rss: Incomplete
@@ -96,27 +96,27 @@ class pfullmem(NamedTuple):
swap: Incomplete
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
path: Incomplete
rss: Incomplete
size: Incomplete
pss: Incomplete
shared_clean: Incomplete
shared_dirty: Incomplete
private_clean: Incomplete
private_dirty: Incomplete
referenced: Incomplete
anonymous: Incomplete
swap: Incomplete
pmmap_ext: Any
pmmap_ext: Incomplete
class pio(NamedTuple):
read_count: Any
write_count: Any
read_bytes: Any
write_bytes: Any
read_chars: Any
write_chars: Any
read_count: Incomplete
write_count: Incomplete
read_bytes: Incomplete
write_bytes: Incomplete
read_chars: Incomplete
write_chars: Incomplete
class pcputimes(NamedTuple):
user: float
@@ -154,12 +154,12 @@ def cpu_count_cores() -> int | None: ...
def cpu_stats(): ...
def cpu_freq(): ...
net_if_addrs: Any
net_if_addrs: Incomplete
class _Ipv6UnsupportedError(Exception): ...
class NetConnections:
tmap: Any
tmap: Incomplete
def __init__(self) -> None: ...
def get_proc_inodes(self, pid): ...
def get_all_inodes(self): ...
@@ -175,7 +175,7 @@ def net_connections(kind: str = ...): ...
def net_io_counters(): ...
def net_if_stats(): ...
disk_usage: Any
disk_usage: Incomplete
def disk_io_counters(perdisk: bool = ...): ...
@@ -200,7 +200,7 @@ def ppid_map(): ...
def wrap_exceptions(fun): ...
class Process:
pid: Any
pid: Incomplete
def __init__(self, pid) -> None: ...
def oneshot_enter(self) -> None: ...
def oneshot_exit(self) -> None: ...
+18 -18
View File
@@ -1,5 +1,5 @@
from _typeshed import Incomplete
from typing import Any, NamedTuple
from typing import NamedTuple
from psutil._common import (
AccessDenied as AccessDenied,
@@ -12,13 +12,13 @@ from psutil._common import (
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
__extra__all__: Incomplete
PAGESIZE: Incomplete
AF_LINK: Incomplete
TCP_STATUSES: Incomplete
PROC_STATUSES: Incomplete
kinfo_proc_map: Incomplete
pidtaskinfo_map: Incomplete
class scputimes(NamedTuple):
user: float
@@ -37,10 +37,10 @@ class svmem(NamedTuple):
wired: int
class pmem(NamedTuple):
rss: Any
vms: Any
pfaults: Any
pageins: Any
rss: Incomplete
vms: Incomplete
pfaults: Incomplete
pageins: Incomplete
class pfullmem(NamedTuple):
rss: Incomplete
@@ -58,14 +58,14 @@ def cpu_count_cores() -> int | None: ...
def cpu_stats(): ...
def cpu_freq(): ...
disk_usage: Any
disk_io_counters: Any
disk_usage: Incomplete
disk_io_counters: Incomplete
def disk_partitions(all: bool = False): ...
def sensors_battery(): ...
net_io_counters: Any
net_if_addrs: Any
net_io_counters: Incomplete
net_if_addrs: Incomplete
def net_connections(kind: str = "inet"): ...
def net_if_stats(): ...
@@ -73,14 +73,14 @@ def boot_time(): ...
def users(): ...
def pids(): ...
pid_exists: Any
pid_exists: Incomplete
def is_zombie(pid): ...
def wrap_exceptions(fun): ...
class Process:
__slots__ = ["_cache", "_name", "_ppid", "pid"]
pid: Any
pid: Incomplete
def __init__(self, pid) -> None: ...
def oneshot_enter(self) -> None: ...
def oneshot_exit(self) -> None: ...
+9 -11
View File
@@ -1,17 +1,15 @@
from typing import Any
DUPLEX_FULL: int
DUPLEX_HALF: int
DUPLEX_UNKNOWN: int
version: int
def check_pid_range(pid: int, /) -> None: ...
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_debug(*args, **kwargs) -> Any: ...
def users(*args, **kwargs) -> Any: ...
def disk_partitions(*args, **kwargs): ...
def linux_sysinfo(*args, **kwargs): ...
def net_if_duplex_speed(*args, **kwargs): ...
def proc_cpu_affinity_get(*args, **kwargs): ...
def proc_cpu_affinity_set(*args, **kwargs): ...
def proc_ioprio_get(*args, **kwargs): ...
def proc_ioprio_set(*args, **kwargs): ...
def set_debug(*args, **kwargs): ...
def users(*args, **kwargs): ...
+29 -31
View File
@@ -1,5 +1,3 @@
from typing import Any
PSUTIL_CONN_NONE: int
SIDL: int
SRUN: int
@@ -19,33 +17,33 @@ TCPS_SYN_SENT: int
TCPS_TIME_WAIT: int
version: int
def boot_time(*args, **kwargs) -> Any: ...
def boot_time(*args, **kwargs): ...
def check_pid_range(pid: int, /) -> None: ...
def cpu_count_cores(*args, **kwargs) -> Any: ...
def cpu_count_logical(*args, **kwargs) -> Any: ...
def cpu_freq(*args, **kwargs) -> Any: ...
def cpu_stats(*args, **kwargs) -> Any: ...
def cpu_times(*args, **kwargs) -> Any: ...
def disk_io_counters(*args, **kwargs) -> Any: ...
def disk_partitions(*args, **kwargs) -> Any: ...
def disk_usage_used(*args, **kwargs) -> Any: ...
def net_io_counters(*args, **kwargs) -> Any: ...
def per_cpu_times(*args, **kwargs) -> Any: ...
def pids(*args, **kwargs) -> Any: ...
def proc_cmdline(*args, **kwargs) -> Any: ...
def proc_net_connections(*args, **kwargs) -> Any: ...
def proc_cwd(*args, **kwargs) -> Any: ...
def proc_environ(*args, **kwargs) -> Any: ...
def proc_exe(*args, **kwargs) -> Any: ...
def proc_kinfo_oneshot(*args, **kwargs) -> Any: ...
def proc_memory_uss(*args, **kwargs) -> Any: ...
def proc_name(*args, **kwargs) -> Any: ...
def proc_num_fds(*args, **kwargs) -> Any: ...
def proc_open_files(*args, **kwargs) -> Any: ...
def proc_pidtaskinfo_oneshot(*args, **kwargs) -> Any: ...
def proc_threads(*args, **kwargs) -> Any: ...
def sensors_battery(*args, **kwargs) -> Any: ...
def set_debug(*args, **kwargs) -> Any: ...
def swap_mem(*args, **kwargs) -> Any: ...
def users(*args, **kwargs) -> Any: ...
def virtual_mem(*args, **kwargs) -> Any: ...
def cpu_count_cores(*args, **kwargs): ...
def cpu_count_logical(*args, **kwargs): ...
def cpu_freq(*args, **kwargs): ...
def cpu_stats(*args, **kwargs): ...
def cpu_times(*args, **kwargs): ...
def disk_io_counters(*args, **kwargs): ...
def disk_partitions(*args, **kwargs): ...
def disk_usage_used(*args, **kwargs): ...
def net_io_counters(*args, **kwargs): ...
def per_cpu_times(*args, **kwargs): ...
def pids(*args, **kwargs): ...
def proc_cmdline(*args, **kwargs): ...
def proc_net_connections(*args, **kwargs): ...
def proc_cwd(*args, **kwargs): ...
def proc_environ(*args, **kwargs): ...
def proc_exe(*args, **kwargs): ...
def proc_kinfo_oneshot(*args, **kwargs): ...
def proc_memory_uss(*args, **kwargs): ...
def proc_name(*args, **kwargs): ...
def proc_num_fds(*args, **kwargs): ...
def proc_open_files(*args, **kwargs): ...
def proc_pidtaskinfo_oneshot(*args, **kwargs): ...
def proc_threads(*args, **kwargs): ...
def sensors_battery(*args, **kwargs): ...
def set_debug(*args, **kwargs): ...
def swap_mem(*args, **kwargs): ...
def users(*args, **kwargs): ...
def virtual_mem(*args, **kwargs): ...
+7 -8
View File
@@ -1,5 +1,4 @@
import sys
from typing import Any
if sys.platform == "linux":
RLIMIT_AS: int
@@ -20,15 +19,15 @@ if sys.platform == "linux":
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_flags(*args, **kwargs) -> Any: ...
def net_if_is_running(*args, **kwargs) -> Any: ...
def net_if_mtu(*args, **kwargs) -> Any: ...
def getpagesize(*args, **kwargs): ...
def getpriority(*args, **kwargs): ...
def net_if_addrs(*args, **kwargs): ...
def net_if_flags(*args, **kwargs): ...
def net_if_is_running(*args, **kwargs): ...
def net_if_mtu(*args, **kwargs): ...
if sys.platform == "darwin":
AF_LINK: int
def net_if_duplex_speed(*args, **kwargs): ...
def setpriority(*args, **kwargs) -> Any: ...
def setpriority(*args, **kwargs): ...
+32 -32
View File
@@ -1,7 +1,7 @@
import enum
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import Any, NamedTuple
from typing import NamedTuple
from psutil import _psutil_windows
from psutil._common import (
@@ -26,13 +26,13 @@ from psutil._psutil_windows import (
REALTIME_PRIORITY_CLASS as REALTIME_PRIORITY_CLASS,
)
__extra__all__: Any
__extra__all__: Incomplete
CONN_DELETE_TCB: str
ERROR_PARTIAL_COPY: int
PYPY: Any
PYPY: Incomplete
AF_LINK: int
AddressFamily: Any
TCP_STATUSES: Any
AddressFamily: Incomplete
TCP_STATUSES: Incomplete
# These noqas workaround https://github.com/astral-sh/ruff/issues/10874
class Priority(enum.IntEnum):
@@ -54,7 +54,7 @@ class IOPriority(enum.IntEnum):
IOPRIO_NORMAL = 2
IOPRIO_HIGH = 3
pinfo_map: Any
pinfo_map: Incomplete
class scputimes(NamedTuple):
user: float
@@ -71,18 +71,18 @@ class svmem(NamedTuple):
free: int
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
rss: Incomplete
vms: Incomplete
num_page_faults: Incomplete
peak_wset: Incomplete
wset: Incomplete
peak_paged_pool: Incomplete
paged_pool: Incomplete
peak_nonpaged_pool: Incomplete
nonpaged_pool: Incomplete
pagefile: Incomplete
peak_pagefile: Incomplete
private: Incomplete
class pfullmem(NamedTuple):
rss: Incomplete
@@ -100,25 +100,25 @@ class pfullmem(NamedTuple):
uss: Incomplete
class pmmap_grouped(NamedTuple):
path: Any
rss: Any
path: Incomplete
rss: Incomplete
pmmap_ext: Any
pmmap_ext: Incomplete
class pio(NamedTuple):
read_count: Any
write_count: Any
read_bytes: Any
write_bytes: Any
other_count: Any
other_bytes: Any
read_count: Incomplete
write_count: Incomplete
read_bytes: Incomplete
write_bytes: Incomplete
other_count: Incomplete
other_bytes: Incomplete
def convert_dos_path(s): ...
def getpagesize(): ...
def virtual_memory() -> svmem: ...
def swap_memory(): ...
disk_io_counters: Any
disk_io_counters: Incomplete
def disk_usage(path): ...
def disk_partitions(all): ...
@@ -153,9 +153,9 @@ class WindowsService:
def description(self): ...
def as_dict(self): ...
pids: Any
pid_exists: Any
ppid_map: Any
pids: Incomplete
pid_exists: Incomplete
ppid_map: Incomplete
def is_permission_err(exc): ...
def convert_oserror(exc, pid=None, name=None): ...
@@ -163,7 +163,7 @@ def wrap_exceptions(fun): ...
def retry_error_partial_copy(fun): ...
class Process:
pid: Any
pid: Incomplete
def __init__(self, pid) -> None: ...
def oneshot_enter(self) -> None: ...
def oneshot_exit(self) -> None: ...