Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
260 changes: 141 additions & 119 deletions stubs/psutil/psutil/_pssunos.pyi
Original file line number Diff line number Diff line change
@@ -1,129 +1,151 @@
from _typeshed import Incomplete
from typing import NamedTuple

from psutil._common import (
AF_INET6 as AF_INET6,
AccessDenied as AccessDenied,
NoSuchProcess as NoSuchProcess,
ZombieProcess as ZombieProcess,
debug as debug,
get_procfs_path as get_procfs_path,
isfile_strict as isfile_strict,
memoize_when_activated as memoize_when_activated,
sockfam_to_enum as sockfam_to_enum,
socktype_to_enum as socktype_to_enum,
usage_percent as usage_percent,
)

__extra__all__: Incomplete
PAGE_SIZE: Incomplete
AF_LINK: Incomplete
IS_64_BIT: Incomplete
CONN_IDLE: str
CONN_BOUND: str
PROC_STATUSES: Incomplete
TCP_STATUSES: Incomplete
proc_info_map: Incomplete

class scputimes(NamedTuple):
user: Incomplete
system: Incomplete
idle: Incomplete
iowait: Incomplete

class pcputimes(NamedTuple):
user: Incomplete
system: Incomplete
children_user: Incomplete
children_system: Incomplete

class svmem(NamedTuple):
total: Incomplete
available: Incomplete
percent: Incomplete
used: Incomplete
free: Incomplete

class pmem(NamedTuple):
rss: Incomplete
vms: Incomplete

pfullmem = pmem

class pmmap_grouped(NamedTuple):
path: Incomplete
rss: Incomplete
anonymous: Incomplete
locked: Incomplete

pmmap_ext: Incomplete

def virtual_memory(): ...
def swap_memory(): ...
def cpu_times(): ...
def per_cpu_times(): ...
def cpu_count_logical(): ...
def cpu_count_cores(): ...
def cpu_stats(): ...

disk_io_counters: Incomplete
disk_usage: Incomplete

def disk_partitions(all: bool = ...): ...

net_io_counters: Incomplete
net_if_addrs: Incomplete

def net_connections(kind, _pid: int = ...): ...
def net_if_stats(): ...
def boot_time(): ...
def users(): ...
def pids(): ...
def pid_exists(pid): ...
def wrap_exceptions(fun): ...

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 create_time(self): ...
def num_threads(self): ...
def nice_get(self): ...
def nice_set(self, value): ...
def ppid(self): ...
def uids(self): ...
def gids(self): ...
def cpu_times(self): ...
def cpu_num(self): ...
def terminal(self): ...
def cwd(self): ...
def memory_info(self): ...
memory_full_info: Incomplete
def status(self): ...
def threads(self): ...
def open_files(self): ...
def net_connections(self, kind: str = ...): ...

class nt_mmap_grouped(NamedTuple):
import sys

# sys.platform.startswith(("sunos", "solaris")):
if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
from _typeshed import Incomplete
from collections.abc import Callable
from typing import Final, Literal, NamedTuple, TypeVar, overload
from typing_extensions import ParamSpec

from psutil._common import (
AF_INET6 as AF_INET6,
ENCODING as ENCODING,
AccessDenied as AccessDenied,
NoSuchProcess as NoSuchProcess,
ZombieProcess as ZombieProcess,
debug as debug,
get_procfs_path as get_procfs_path,
isfile_strict as isfile_strict,
memoize_when_activated as memoize_when_activated,
sockfam_to_enum as sockfam_to_enum,
socktype_to_enum as socktype_to_enum,
usage_percent as usage_percent,
)

from . import _common, _psposix, _psutil_sunos

_P = ParamSpec("_P")
_R = TypeVar("_R")

__extra__all__: Final[list[str]]
PAGE_SIZE: Final[int]
AF_LINK: Final[int]
IS_64_BIT: Final[bool]
CONN_IDLE: Final = "IDLE"
CONN_BOUND: Final = "BOUND"
PROC_STATUSES: Final[dict[int, str]]
TCP_STATUSES: Final[dict[int, str]]
proc_info_map: Final[dict[str, int]]

class scputimes(NamedTuple):
user: float
system: float
idle: float
iowait: float

class pcputimes(NamedTuple):
user: float
system: float
children_user: float
children_system: float

class svmem(NamedTuple):
total: int
available: int
percent: float
used: int
free: int

class pmem(NamedTuple):
rss: int
vms: int

pfullmem = pmem

class pmmap_grouped(NamedTuple):
path: Incomplete
rss: Incomplete
anon: Incomplete
anonymous: Incomplete
locked: Incomplete

class nt_mmap_ext(NamedTuple):
class pmmap_ext(NamedTuple):
addr: Incomplete
perms: Incomplete
path: Incomplete
rss: Incomplete
anon: Incomplete
anonymous: Incomplete
locked: Incomplete

def memory_maps(self): ...
def num_fds(self): ...
def num_ctx_switches(self): ...
def wait(self, timeout: Incomplete | None = ...): ...
def virtual_memory() -> svmem: ...
def swap_memory() -> _common.sswap: ...
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: ...

disk_io_counters = _psutil_sunos.disk_io_counters
disk_usage = _psposix.disk_usage

def disk_partitions(all: bool = False) -> list[_common.sdiskpart]: ...

net_io_counters = _psutil_sunos.net_io_counters
net_if_addrs = _psutil_sunos.net_if_addrs

@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 boot_time() -> float: ...
def users() -> list[_common.suser]: ...
def pids() -> list[int]: ...
def pid_exists(pid: int) -> bool: ...
def wrap_exceptions(fun: Callable[_P, _R]) -> Callable[_P, _R]: ...

class Process:
__slots__ = ["_cache", "_name", "_ppid", "_procfs_path", "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] | None: ...
def environ(self) -> dict[str, str]: ...
def create_time(self) -> float: ...
def num_threads(self) -> int: ...
def nice_get(self) -> int: ...
def nice_set(self, value: int) -> None: ...
def ppid(self) -> int: ...
def uids(self) -> _common.puids: ...
def gids(self) -> _common.puids: ...
def cpu_times(self) -> _common.pcputimes: ...
def cpu_num(self) -> int: ...
def terminal(self) -> str | None: ...
def cwd(self) -> str: ...
def memory_info(self) -> pmem: ...
memory_full_info = memory_info
def status(self) -> str: ...
def threads(self) -> list[_common.pthread]: ...
def open_files(self) -> list[_common.popenfile]: ...
def net_connections(self, kind: str = "inet") -> list[_common.pconn]: ...

class nt_mmap_grouped(NamedTuple):
path: Incomplete
rss: Incomplete
anon: Incomplete
locked: Incomplete

class nt_mmap_ext(NamedTuple):
addr: Incomplete
perms: Incomplete
path: Incomplete
rss: Incomplete
anon: Incomplete
locked: Incomplete

def memory_maps(self) -> list[tuple[str, str, str, int, int, int]]: ...
def num_fds(self) -> int: ...
def num_ctx_switches(self) -> _common.pctxsw: ...
def wait(self, timeout: float | None = None): ...
3 changes: 1 addition & 2 deletions stubs/psutil/psutil/_psutil_osx.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ if sys.platform == "darwin":

_T = TypeVar("_T")

# TODO: Add POSIX constants and check their aviability (see psutil_posix_add_constants)
AF_LINK: Incomplete
AF_LINK: Final = 18

def getpagesize() -> int: ...
def net_if_addrs(): ...
Expand Down
Loading