Skip to content

Update asyncio subprocess optional **kwargs. #9177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 18, 2022
Merged
Show file tree
Hide file tree
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: 91 additions & 7 deletions stdlib/asyncio/subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import subprocess
import sys
from _typeshed import StrOrBytesPath
from asyncio import events, protocols, streams, transports
from collections.abc import Callable
from collections.abc import Callable, Collection
from typing import IO, Any
from typing_extensions import Literal, TypeAlias

Expand Down Expand Up @@ -40,7 +40,7 @@ class Process:
def kill(self) -> None: ...
async def communicate(self, input: bytes | bytearray | memoryview | None = ...) -> tuple[bytes, bytes]: ...

if sys.version_info >= (3, 10):
if sys.version_info >= (3, 11):
async def create_subprocess_shell(
cmd: str | bytes,
stdin: int | IO[Any] | None = ...,
Expand All @@ -65,7 +65,13 @@ if sys.version_info >= (3, 10):
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
pass_fds: Collection[int] = ...,
group: None | str | int = ...,
extra_groups: None | Collection[str | int] = ...,
user: None | str | int = ...,
umask: int = ...,
process_group: int | None = ...,
pipesize: int = ...,
) -> Process: ...
async def create_subprocess_exec(
program: _ExecArg,
Expand All @@ -91,10 +97,80 @@ if sys.version_info >= (3, 10):
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
pass_fds: Collection[int] = ...,
group: None | str | int = ...,
extra_groups: None | Collection[str | int] = ...,
user: None | str | int = ...,
umask: int = ...,
process_group: int | None = ...,
pipesize: int = ...,
) -> Process: ...

else:
elif sys.version_info >= (3, 10):
async def create_subprocess_shell(
cmd: str | bytes,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
limit: int = ...,
*,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
universal_newlines: Literal[False] = ...,
shell: Literal[True] = ...,
bufsize: Literal[0] = ...,
encoding: None = ...,
errors: None = ...,
text: Literal[False, None] = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
executable: StrOrBytesPath | None = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: subprocess._ENV | None = ...,
startupinfo: Any | None = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Collection[int] = ...,
group: None | str | int = ...,
extra_groups: None | Collection[str | int] = ...,
user: None | str | int = ...,
umask: int = ...,
pipesize: int = ...,
) -> Process: ...
async def create_subprocess_exec(
program: _ExecArg,
*args: _ExecArg,
stdin: int | IO[Any] | None = ...,
stdout: int | IO[Any] | None = ...,
stderr: int | IO[Any] | None = ...,
limit: int = ...,
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
universal_newlines: Literal[False] = ...,
shell: Literal[True] = ...,
bufsize: Literal[0] = ...,
encoding: None = ...,
errors: None = ...,
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
text: bool | None = ...,
executable: StrOrBytesPath | None = ...,
preexec_fn: Callable[[], Any] | None = ...,
close_fds: bool = ...,
cwd: StrOrBytesPath | None = ...,
env: subprocess._ENV | None = ...,
startupinfo: Any | None = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Collection[int] = ...,
group: None | str | int = ...,
extra_groups: None | Collection[str | int] = ...,
user: None | str | int = ...,
umask: int = ...,
pipesize: int = ...,
) -> Process: ...

else: # >= 3.9
async def create_subprocess_shell(
cmd: str | bytes,
stdin: int | IO[Any] | None = ...,
Expand All @@ -120,7 +196,11 @@ else:
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
pass_fds: Collection[int] = ...,
group: None | str | int = ...,
extra_groups: None | Collection[str | int] = ...,
user: None | str | int = ...,
umask: int = ...,
) -> Process: ...
async def create_subprocess_exec(
program: _ExecArg,
Expand All @@ -147,5 +227,9 @@ else:
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...,
pass_fds: Collection[int] = ...,
group: None | str | int = ...,
extra_groups: None | Collection[str | int] = ...,
user: None | str | int = ...,
umask: int = ...,
) -> Process: ...
Loading