Skip to content

Commit e2bc120

Browse files
authored
[psutil] Use Incomplete instead of Any (#15010)
1 parent 904ea9e commit e2bc120

File tree

9 files changed

+231
-236
lines changed

9 files changed

+231
-236
lines changed

stubs/psutil/psutil/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,11 @@ class Process:
172172
@property
173173
def pid(self) -> int: ...
174174
# Only present if attrs argument is passed to process_iter
175-
info: dict[str, Any]
175+
info: dict[str, Incomplete]
176176
def oneshot(self) -> AbstractContextManager[None]: ...
177177
def as_dict(
178178
self, attrs: list[str] | tuple[str, ...] | set[str] | frozenset[str] | None = None, ad_value=None
179-
) -> dict[str, Any]: ...
179+
) -> dict[str, Incomplete]: ...
180180
def parent(self) -> Process | None: ...
181181
def parents(self) -> list[Process]: ...
182182
def is_running(self) -> bool: ...

stubs/psutil/psutil/_common.pyi

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import enum
2-
from _typeshed import StrOrBytesPath, SupportsWrite
2+
from _typeshed import Incomplete, StrOrBytesPath, SupportsWrite
33
from collections.abc import Callable
44
from socket import AF_INET6 as AF_INET6, AddressFamily, SocketKind
5-
from typing import Any, Literal, NamedTuple, TypeVar, overload
5+
from typing import Literal, NamedTuple, TypeVar, overload
66

77
POSIX: bool
88
WINDOWS: bool
@@ -211,39 +211,39 @@ conn_tmap: dict[str, tuple[list[AddressFamily], list[SocketKind]]]
211211

212212
class Error(Exception):
213213
__module__: str
214-
msg: Any
214+
msg: Incomplete
215215
def __init__(self, msg: str = ...) -> None: ...
216216

217217
class NoSuchProcess(Error):
218218
__module__: str
219-
pid: Any
220-
name: Any
221-
msg: Any
219+
pid: Incomplete
220+
name: Incomplete
221+
msg: Incomplete
222222
def __init__(self, pid, name=None, msg=None) -> None: ...
223223

224224
class ZombieProcess(NoSuchProcess):
225225
__module__: str
226-
pid: Any
227-
ppid: Any
228-
name: Any
229-
msg: Any
226+
pid: Incomplete
227+
ppid: Incomplete
228+
name: Incomplete
229+
msg: Incomplete
230230
def __init__(self, pid, name=None, ppid=None, msg=None) -> None: ...
231231

232232
class AccessDenied(Error):
233233
__module__: str
234-
pid: Any
235-
name: Any
236-
msg: Any
234+
pid: Incomplete
235+
name: Incomplete
236+
msg: Incomplete
237237
def __init__(self, pid=None, name=None, msg=None) -> None: ...
238238

239239
class TimeoutExpired(Error):
240240
__module__: str
241-
seconds: Any
242-
pid: Any
243-
name: Any
241+
seconds: Incomplete
242+
pid: Incomplete
243+
name: Incomplete
244244
def __init__(self, seconds, pid=None, name=None) -> None: ...
245245

246-
_Func = TypeVar("_Func", bound=Callable[..., Any])
246+
_Func = TypeVar("_Func", bound=Callable[..., Incomplete])
247247

248248
def usage_percent(used, total, round_: int | None = None) -> float: ...
249249
def memoize(fun: _Func) -> _Func: ...
@@ -261,10 +261,10 @@ def conn_to_ntuple(fd: int, fam: int, type_: int, laddr, raddr, status: str, sta
261261
def deprecated_method(replacement: str) -> Callable[[_Func], _Func]: ...
262262

263263
class _WrapNumbers:
264-
lock: Any
265-
cache: Any
266-
reminders: Any
267-
reminder_keys: Any
264+
lock: Incomplete
265+
cache: Incomplete
266+
reminders: Incomplete
267+
reminder_keys: Incomplete
268268
def __init__(self) -> None: ...
269269
def run(self, input_dict, name): ...
270270
def cache_clear(self, name=None) -> None: ...

stubs/psutil/psutil/_psbsd.pyi

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from _typeshed import Incomplete
22
from contextlib import AbstractContextManager
3-
from typing import Any, NamedTuple
3+
from typing import NamedTuple
44

55
from psutil._common import (
66
FREEBSD as FREEBSD,
@@ -16,16 +16,16 @@ from psutil._common import (
1616
usage_percent as usage_percent,
1717
)
1818

19-
__extra__all__: Any
20-
PROC_STATUSES: Any
21-
TCP_STATUSES: Any
22-
PAGESIZE: Any
23-
AF_LINK: Any
24-
HAS_PER_CPU_TIMES: Any
25-
HAS_PROC_NUM_THREADS: Any
26-
HAS_PROC_OPEN_FILES: Any
27-
HAS_PROC_NUM_FDS: Any
28-
kinfo_proc_map: Any
19+
__extra__all__: Incomplete
20+
PROC_STATUSES: Incomplete
21+
TCP_STATUSES: Incomplete
22+
PAGESIZE: Incomplete
23+
AF_LINK: Incomplete
24+
HAS_PER_CPU_TIMES: Incomplete
25+
HAS_PROC_NUM_THREADS: Incomplete
26+
HAS_PROC_OPEN_FILES: Incomplete
27+
HAS_PROC_NUM_FDS: Incomplete
28+
kinfo_proc_map: Incomplete
2929

3030
class svmem(NamedTuple):
3131
total: int
@@ -48,44 +48,44 @@ class scputimes(NamedTuple):
4848
irq: float
4949

5050
class pmem(NamedTuple):
51-
rss: Any
52-
vms: Any
53-
text: Any
54-
data: Any
55-
stack: Any
51+
rss: Incomplete
52+
vms: Incomplete
53+
text: Incomplete
54+
data: Incomplete
55+
stack: Incomplete
5656

5757
pfullmem = pmem
5858

5959
class pcputimes(NamedTuple):
60-
user: Any
61-
system: Any
62-
children_user: Any
63-
children_system: Any
60+
user: Incomplete
61+
system: Incomplete
62+
children_user: Incomplete
63+
children_system: Incomplete
6464

6565
class pmmap_grouped(NamedTuple):
66-
path: Any
67-
rss: Any
68-
private: Any
69-
ref_count: Any
70-
shadow_count: Any
66+
path: Incomplete
67+
rss: Incomplete
68+
private: Incomplete
69+
ref_count: Incomplete
70+
shadow_count: Incomplete
7171

7272
class pmmap_ext(NamedTuple):
73-
addr: Any
74-
perms: Any
75-
path: Any
76-
rss: Any
77-
private: Any
78-
ref_count: Any
79-
shadow_count: Any
73+
addr: Incomplete
74+
perms: Incomplete
75+
path: Incomplete
76+
rss: Incomplete
77+
private: Incomplete
78+
ref_count: Incomplete
79+
shadow_count: Incomplete
8080

8181
class sdiskio(NamedTuple):
82-
read_count: Any
83-
write_count: Any
84-
read_bytes: Any
85-
write_bytes: Any
86-
read_time: Any
87-
write_time: Any
88-
busy_time: Any
82+
read_count: Incomplete
83+
write_count: Incomplete
84+
read_bytes: Incomplete
85+
write_bytes: Incomplete
86+
read_time: Incomplete
87+
write_time: Incomplete
88+
busy_time: Incomplete
8989

9090
def virtual_memory() -> svmem: ...
9191
def swap_memory(): ...
@@ -96,10 +96,10 @@ def cpu_count_cores() -> int | None: ...
9696
def cpu_stats(): ...
9797
def disk_partitions(all: bool = ...): ...
9898

99-
disk_usage: Any
100-
disk_io_counters: Any
101-
net_io_counters: Any
102-
net_if_addrs: Any
99+
disk_usage: Incomplete
100+
disk_io_counters: Incomplete
101+
net_io_counters: Incomplete
102+
net_if_addrs: Incomplete
103103

104104
def net_if_stats(): ...
105105
def net_connections(kind): ...
@@ -115,7 +115,7 @@ def wrap_exceptions(fun): ...
115115
def wrap_exceptions_procfs(inst) -> AbstractContextManager[None]: ...
116116

117117
class Process:
118-
pid: Any
118+
pid: Incomplete
119119
def __init__(self, pid) -> None: ...
120120
def oneshot(self): ...
121121
def oneshot_enter(self) -> None: ...
@@ -131,7 +131,7 @@ class Process:
131131
def cpu_times(self): ...
132132
def cpu_num(self): ...
133133
def memory_info(self): ...
134-
memory_full_info: Any
134+
memory_full_info: Incomplete
135135
def create_time(self): ...
136136
def num_threads(self): ...
137137
def num_ctx_switches(self): ...
@@ -145,20 +145,20 @@ class Process:
145145
def cwd(self): ...
146146

147147
class nt_mmap_grouped(NamedTuple):
148-
path: Any
149-
rss: Any
150-
private: Any
151-
ref_count: Any
152-
shadow_count: Any
148+
path: Incomplete
149+
rss: Incomplete
150+
private: Incomplete
151+
ref_count: Incomplete
152+
shadow_count: Incomplete
153153

154154
class nt_mmap_ext(NamedTuple):
155-
addr: Any
156-
perms: Any
157-
path: Any
158-
rss: Any
159-
private: Any
160-
ref_count: Any
161-
shadow_count: Any
155+
addr: Incomplete
156+
perms: Incomplete
157+
path: Incomplete
158+
rss: Incomplete
159+
private: Incomplete
160+
ref_count: Incomplete
161+
shadow_count: Incomplete
162162

163163
def open_files(self): ...
164164
def num_fds(self): ...

0 commit comments

Comments
 (0)