8000 Improves `Popen` types in `psutil` (#6074) · python/typeshed@a9227ed · GitHub
[go: up one dir, main page]

Skip to content

Commit a9227ed

Browse files
authored
Improves Popen types in psutil (#6074)
1 parent 583aa16 commit a9227ed

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stubs/psutil/psutil/__init__.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from typing import Any, Callable, ContextManager, Iterable, Iterator
2+
from typing import Any, Callable, ContextManager, Iterable, Iterator, TypeVar
33

44
from ._common import (
55
AIX as AIX,
@@ -160,13 +160,13 @@ class Process:
160160
def kill(self) -> None: ...
161161
def wait(self, timeout: int | None = ...) -> int: ...
162162

163+
_Popen = TypeVar("_Popen", bound="Popen")
164+
163165
class Popen(Process):
164166
def __init__(self, *args, **kwargs) -> None: ...
165-
def __dir__(self): ...
166-
def __enter__(self): ...
167-
def __exit__(self, *args, **kwargs): ...
168-
def __getattribute__(self, name): ...
169-
def wait(self, timeout: Any | None = ...): ...
167+
def __enter__(self: _Popen) -> _Popen: ...
168+
def __exit__(self, *args, **kwargs) -> None: ...
169+
def __getattribute__(self, name: str) -> Any: ...
170170

171171
def pids() -> list[int]: ...
172172
def pid_exists(pid: int) -> bool: ...

0 commit comments

Comments
 (0)
0