From 5886a5dfcd3270ecf4effada9d95619e41eb0298 Mon Sep 17 00:00:00 2001 From: Alvaro Caceres Date: Wed, 15 Jun 2016 13:34:02 -0500 Subject: [PATCH] Fix signatures of call, check_call and check_output in subprocess --- stdlib/2.7/subprocess.pyi | 59 +++++++++++++++++++++++++++--------- stdlib/3/subprocess.pyi | 64 +++++++++++++++++++++++++++++++-------- 2 files changed, 97 insertions(+), 26 deletions(-) diff --git a/stdlib/2.7/subprocess.pyi b/stdlib/2.7/subprocess.pyi index 7a42eff6504c..df8da0acda84 100644 --- a/stdlib/2.7/subprocess.pyi +++ b/stdlib/2.7/subprocess.pyi @@ -6,20 +6,51 @@ from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional _FILE = Union[int, IO[Any]] -# TODO force keyword arguments -# TODO more keyword arguments (from Popen) -def call(args: Union[str, Sequence[str]], *, - stdin: _FILE = ..., stdout: _FILE = ..., stderr: _FILE = ..., - shell: bool = ..., env: Mapping[str, str] = ..., - cwd: str = ...) -> int: ... -def check_call(args: Union[str, Sequence[str]], *, - stdin: _FILE = ..., stdout: _FILE = ..., stderr: _FILE = ..., - shell: bool = ..., env: Mapping[str, str] = ..., cwd: str = ..., - close_fds: Sequence[_FILE] = ..., preexec_fn: Callable[[], Any] = ...) -> int: ... -def check_output(args: Union[str, Sequence[str]], *, - stdin: _FILE = ..., stderr: _FILE = ..., - shell: bool = ..., universal_newlines: bool = ..., - env: Mapping[str, str] = ..., cwd: str = ...) -> str: ... +# Same args as Popen.__init__ +def call(args: Union[str, Sequence[str]], + bufsize: int = ..., + executable: str = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: str = ..., + env: Mapping[str, str] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ...) -> int: ... + +def check_call(args: Union[str, Sequence[str]], + bufsize: int = ..., + executable: str = ..., + stdin: _FILE = ..., + stdout: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: str = ..., + env: Mapping[str, str] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ...) -> int: ... + +# Same args as Popen.__init__ except for stdout +def check_output(args: Union[str, Sequence[str]], + bufsize: int = ..., + executable: str = ..., + stdin: _FILE = ..., + stderr: _FILE = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: str = ..., + env: Mapping[str, str] = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ...) -> str: ... PIPE = ... # type: int STDOUT = ... # type: int diff --git a/stdlib/3/subprocess.pyi b/stdlib/3/subprocess.pyi index 83d62cf9e2ca..662c182371c0 100644 --- a/stdlib/3/subprocess.pyi +++ b/stdlib/3/subprocess.pyi @@ -4,21 +4,61 @@ from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union -# TODO force keyword arguments -# TODO more keyword arguments -def call(args: Union[str, Sequence[str]], *, stdin: Any = ..., stdout: Any = ..., - stderr: Any = ..., shell: bool = ..., +# Same args as Popen.__init__ +def call(args: Union[str, Sequence[str]], + bufsize: int = ..., + executable: str = ..., + stdin: Any = ..., + stdout: Any = ..., + stderr: Any = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: str = ..., env: Mapping[str, str] = ..., - cwd: str = ...) -> int: ... -def check_call(args: Union[str, Sequence[str]], *, stdin: Any = ..., stdout: Any = ..., - stderr: Any = ..., shell: bool = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ...) -> int: ... + +# Same args as Popen.__init__ +def check_call(args: Union[str, Sequence[str]], + bufsize: int = ..., + executable: str = ..., + stdin: Any = ..., + stdout: Any = ..., + stderr: Any = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: str = ..., env: Mapping[str, str] = ..., - cwd: str = ...) -> int: ... -# Return str/bytes -def check_output(args: Union[str, Sequence[str]], *, stdin: Any = ..., stderr: Any = ..., - shell: bool = ..., universal_newlines: bool = ..., + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ...) -> int: ... + +# Same args as Popen.__init__, except for stdout +def check_output(args: Union[str, Sequence[str]], + bufsize: int = ..., + executable: str = ..., + stdin: Any = ..., + stderr: Any = ..., + preexec_fn: Callable[[], Any] = ..., + close_fds: bool = ..., + shell: bool = ..., + cwd: str = ..., env: Mapping[str, str] = ..., - cwd: str = ...) -> Any: ... + universal_newlines: bool = ..., + startupinfo: Any = ..., + creationflags: int = ..., + restore_signals: bool = ..., + start_new_session: bool = ..., + pass_fds: Any = ...) -> bytes: ... # TODO types PIPE = ... # type: Any