diff --git a/stubs/psutil/psutil/__init__.pyi b/stubs/psutil/psutil/__init__.pyi index 41aa0041c..881cce630 100644 --- a/stubs/psutil/psutil/__init__.pyi +++ b/stubs/psutil/psutil/__init__.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, Callable, ContextManager, Iterable, Iterator +from typing import Any, Callable, ContextManager, Iterable, Iterator, TypeVar from ._common import ( AIX as AIX, @@ -160,13 +160,13 @@ class Process: def kill(self) -> None: ... def wait(self, timeout: int | None = ...) -> int: ... +_Popen = TypeVar("_Popen", bound="Popen") + class Popen(Process): def __init__(self, *args, **kwargs) -> None: ... - def __dir__(self): ... - def __enter__(self): ... - def __exit__(self, *args, **kwargs): ... - def __getattribute__(self, name): ... - def wait(self, timeout: Any | None = ...): ... + def __enter__(self: _Popen) -> _Popen: ... + def __exit__(self, *args, **kwargs) -> None: ... + def __getattribute__(self, name: str) -> Any: ... def pids() -> list[int]: ... def pid_exists(pid: int) -> bool: ...