From 0a316218909dc7fd0e6ddcf939ecf438d945ddb0 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Wed, 11 Nov 2026 21:15:45 -0600 Subject: [PATCH] Support platform-appropriate disk_usage path inputs --- stubs/psutil/psutil/__init__.pyi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi index 6c4fda89160f..0252546653c9 100644 --- a/stubs/psutil/psutil/__init__.pyi +++ b/stubs/psutil/psutil/__init__.pyi @@ -459,7 +459,13 @@ def cpu_stats() -> _ntp.scpustats: ... def getloadavg() -> tuple[float, float, float]: ... def virtual_memory() -> _ntp.svmem: ... def swap_memory() -> _ntp.sswap: ... -def disk_usage(path: str) -> _ntp.sdiskusage: ... + +if sys.platform == "win32": + def disk_usage(path: str | bytes) -> _ntp.sdiskusage: ... + +else: + def disk_usage(path: StrOrBytesPath) -> _ntp.sdiskusage: ... + def disk_partitions(all: bool = False) -> list[_ntp.sdiskpart]: ... # TODO: Incorrect sdiskio for BSD systems: