Skip to content
Open
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
16 changes: 8 additions & 8 deletions stubs/psutil/psutil/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from _typeshed import FloatInt, Incomplete, StrOrBytesPath
from _typeshed import Incomplete, StrOrBytesPath
from collections.abc import Callable, Collection, Iterable, Iterator
from contextlib import AbstractContextManager
from subprocess import _CMD, _ENV, _FILE
Expand Down Expand Up @@ -327,7 +327,7 @@ class Process:
def num_threads(self) -> int: ...
def threads(self) -> list[_ntp.pthread]: ...
def children(self, recursive: bool = False) -> list[Process]: ...
def cpu_percent(self, interval: FloatInt | None = None) -> float: ...
def cpu_percent(self, interval: float | int | None = None) -> float: ...
def cpu_times(self) -> _ntp.pcputimes: ...
def memory_info(self) -> _ntp.pmem: ...
def memory_full_info(self) -> _ntp.pfullmem: ...
Expand All @@ -340,7 +340,7 @@ class Process:
def resume(self) -> None: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...
def wait(self, timeout: FloatInt | None = None) -> int: ...
def wait(self, timeout: float | int | None = None) -> int: ...
def net_connections(self, kind: str = "inet") -> list[_ntp.pconn]: ...

class Popen(Process):
Expand Down Expand Up @@ -427,7 +427,7 @@ def pid_exists(pid: int) -> bool: ...
process_iter: _ProcessIterCallable

def wait_procs(
procs: Iterable[Process], timeout: FloatInt | None = None, callback: Callable[[Process], object] | None = None
procs: Iterable[Process], timeout: float | int | None = None, callback: Callable[[Process], object] | None = None
) -> tuple[list[Process], list[Process]]: ...
def cpu_count(logical: bool = True) -> int | None: ...

Expand All @@ -442,16 +442,16 @@ def cpu_times(percpu: Literal[False] = False) -> _ntp.scputimes: ...
def cpu_times(percpu: Literal[True]) -> list[_ntp.scputimes]: ...

@overload
def cpu_percent(interval: FloatInt | None = None, percpu: Literal[False] = False) -> float: ...
def cpu_percent(interval: float | int | None = None, percpu: Literal[False] = False) -> float: ...
@overload
def cpu_percent(interval: FloatInt | None, percpu: Literal[True]) -> list[float]: ...
def cpu_percent(interval: float | int | None, percpu: Literal[True]) -> list[float]: ...
@overload
def cpu_percent(*, percpu: Literal[True]) -> list[float]: ...

@overload
def cpu_times_percent(interval: FloatInt | None = None, percpu: Literal[False] = False) -> _ntp.scputimes: ...
def cpu_times_percent(interval: float | int | None = None, percpu: Literal[False] = False) -> _ntp.scputimes: ...
@overload
def cpu_times_percent(interval: FloatInt | None, percpu: Literal[True]) -> list[_ntp.scputimes]: ...
def cpu_times_percent(interval: float | int | None, percpu: Literal[True]) -> list[_ntp.scputimes]: ...
@overload
def cpu_times_percent(*, percpu: Literal[True]) -> list[_ntp.scputimes]: ...

Expand Down
8 changes: 4 additions & 4 deletions stubs/psutil/psutil/_common.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import enum
import io
import sys
import threading
from _typeshed import ConvertibleToFloat, FileDescriptorOrPath, FloatInt, Incomplete, StrOrBytesPath, SupportsWrite
from _typeshed import ConvertibleToFloat, FileDescriptorOrPath, Incomplete, StrOrBytesPath, SupportsWrite
from collections import defaultdict
from collections.abc import Callable
from socket import AF_INET6 as AF_INET6, AddressFamily, SocketKind
Expand Down Expand Up @@ -90,17 +90,17 @@ class AccessDenied(Error):
def __init__(self, pid: int | None = None, name: str | None = None, msg: str | None = None) -> None: ...

class TimeoutExpired(Error):
seconds: FloatInt
seconds: float | int
pid: int | None
name: str | None
msg: str
def __init__(self, seconds: FloatInt, pid: int | None = None, name: str | None = None) -> None: ...
def __init__(self, seconds: float | int, pid: int | None = None, name: str | None = None) -> None: ...

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

def usage_percent(used: ConvertibleToFloat, total: FloatInt, round_: SupportsIndex | None = None) -> float: ...
def usage_percent(used: ConvertibleToFloat, total: float | int, round_: SupportsIndex | None = None) -> float: ...

# returned function has `cache_clear()` attribute:
def memoize(fun: Callable[_P, _R]) -> Callable[_P, _R]: ...
Expand Down
10 changes: 5 additions & 5 deletions stubs/psutil/psutil/_ntuples.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ class sswap(NamedTuple):
total: int
used: int
free: int
percent: FloatInt
percent: float
sin: int
sout: int

class sdiskusage(NamedTuple):
total: int
used: int
free: int
percent: FloatInt
percent: float

# redefine for linux:
if sys.platform != "linux":
Expand Down Expand Up @@ -187,7 +187,7 @@ if sys.platform == "linux":
class svmem(NamedTuple):
total: int
available: int
percent: FloatInt
percent: float
used: int
free: int
active: int
Expand Down Expand Up @@ -290,7 +290,7 @@ elif sys.platform == "win32":
class svmem(NamedTuple):
total: int
available: int
percent: FloatInt
percent: float
used: int
free: int

Expand Down Expand Up @@ -351,7 +351,7 @@ elif sys.platform == "darwin":
class svmem(NamedTuple):
total: int
available: int
percent: FloatInt
percent: float
used: int
free: int
active: int
Expand Down
4 changes: 2 additions & 2 deletions stubs/psutil/psutil/_psaix.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
class svmem(NamedTuple):
total: int
available: int
percent: FloatInt
percent: float
used: int
free: int

Expand Down Expand Up @@ -109,5 +109,5 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
def open_files(self) -> list[ntp.popenfile]: ...
def num_fds(self) -> int: ...
def num_ctx_switches(self) -> ntp.pctxsw: ...
def wait(self, timeout: FloatInt | None = None) -> int | None: ...
def wait(self, timeout: float | int | None = None) -> int | None: ...
def io_counters(self) -> ntp.pio: ...
6 changes: 3 additions & 3 deletions stubs/psutil/psutil/_psbsd.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
class svmem(NamedTuple):
total: int
available: int
percent: FloatInt
percent: float
used: int
free: int
active: int
Expand Down Expand Up @@ -121,7 +121,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw

INIT_BOOT_TIME: Final[float | int] # only NetBSD

def adjust_proc_create_time(ctime: FloatInt) -> float: ... # only NetBSD
def adjust_proc_create_time(ctime: float | int) -> float: ... # only NetBSD
def pids() -> list[int]: ...
def pid_exists(pid: int) -> bool: ...
def wrap_exceptions(fun: Callable[_P, _R]) -> Callable[_P, _R]: ...
Expand Down Expand Up @@ -179,7 +179,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
def num_ctx_switches(self) -> ntp.pctxsw: ...
def threads(self) -> list[ntp.pthread]: ...
def net_connections(self, kind: str = "inet") -> list[ntp.pconn]: ...
def wait(self, timeout: FloatInt | None = None) -> int | None: ...
def wait(self, timeout: float | int | None = None) -> int | None: ...
def nice_get(self) -> int: ...
def nice_set(self, value: int) -> None: ...
def status(self) -> str: ...
Expand Down
3 changes: 1 addition & 2 deletions stubs/psutil/psutil/_pslinux.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
from _typeshed import FloatInt

if sys.platform == "linux":
import enum
Expand Down Expand Up @@ -154,7 +153,7 @@ if sys.platform == "linux":
def io_counters(self) -> ntp.pio: ...
def cpu_times(self) -> ntp.pcputimes: ...
def cpu_num(self) -> int: ...
def wait(self, timeout: FloatInt | None = None) -> int | None: ...
def wait(self, timeout: float | int | None = None) -> int | None: ...
def create_time(self, monotonic: bool = False) -> float: ...
def memory_info(self) -> ntp.pmem: ...
def memory_full_info(self) -> ntp.pfullmem: ...
Expand Down
7 changes: 3 additions & 4 deletions stubs/psutil/psutil/_psosx.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
from _typeshed import FloatInt

if sys.platform == "darwin":
from collections.abc import Callable
Expand Down Expand Up @@ -52,8 +51,8 @@ if sys.platform == "darwin":
def net_connections(kind: str = "inet") -> list[ntp.sconn]: ...
def net_if_stats() -> dict[str, ntp.snicstats]: ...
def boot_time() -> float: ...
INIT_BOOT_TIME: FloatInt
def adjust_proc_create_time(ctime: FloatInt) -> float: ...
INIT_BOOT_TIME: float | int
def adjust_proc_create_time(ctime: float | int) -> float: ...
def users() -> list[ntp.suser]: ...
def pids() -> list[int]: ...
pid_exists = _psposix.pid_exists
Expand Down Expand Up @@ -83,7 +82,7 @@ if sys.platform == "darwin":
def open_files(self) -> list[ntp.popenfile]: ...
def net_connections(self, kind: str = "inet") -> list[ntp.pconn]: ...
def num_fds(self) -> int: ...
def wait(self, timeout: FloatInt | None = None) -> int | None: ...
def wait(self, timeout: float | int | None = None) -> int | None: ...
def nice_get(self) -> int: ...
def nice_set(self, value: int) -> None: ...
def status(self) -> str: ...
Expand Down
12 changes: 6 additions & 6 deletions stubs/psutil/psutil/_psposix.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import enum
import sys
from _typeshed import FileDescriptorOrPath, FloatInt, Incomplete, StrOrBytesPath, Unused
from _typeshed import FileDescriptorOrPath, Incomplete, StrOrBytesPath, Unused
from collections.abc import Callable

from . import _ntuples as ntp
Expand Down Expand Up @@ -61,18 +61,18 @@ def negsig_to_enum(num: int) -> int: ...
def convert_exit_code(status: int) -> int: ...
def wait_pid_posix(
pid: int,
timeout: FloatInt | None = None,
timeout: float | int | None = None,
_waitpid: Unused = ...,
_timer: Callable[[], float] = ...,
_min: Callable[..., Incomplete] = ...,
_sleep: Callable[[FloatInt], None] = ...,
_sleep: Callable[[float], None] = ...,
_pid_exists: Callable[[int], bool] = ...,
) -> int | None: ...
def wait_pid_pidfd_open(pid: int, timeout: FloatInt | None = None) -> int | None: ...
def wait_pid_kqueue(pid: int, timeout: FloatInt | None = None) -> int | None: ...
def wait_pid_pidfd_open(pid: int, timeout: float | int | None = None) -> int | None: ...
def wait_pid_kqueue(pid: int, timeout: float | int | None = None) -> int | None: ...
def can_use_pidfd_open() -> bool: ...
def can_use_kqueue() -> bool: ...
def wait_pid(pid: int, timeout: FloatInt | None = None) -> int | None: ...
def wait_pid(pid: int, timeout: float | int | None = None) -> int | None: ...

if sys.platform == "darwin":
def disk_usage(path: StrOrBytesPath) -> ntp.sdiskusage: ...
Expand Down
4 changes: 2 additions & 2 deletions stubs/psutil/psutil/_pssunos.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
class svmem(NamedTuple):
total: int
available: int
percent: FloatInt
percent: float
used: int
free: int

Expand Down Expand Up @@ -149,4 +149,4 @@ if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darw
def memory_maps(self) -> list[tuple[str, str, str, int, int, int]]: ...
def num_fds(self) -> int: ...
def num_ctx_switches(self) -> ntp.pctxsw: ...
def wait(self, timeout: FloatInt | None = None) -> int | None: ...
def wait(self, timeout: float | int | None = None) -> int | None: ...
3 changes: 1 addition & 2 deletions stubs/psutil/psutil/_pswindows.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import sys
from _typeshed import FloatInt

if sys.platform == "win32":
import enum
Expand Down Expand Up @@ -157,7 +156,7 @@ if sys.platform == "win32":
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: FloatInt | None = None) -> int | None: ...
def wait(self, timeout: float | int | None = None) -> int | None: ...
def username(self) -> str: ...
def create_time(self, fast_only: bool = False) -> float: ...
def num_threads(self) -> int: ...
Expand Down
Loading