From a9227ed98589bf960b1c9ee2da69890171f8dfd1 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sat, 25 Sep 2021 22:42:05 +0300 Subject: [PATCH] Improves `Popen` types in `psutil` (#6074) --- stubs/psutil/psutil/__init__.pyi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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: ...