psutil: Improve types for disk_io_counters() and net_io_counters() (#8829)

This commit is contained in:
crusaderky
2022-10-03 17:25:25 +01:00
committed by GitHub
parent aab29f626c
commit 6414250888

View File

@@ -2,7 +2,7 @@ import sys
from _typeshed import Self
from collections.abc import Callable, Iterable, Iterator
from contextlib import AbstractContextManager
from typing import Any
from typing import Any, overload
from typing_extensions import Literal, TypeAlias
from ._common import (
@@ -225,8 +225,14 @@ def virtual_memory() -> svmem: ...
def swap_memory() -> sswap: ...
def disk_usage(path: str) -> sdiskusage: ...
def disk_partitions(all: bool = ...) -> list[sdiskpart]: ...
def disk_io_counters(perdisk: bool = ..., nowrap: bool = ...) -> sdiskio: ...
def net_io_counters(pernic: bool = ..., nowrap: bool = ...) -> snetio: ...
@overload
def disk_io_counters(perdisk: Literal[False] = ..., nowrap: bool = ...) -> sdiskio | None: ...
@overload
def disk_io_counters(perdisk: Literal[True], nowrap: bool = ...) -> dict[str, sdiskio]: ...
@overload
def net_io_counters(pernic: Literal[False] = ..., nowrap: bool = ...) -> snetio: ...
@overload
def net_io_counters(pernic: Literal[True], nowrap: bool = ...) -> dict[str, snetio]: ...
def net_connections(kind: str = ...) -> list[sconn]: ...
def net_if_addrs() -> dict[str, list[snicaddr]]: ...
def net_if_stats() -> dict[str, snicstats]: ...