Update asyncio subprocess optional **kwargs (#9177)

This commit is contained in:
Коренберг Марк
2022-12-18 22:51:31 +05:00
committed by GitHub
parent 0e41136f5a
commit bff43b53e5
2 changed files with 172 additions and 88 deletions

View File

@@ -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
@@ -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 = ...,
@@ -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,
@@ -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 = ...,
@@ -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,
@@ -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: ...