Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 95 additions & 3 deletions stubs/psutil/psutil/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import sys
from _typeshed import Incomplete
from collections.abc import Callable, Iterable, Iterator
from _typeshed import Incomplete, StrOrBytesPath
from collections.abc import Callable, Collection, Iterable, Iterator
from contextlib import AbstractContextManager
from subprocess import _CMD, _ENV, _FILE
from types import TracebackType
from typing import Any, Literal, Protocol, overload, type_check_only
from typing_extensions import Self, TypeAlias, deprecated
Expand Down Expand Up @@ -204,7 +205,98 @@ class Process:
def net_connections(self, kind: str = "inet") -> list[_ntp.pconn]: ...

class Popen(Process):
def __init__(self, *args, **kwargs) -> None: ...
# sync with subprocess.Popen.__init__:
if sys.version_info >= (3, 11):
def __init__(
self,
args: _CMD,
bufsize: int = -1,
executable: StrOrBytesPath | None = None,
stdin: _FILE | None = None,
stdout: _FILE | None = None,
stderr: _FILE | None = None,
preexec_fn: Callable[[], object] | None = None,
close_fds: bool = True,
shell: bool = False,
cwd: StrOrBytesPath | None = None,
env: _ENV | None = None,
universal_newlines: bool | None = None,
startupinfo: Any | None = None,
creationflags: int = 0,
restore_signals: bool = True,
start_new_session: bool = False,
pass_fds: Collection[int] = (),
*,
text: bool | None = None,
encoding: str | None = None,
errors: str | None = None,
user: str | int | None = None,
group: str | int | None = None,
extra_groups: Iterable[str | int] | None = None,
umask: int = -1,
pipesize: int = -1,
process_group: int | None = None,
) -> None: ...
elif sys.version_info >= (3, 10):
def __init__(
self,
args: _CMD,
bufsize: int = -1,
executable: StrOrBytesPath | None = None,
stdin: _FILE | None = None,
stdout: _FILE | None = None,
stderr: _FILE | None = None,
preexec_fn: Callable[[], object] | None = None,
close_fds: bool = True,
shell: bool = False,
cwd: StrOrBytesPath | None = None,
env: _ENV | None = None,
universal_newlines: bool | None = None,
startupinfo: Any | None = None,
creationflags: int = 0,
restore_signals: bool = True,
start_new_session: bool = False,
pass_fds: Collection[int] = (),
*,
text: bool | None = None,
encoding: str | None = None,
errors: str | None = None,
user: str | int | None = None,
group: str | int | None = None,
extra_groups: Iterable[str | int] | None = None,
umask: int = -1,
pipesize: int = -1,
) -> None: ...
else:
def __init__(
self,
args: _CMD,
bufsize: int = -1,
executable: StrOrBytesPath | None = None,
stdin: _FILE | None = None,
stdout: _FILE | None = None,
stderr: _FILE | None = None,
preexec_fn: Callable[[], object] | None = None,
close_fds: bool = True,
shell: bool = False,
cwd: StrOrBytesPath | None = None,
env: _ENV | None = None,
universal_newlines: bool | None = None,
startupinfo: Any | None = None,
creationflags: int = 0,
restore_signals: bool = True,
start_new_session: bool = False,
pass_fds: Collection[int] = (),
*,
text: bool | None = None,
encoding: str | None = None,
errors: str | None = None,
user: str | int | None = None,
group: str | int | None = None,
extra_groups: Iterable[str | int] | None = None,
umask: int = -1,
) -> None: ...

def __enter__(self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
Expand Down