mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Add several missing type annotations to psutil._common (#6104)
This commit is contained in:
@@ -51,6 +51,7 @@ from ._common import (
|
||||
pcputimes,
|
||||
pctxsw,
|
||||
pgids,
|
||||
pionice,
|
||||
popenfile,
|
||||
pthread,
|
||||
puids,
|
||||
@@ -129,7 +130,7 @@ class Process:
|
||||
def num_fds(self) -> int: ...
|
||||
if sys.platform != "darwin":
|
||||
def io_counters(self): ...
|
||||
def ionice(self, ioclass: int | None = ..., value: int | None = ...) -> int: ...
|
||||
def ionice(self, ioclass: int | None = ..., value: int | None = ...) -> pionice: ...
|
||||
if sys.platform == "linux":
|
||||
def rlimit(self, resource: int, limits: tuple[int, int] | None = ...): ...
|
||||
if sys.platform != "darwin":
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import enum
|
||||
from typing import Any, Callable, NamedTuple, TypeVar
|
||||
from _typeshed import StrOrBytesPath, SupportsWrite
|
||||
from socket import AddressFamily, SocketKind
|
||||
from typing import Any, Callable, NamedTuple, TypeVar, overload
|
||||
|
||||
POSIX: bool
|
||||
WINDOWS: bool
|
||||
@@ -106,15 +108,15 @@ class suser(NamedTuple):
|
||||
|
||||
class sconn(NamedTuple):
|
||||
fd: int
|
||||
family: Any
|
||||
type: Any
|
||||
family: AddressFamily
|
||||
type: SocketKind
|
||||
laddr: str
|
||||
raddr: str
|
||||
status: str
|
||||
pid: int
|
||||
|
||||
class snicaddr(NamedTuple):
|
||||
family: Any
|
||||
family: AddressFamily
|
||||
address: str
|
||||
netmask: str | None
|
||||
broadcast: str | None
|
||||
@@ -122,7 +124,7 @@ class snicaddr(NamedTuple):
|
||||
|
||||
class snicstats(NamedTuple):
|
||||
isup: bool
|
||||
duplex: Any
|
||||
duplex: int
|
||||
speed: int
|
||||
mtu: int
|
||||
|
||||
@@ -184,7 +186,7 @@ class pio(NamedTuple):
|
||||
write_bytes: int
|
||||
|
||||
class pionice(NamedTuple):
|
||||
ioclass: Any
|
||||
ioclass: int
|
||||
value: int
|
||||
|
||||
class pctxsw(NamedTuple):
|
||||
@@ -193,8 +195,8 @@ class pctxsw(NamedTuple):
|
||||
|
||||
class pconn(NamedTuple):
|
||||
fd: int
|
||||
family: Any
|
||||
type: Any
|
||||
family: AddressFamily
|
||||
type: SocketKind
|
||||
laddr: addr
|
||||
raddr: addr
|
||||
status: str
|
||||
@@ -203,7 +205,7 @@ class addr(NamedTuple):
|
||||
ip: str
|
||||
port: int
|
||||
|
||||
conn_tmap: Any
|
||||
conn_tmap: dict[str, tuple[list[AddressFamily], list[SocketKind]]]
|
||||
|
||||
class Error(Exception):
|
||||
__module__: str
|
||||
@@ -244,13 +246,16 @@ _Func = TypeVar("_Func", bound=Callable[..., Any])
|
||||
def usage_percent(used, total, round_: int | None = ...) -> float: ...
|
||||
def memoize(fun: _Func) -> _Func: ...
|
||||
def memoize_when_activated(fun: _Func) -> _Func: ...
|
||||
def isfile_strict(path) -> bool: ...
|
||||
def path_exists_strict(path) -> bool: ...
|
||||
def isfile_strict(path: StrOrBytesPath) -> bool: ...
|
||||
def path_exists_strict(path: StrOrBytesPath) -> bool: ...
|
||||
def supports_ipv6() -> bool: ...
|
||||
def parse_environ_block(data): ...
|
||||
def sockfam_to_enum(num): ...
|
||||
def socktype_to_enum(num): ...
|
||||
def conn_to_ntuple(fd, fam, type_, laddr, raddr, status, status_map, pid: Any | None = ...): ...
|
||||
def sockfam_to_enum(num: int) -> AddressFamily: ...
|
||||
def socktype_to_enum(num: int) -> SocketKind: ...
|
||||
@overload
|
||||
def conn_to_ntuple(fd: int, fam: int, type_: int, laddr, raddr, status: str, status_map, pid: int) -> sconn: ...
|
||||
@overload
|
||||
def conn_to_ntuple(fd: int, fam: int, type_: int, laddr, raddr, status: str, status_map, pid: None = ...) -> pconn: ...
|
||||
def deprecated_method(replacement: str) -> Callable[[_Func], _Func]: ...
|
||||
|
||||
class _WrapNumbers:
|
||||
@@ -263,10 +268,10 @@ class _WrapNumbers:
|
||||
def cache_clear(self, name: Any | None = ...) -> None: ...
|
||||
def cache_info(self): ...
|
||||
|
||||
def wrap_numbers(input_dict, name): ...
|
||||
def wrap_numbers(input_dict, name: str): ...
|
||||
def bytes2human(n: int, format: str = ...) -> str: ...
|
||||
def get_procfs_path(): ...
|
||||
def term_supports_colors(file=...) -> bool: ...
|
||||
def get_procfs_path() -> str: ...
|
||||
def term_supports_colors(file: SupportsWrite[str] = ...) -> bool: ...
|
||||
def hilite(s: str, color: str | None = ..., bold: bool = ...) -> str: ...
|
||||
def print_color(s: str, color: str | None = ..., bold: bool = ..., file=...) -> None: ...
|
||||
def print_color(s: str, color: str | None = ..., bold: bool = ..., file: SupportsWrite[str] = ...) -> None: ...
|
||||
def debug(msg) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user