[psutil] Complete Windows stubs (#15015)

This commit is contained in:
Semyon Moroz
2025-11-15 00:53:46 +04:00
committed by GitHub
parent ead68af433
commit 23c65436f5
5 changed files with 316 additions and 274 deletions
@@ -1,6 +1,5 @@
psutil._pslinux
psutil._psosx
psutil._psutil_linux
psutil._psutil_osx
psutil._psutil_posix
+4 -1
View File
@@ -2,6 +2,7 @@ import sys
from _typeshed import Incomplete
from collections.abc import Callable, Iterable, Iterator
from contextlib import AbstractContextManager
from types import TracebackType
from typing import Any, Literal, Protocol, overload, type_check_only
from typing_extensions import Self, TypeAlias, deprecated
@@ -230,7 +231,9 @@ class Process:
class Popen(Process):
def __init__(self, *args, **kwargs) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(self, *args: object, **kwargs: object) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __getattribute__(self, name: str) -> Any: ...
def __dir__(self) -> list[str]: ...
+1 -1
View File
@@ -251,7 +251,7 @@ def memoize_when_activated(fun: _Func) -> _Func: ...
def isfile_strict(path: StrOrBytesPath) -> bool: ...
def path_exists_strict(path: StrOrBytesPath) -> bool: ...
def supports_ipv6() -> bool: ...
def parse_environ_block(data): ...
def parse_environ_block(data: str) -> dict[str, str]: ...
def sockfam_to_enum(num: int) -> AddressFamily: ...
def socktype_to_enum(num: int) -> SocketKind: ...
@overload
+100 -91
View File
@@ -1,94 +1,103 @@
from typing import Final
import sys
ABOVE_NORMAL_PRIORITY_CLASS: Final = 32768
BELOW_NORMAL_PRIORITY_CLASS: Final = 16384
ERROR_ACCESS_DENIED: int
ERROR_INVALID_NAME: int
ERROR_PRIVILEGE_NOT_HELD: int
ERROR_SERVICE_DOES_NOT_EXIST: int
HIGH_PRIORITY_CLASS: Final = 128
IDLE_PRIORITY_CLASS: Final = 64
INFINITE: int
MIB_TCP_STATE_CLOSED: int
MIB_TCP_STATE_CLOSE_WAIT: int
MIB_TCP_STATE_CLOSING: int
MIB_TCP_STATE_DELETE_TCB: int
MIB_TCP_STATE_ESTAB: int
MIB_TCP_STATE_FIN_WAIT1: int
MIB_TCP_STATE_FIN_WAIT2: int
MIB_TCP_STATE_LAST_ACK: int
MIB_TCP_STATE_LISTEN: int
MIB_TCP_STATE_SYN_RCVD: int
MIB_TCP_STATE_SYN_SENT: int
MIB_TCP_STATE_TIME_WAIT: int
NORMAL_PRIORITY_CLASS: Final = 32
PSUTIL_CONN_NONE: int
REALTIME_PRIORITY_CLASS: Final = 256
WINDOWS_10: int
WINDOWS_7: int
WINDOWS_8: int
WINDOWS_8_1: int
WINDOWS_VISTA: int
WINVER: int
version: int
if sys.platform == "win32":
from collections.abc import Sequence
from socket import AddressFamily, SocketKind
from typing import Final
class TimeoutAbandoned(Exception): ...
class TimeoutExpired(Exception): ...
version: Final[int]
ABOVE_NORMAL_PRIORITY_CLASS: Final = 32768
BELOW_NORMAL_PRIORITY_CLASS: Final = 16384
HIGH_PRIORITY_CLASS: Final = 128
IDLE_PRIORITY_CLASS: Final = 64
NORMAL_PRIORITY_CLASS: Final = 32
REALTIME_PRIORITY_CLASS: Final = 256
MIB_TCP_STATE_CLOSED: Final = 1
MIB_TCP_STATE_CLOSING: Final = 9
MIB_TCP_STATE_CLOSE_WAIT: Final = 8
MIB_TCP_STATE_LISTEN: Final = 2
MIB_TCP_STATE_ESTAB: Final = 5
MIB_TCP_STATE_SYN_SENT: Final = 3
MIB_TCP_STATE_SYN_RCVD: Final = 4
MIB_TCP_STATE_FIN_WAIT1: Final = 6
MIB_TCP_STATE_FIN_WAIT2: Final = 7
MIB_TCP_STATE_LAST_ACK: Final = 10
MIB_TCP_STATE_TIME_WAIT: Final = 11
MIB_TCP_STATE_DELETE_TCB: Final = 12
PSUTIL_CONN_NONE: Final = 128
INFINITE: Final[int]
ERROR_ACCESS_DENIED: Final = 5
ERROR_INVALID_NAME: Final = 123
ERROR_SERVICE_DOES_NOT_EXIST: Final = 1060
ERROR_PRIVILEGE_NOT_HELD: Final = 1314
WINVER: Final[int]
WINDOWS_VISTA: Final = 60
WINDOWS_7: Final = 61
WINDOWS_8: Final = 62
WINDOWS_8_1: Final = 63
WINDOWS_10: Final = 100
def QueryDosDevice(*args, **kwargs): ... # incomplete
def boot_time(*args, **kwargs): ... # incomplete
def check_pid_range(pid: int, /) -> None: ...
def cpu_count_cores(*args, **kwargs): ... # incomplete
def cpu_count_logical(*args, **kwargs): ... # incomplete
def cpu_freq(*args, **kwargs): ... # incomplete
def cpu_stats(*args, **kwargs): ... # incomplete
def cpu_times(*args, **kwargs): ... # incomplete
def disk_io_counters(*args, **kwargs): ... # incomplete
def disk_partitions(*args, **kwargs): ... # incomplete
def disk_usage(*args, **kwargs): ... # incomplete
def getloadavg(*args, **kwargs): ... # incomplete
def getpagesize(*args, **kwargs): ... # incomplete
def init_loadavg_counter(*args, **kwargs): ... # incomplete
def net_connections(*args, **kwargs): ... # incomplete
def net_if_addrs(*args, **kwargs): ... # incomplete
def net_if_stats(*args, **kwargs): ... # incomplete
def net_io_counters(*args, **kwargs): ... # incomplete
def per_cpu_times(*args, **kwargs): ... # incomplete
def pid_exists(*args, **kwargs): ... # incomplete
def pids(*args, **kwargs): ... # incomplete
def ppid_map(*args, **kwargs): ... # incomplete
def proc_cmdline(*args, **kwargs): ... # incomplete
def proc_cpu_affinity_get(*args, **kwargs): ... # incomplete
def proc_cpu_affinity_set(*args, **kwargs): ... # incomplete
def proc_cwd(*args, **kwargs): ... # incomplete
def proc_environ(*args, **kwargs): ... # incomplete
def proc_exe(*args, **kwargs): ... # incomplete
def proc_info(*args, **kwargs): ... # incomplete
def proc_io_counters(*args, **kwargs): ... # incomplete
def proc_io_priority_get(*args, **kwargs): ... # incomplete
def proc_io_priority_set(*args, **kwargs): ... # incomplete
def proc_is_suspended(*args, **kwargs): ... # incomplete
def proc_kill(*args, **kwargs): ... # incomplete
def proc_memory_info(*args, **kwargs): ... # incomplete
def proc_memory_maps(*args, **kwargs): ... # incomplete
def proc_memory_uss(*args, **kwargs): ... # incomplete
def proc_num_handles(*args, **kwargs): ... # incomplete
def proc_open_files(*args, **kwargs): ... # incomplete
def proc_priority_get(*args, **kwargs): ... # incomplete
def proc_priority_set(*args, **kwargs): ... # incomplete
def proc_suspend_or_resume(*args, **kwargs): ... # incomplete
def proc_threads(*args, **kwargs): ... # incomplete
def proc_times(*args, **kwargs): ... # incomplete
def proc_username(*args, **kwargs): ... # incomplete
def proc_wait(*args, **kwargs): ... # incomplete
def sensors_battery(*args, **kwargs): ... # incomplete
def set_debug(*args, **kwargs): ... # incomplete
def swap_percent(*args, **kwargs): ... # incomplete
def users(*args, **kwargs): ... # incomplete
def virtual_mem(*args, **kwargs): ... # incomplete
def winservice_enumerate(*args, **kwargs): ... # incomplete
def winservice_query_config(*args, **kwargs): ... # incomplete
def winservice_query_descr(*args, **kwargs): ... # incomplete
def winservice_query_status(*args, **kwargs): ... # incomplete
def winservice_start(*args, **kwargs): ... # incomplete
def winservice_stop(*args, **kwargs): ... # incomplete
class TimeoutAbandoned(Exception): ...
class TimeoutExpired(Exception): ...
def proc_cmdline(pid: int, use_peb: bool = True) -> list[str]: ...
def proc_cpu_affinity_get(pid: int, /) -> int: ...
def proc_cpu_affinity_set(pid: int, mask: int, /) -> None: ...
def proc_cwd(pid: int, /) -> str: ...
def proc_environ(pid: int, /) -> str: ...
def proc_exe(pid: int, /) -> str: ...
def proc_io_counters(pid: int, /) -> tuple[int, int, int, int, int, int]: ...
def proc_io_priority_get(pid: int, /) -> int: ...
def proc_io_priority_set(pid: int, priority: int, /) -> None: ...
def proc_is_suspended(pid: int, /) -> bool: ...
def proc_kill(pid: int, /) -> None: ...
def proc_memory_info(pid: int, /) -> tuple[int, int, int, int, int, int, int, int, int, int]: ...
def proc_memory_maps(pid: int, /) -> list[tuple[int, str, str, int]]: ...
def proc_memory_uss(pid: int, /) -> int: ...
def proc_num_handles(pid: int, /) -> int: ...
def proc_open_files(pid: int, /) -> list[str]: ...
def proc_priority_get(pid: int, /) -> int: ...
def proc_priority_set(pid: int, priority: int, /) -> None: ...
def proc_suspend_or_resume(pid: int, suspend: bool | None, /) -> None: ...
def proc_threads(pid: int, /) -> list[tuple[int, float, float]]: ...
def proc_times(pid: int, /) -> tuple[float, float, float]: ...
def proc_username(pid: int, /) -> tuple[str, str]: ...
def proc_wait(pid: int, timeout: int, /) -> int | None: ...
def proc_info(
pid: int, /
) -> tuple[int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int]: ...
def boot_time() -> float: ...
def cpu_count_cores() -> int | None: ...
def cpu_count_logical() -> int | None: ...
def cpu_freq() -> tuple[int, int]: ...
def cpu_stats() -> tuple[int, int, int, int]: ...
def cpu_times() -> tuple[float, float, float]: ...
def disk_io_counters() -> dict[str, tuple[int, int, int, int, int, int]]: ...
def disk_partitions(all: bool, /) -> list[tuple[str, str, str, str]]: ...
def disk_usage(path: str, /) -> tuple[int, int, int]: ...
def getloadavg() -> tuple[float, float, float]: ...
def getpagesize() -> int: ...
def swap_percent() -> float: ...
def init_loadavg_counter() -> None: ...
def net_connections(
pid: int, af_filter: Sequence[AddressFamily | int | None], type_filter: Sequence[SocketKind | int | None], /
) -> list[tuple[int, int, int, tuple[str | None, int], tuple[str | None, int], int, int]]: ...
def net_if_addrs() -> list[tuple[str, int, str, str | None, None, None]]: ...
def net_if_stats() -> dict[str, tuple[bool, int, int, int]]: ...
def net_io_counters() -> dict[str, tuple[int, int, int, int, int, int, int, int]]: ...
def per_cpu_times() -> list[tuple[float, float, float, float, float]]: ...
def pid_exists(pid: int, /) -> bool: ...
def pids() -> list[int]: ...
def ppid_map() -> dict[int, int]: ...
def sensors_battery() -> tuple[int, int, int, int]: ...
def users() -> list[tuple[str, str | None, float]]: ...
def virtual_mem() -> tuple[int, int, int, int]: ...
def winservice_enumerate() -> list[tuple[str, str]]: ...
def winservice_query_config(service_name: str, /) -> tuple[str, str, str, str]: ...
def winservice_query_descr(service_name: str, /) -> str: ...
def winservice_query_status(service_name: str, /) -> tuple[str, int] | str: ...
def winservice_start(service_name: str, /) -> None: ...
def winservice_stop(service_name: str, /) -> None: ...
def QueryDosDevice(device_path: str, /) -> str: ...
def check_pid_range(pid: int, /) -> None: ...
def set_debug(value: bool, /) -> None: ...
+211 -180
View File
@@ -1,200 +1,231 @@
import enum
from _typeshed import Incomplete
from collections.abc import Iterable
from typing import NamedTuple
import sys
from psutil import _psutil_windows
from psutil._common import (
ENCODING as ENCODING,
AccessDenied as AccessDenied,
NoSuchProcess as NoSuchProcess,
TimeoutExpired as TimeoutExpired,
conn_tmap as conn_tmap,
conn_to_ntuple as conn_to_ntuple,
debug as debug,
isfile_strict as isfile_strict,
memoize as memoize,
parse_environ_block as parse_environ_block,
usage_percent as usage_percent,
)
from psutil._psutil_windows import (
ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS,
BELOW_NORMAL_PRIORITY_CLASS as BELOW_NORMAL_PRIORITY_CLASS,
HIGH_PRIORITY_CLASS as HIGH_PRIORITY_CLASS,
IDLE_PRIORITY_CLASS as IDLE_PRIORITY_CLASS,
NORMAL_PRIORITY_CLASS as NORMAL_PRIORITY_CLASS,
REALTIME_PRIORITY_CLASS as REALTIME_PRIORITY_CLASS,
)
if sys.platform == "win32":
import enum
from _typeshed import Incomplete
from collections.abc import Iterable, Iterator
from signal import Signals
from typing import Final, Literal, NamedTuple, TypedDict, overload, type_check_only
__extra__all__: Incomplete
CONN_DELETE_TCB: str
ERROR_PARTIAL_COPY: int
PYPY: Incomplete
AF_LINK: int
AddressFamily: Incomplete
TCP_STATUSES: Incomplete
from psutil import _psutil_windows
from psutil._common import (
ENCODING as ENCODING,
AccessDenied as AccessDenied,
NoSuchProcess as NoSuchProcess,
TimeoutExpired as TimeoutExpired,
conn_tmap as conn_tmap,
conn_to_ntuple as conn_to_ntuple,
debug as debug,
isfile_strict as isfile_strict,
memoize as memoize,
memoize_when_activated as memoize_when_activated,
parse_environ_block as parse_environ_block,
usage_percent as usage_percent,
)
from psutil._psutil_windows import (
ABOVE_NORMAL_PRIORITY_CLASS as ABOVE_NORMAL_PRIORITY_CLASS,
BELOW_NORMAL_PRIORITY_CLASS as BELOW_NORMAL_PRIORITY_CLASS,
HIGH_PRIORITY_CLASS as HIGH_PRIORITY_CLASS,
IDLE_PRIORITY_CLASS as IDLE_PRIORITY_CLASS,
NORMAL_PRIORITY_CLASS as NORMAL_PRIORITY_CLASS,
REALTIME_PRIORITY_CLASS as REALTIME_PRIORITY_CLASS,
)
# These noqas workaround https://github.com/astral-sh/ruff/issues/10874
class Priority(enum.IntEnum):
ABOVE_NORMAL_PRIORITY_CLASS = _psutil_windows.ABOVE_NORMAL_PRIORITY_CLASS # noqa: F811
BELOW_NORMAL_PRIORITY_CLASS = _psutil_windows.BELOW_NORMAL_PRIORITY_CLASS # noqa: F811
HIGH_PRIORITY_CLASS = _psutil_windows.HIGH_PRIORITY_CLASS # noqa: F811
IDLE_PRIORITY_CLASS = _psutil_windows.IDLE_PRIORITY_CLASS # noqa: F811
NORMAL_PRIORITY_CLASS = _psutil_windows.NORMAL_PRIORITY_CLASS # noqa: F811
REALTIME_PRIORITY_CLASS = _psutil_windows.REALTIME_PRIORITY_CLASS # noqa: F811
from . import _common
IOPRIO_VERYLOW: int
IOPRIO_LOW: int
IOPRIO_NORMAL: int
IOPRIO_HIGH: int
__extra__all__: list[str]
CONN_DELETE_TCB: Final = "DELETE_TCB"
ERROR_PARTIAL_COPY: Final = 299
PYPY: Final[bool]
class IOPriority(enum.IntEnum):
IOPRIO_VERYLOW = 0
IOPRIO_LOW = 1
IOPRIO_NORMAL = 2
IOPRIO_HIGH = 3
class AddressFamily(enum.IntEnum):
AF_LINK = -1
pinfo_map: Incomplete
AF_LINK: Final = AddressFamily.AF_LINK
TCP_STATUSES: Final[dict[int, str]]
class scputimes(NamedTuple):
user: float
system: float
idle: float
interrupt: float
dpc: float
# These noqas workaround https://github.com/astral-sh/ruff/issues/10874
class Priority(enum.IntEnum):
ABOVE_NORMAL_PRIORITY_CLASS = _psutil_windows.ABOVE_NORMAL_PRIORITY_CLASS # noqa: F811
BELOW_NORMAL_PRIORITY_CLASS = _psutil_windows.BELOW_NORMAL_PRIORITY_CLASS # noqa: F811
HIGH_PRIORITY_CLASS = _psutil_windows.HIGH_PRIORITY_CLASS # noqa: F811
IDLE_PRIORITY_CLASS = _psutil_windows.IDLE_PRIORITY_CLASS # noqa: F811
NORMAL_PRIORITY_CLASS = _psutil_windows.NORMAL_PRIORITY_CLASS # noqa: F811
REALTIME_PRIORITY_CLASS = _psutil_windows.REALTIME_PRIORITY_CLASS # noqa: F811
class svmem(NamedTuple):
total: int
available: int
percent: float
used: int
free: int
class IOPriority(enum.IntEnum):
IOPRIO_VERYLOW = 0
IOPRIO_LOW = 1
IOPRIO_NORMAL = 2
IOPRIO_HIGH = 3
class pmem(NamedTuple):
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
IOPRIO_VERYLOW: Final = IOPriority.IOPRIO_VERYLOW
IOPRIO_LOW: Final = IOPriority.IOPRIO_LOW
IOPRIO_NORMAL: Final = IOPriority.IOPRIO_NORMAL
IOPRIO_HIGH: Final = IOPriority.IOPRIO_HIGH
class pfullmem(NamedTuple):
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
uss: Incomplete
pinfo_map: Final[dict[str, int]]
class pmmap_grouped(NamedTuple):
path: Incomplete
rss: Incomplete
class scputimes(NamedTuple):
user: float
system: float
idle: float
interrupt: float
dpc: float
pmmap_ext: Incomplete
class svmem(NamedTuple):
total: int
available: int
percent: float
used: int
free: int
class pio(NamedTuple):
read_count: Incomplete
write_count: Incomplete
read_bytes: Incomplete
write_bytes: Incomplete
other_count: Incomplete
other_bytes: Incomplete
class pmem(NamedTuple):
rss: int
vms: int
num_page_faults: int
peak_wset: int
wset: int
peak_paged_pool: int
paged_pool: int
peak_nonpaged_pool: int
nonpaged_pool: int
pagefile: int
peak_pagefile: int
private: int
def convert_dos_path(s): ...
def getpagesize(): ...
def virtual_memory() -> svmem: ...
def swap_memory(): ...
class pfullmem(NamedTuple):
rss: int
vms: int
num_page_faults: int
peak_wset: int
wset: int
peak_paged_pool: int
paged_pool: int
peak_nonpaged_pool: int
nonpaged_pool: int
pagefile: int
peak_pagefile: int
private: int
uss: int
disk_io_counters: Incomplete
class pmmap_grouped(NamedTuple):
path: Incomplete
rss: Incomplete
def disk_usage(path): ...
def disk_partitions(all): ...
def cpu_times(): ...
def per_cpu_times(): ...
def cpu_count_logical(): ...
def cpu_count_cores() -> int | None: ...
def cpu_stats(): ...
def cpu_freq(): ...
def getloadavg(): ...
def net_connections(kind, _pid: int = -1): ...
def net_if_stats(): ...
def net_io_counters(): ...
def net_if_addrs(): ...
def sensors_battery(): ...
def boot_time(): ...
def users(): ...
def win_service_iter() -> Iterable[WindowsService]: ...
def win_service_get(name): ...
class pmmap_ext(NamedTuple):
addr: Incomplete
perms: Incomplete
path: Incomplete
rss: Incomplete
class WindowsService:
def __init__(self, name, display_name) -> None: ...
def __eq__(self, other): ...
def __ne__(self, other): ...
def name(self): ...
def display_name(self): ...
def binpath(self): ...
def username(self): ...
def start_type(self): ...
def pid(self): ...
def status(self): ...
def description(self): ...
def as_dict(self): ...
class pio(NamedTuple):
read_count: int
write_count: int
read_bytes: int
write_bytes: int
other_count: int
other_bytes: int
pids: Incomplete
pid_exists: Incomplete
ppid_map: Incomplete
def convert_dos_path(s: str) -> str: ...
def getpagesize() -> int: ...
def virtual_memory() -> svmem: ...
def swap_memory() -> _common.sswap: ...
def is_permission_err(exc): ...
def convert_oserror(exc, pid=None, name=None): ...
def wrap_exceptions(fun): ...
def retry_error_partial_copy(fun): ...
disk_io_counters = _psutil_windows.disk_io_counters
class Process:
pid: Incomplete
def __init__(self, pid) -> None: ...
def oneshot_enter(self) -> None: ...
def oneshot_exit(self) -> None: ...
def name(self): ...
def exe(self): ...
def cmdline(self): ...
def environ(self): ...
def ppid(self): ...
def memory_info(self): ...
def memory_full_info(self): ...
def memory_maps(self) -> None: ...
def kill(self): ...
def send_signal(self, sig) -> None: ...
def wait(self, timeout=None): ...
def username(self): ...
def create_time(self, fast_only: bool = False): ...
def num_threads(self): ...
def threads(self): ...
def cpu_times(self): ...
def suspend(self) -> None: ...
def resume(self) -> None: ...
def cwd(self): ...
def open_files(self): ...
def net_connections(self, kind: str = "inet"): ...
def nice_get(self): ...
def nice_set(self, value): ...
def ionice_get(self): ...
def ionice_set(self, ioclass, value) -> None: ...
def io_counters(self) -> pio: ...
def status(self): ...
def cpu_affinity_get(self): ...
def cpu_affinity_set(self, value): ...
def num_handles(self): ...
def num_ctx_switches(self): ...
def disk_usage(path: str) -> _common.sdiskusage: ...
def disk_partitions(all: bool) -> list[_common.sdiskpart]: ...
def cpu_times() -> scputimes: ...
def per_cpu_times() -> list[scputimes]: ...
def cpu_count_logical() -> int | None: ...
def cpu_count_cores() -> int | None: ...
def cpu_stats() -> _common.scpustats: ...
def cpu_freq() -> list[_common.scpufreq]: ...
def getloadavg() -> tuple[float, float, float]: ...
@overload
def net_connections(kind: str, _pid: Literal[-1] = -1) -> list[_common.sconn]: ...
@overload
def net_connections(kind: str, _pid: int = -1) -> list[_common.pconn]: ...
def net_if_stats() -> dict[str, _common.snicstats]: ...
def net_io_counters() -> dict[str, tuple[int, int, int, int, int, int, int, int]]: ...
def net_if_addrs() -> list[tuple[str, int, str, str | None, None, None]]: ...
def sensors_battery() -> _common.sbattery | None: ...
def boot_time() -> float: ...
def users() -> list[_common.suser]: ...
def win_service_iter() -> Iterator[WindowsService]: ...
def win_service_get(name: str) -> WindowsService: ...
@type_check_only
class _WindowsServiceAttrs(TypedDict):
name: str
display_name: str | None
description: str
binpath: str
username: str
start_type: str
status: str
pid: int | None
class WindowsService:
def __init__(self, name: str, display_name: str | None) -> None: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def name(self) -> str: ...
def display_name(self) -> str | None: ...
def binpath(self) -> str: ...
def username(self) -> str: ...
def start_type(self) -> str: ...
def pid(self) -> int: ...
def status(self) -> str: ...
def description(self) -> str: ...
def as_dict(self) -> _WindowsServiceAttrs: ...
pids = _psutil_windows.pids
pid_exists = _psutil_windows.pid_exists
ppid_map = _psutil_windows.ppid_map
def is_permission_err(exc: OSError) -> bool: ...
@overload
def convert_oserror(exc: PermissionError, pid=None, name=None) -> AccessDenied: ...
@overload
def convert_oserror(exc: OSError, pid=None, name=None) -> AccessDenied | NoSuchProcess: ...
def wrap_exceptions(fun): ...
def retry_error_partial_copy(fun): ...
class Process:
__slots__ = ["_cache", "_name", "_ppid", "pid"]
pid: int
def __init__(self, pid: int) -> None: ...
def oneshot_enter(self) -> None: ...
def oneshot_exit(self) -> None: ...
def name(self) -> str: ...
def exe(self) -> str: ...
def cmdline(self) -> list[str]: ...
def environ(self) -> dict[str, str]: ...
def ppid(self) -> int: ...
def memory_info(self) -> pmem: ...
def memory_full_info(self) -> pfullmem: ...
def memory_maps(self) -> Iterator[tuple[str, str, str, int]]: ...
def kill(self) -> None: ...
def send_signal(self, sig: Literal[Signals.SIGTERM, Signals.CTRL_C_EVENT, Signals.CTRL_BREAK_EVENT]) -> None: ...
def wait(self, timeout: float | None = None) -> int | None: ...
def username(self) -> str: ...
def create_time(self, fast_only: bool = False) -> float: ...
def num_threads(self) -> int: ...
def threads(self) -> list[_common.pthread]: ...
def cpu_times(self) -> _common.pcputimes: ...
def suspend(self) -> None: ...
def resume(self) -> None: ...
def cwd(self) -> str: ...
def open_files(self) -> list[_common.popenfile]: ...
def net_connections(self, kind: str = "inet") -> list[_common.pconn]: ...
def nice_get(self) -> Priority: ...
def nice_set(self, value) -> None: ...
def ionice_get(self) -> IOPriority: ...
def ionice_set(self, ioclass: int, value: None) -> None: ...
def io_counters(self) -> pio: ...
def status(self) -> Literal["stopped", "running"]: ...
def cpu_affinity_get(self) -> list[int]: ...
def cpu_affinity_set(self, value: Iterable[int]) -> None: ...
def num_handles(self) -> int: ...
def num_ctx_switches(self) -> _common.pctxsw: ...