Skip to content

Commit 7bef3ad

Browse files
Merge pull request #297 from alvarocaceres/subprocess
Fix signatures of call, check_call and check_output in subprocess
2 parents 3eedf73 + 5886a5d commit 7bef3ad

File tree

2 files changed

+97
-26
lines changed

2 files changed

+97
-26
lines changed

stdlib/2.7/subprocess.pyi

+45-14
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,51 @@ from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional
66

77
_FILE = Union[int, IO[Any]]
88

9-
# TODO force keyword arguments
10-
# TODO more keyword arguments (from Popen)
11-
def call(args: Union[str, Sequence[str]], *,
12-
stdin: _FILE = ..., stdout: _FILE = ..., stderr: _FILE = ...,
13-
shell: bool = ..., env: Mapping[str, str] = ...,
14-
cwd: str = ...) -> int: ...
15-
def check_call(args: Union[str, Sequence[str]], *,
16-
stdin: _FILE = ..., stdout: _FILE = ..., stderr: _FILE = ...,
17-
shell: bool = ..., env: Mapping[str, str] = ..., cwd: str = ...,
18-
close_fds: Sequence[_FILE] = ..., preexec_fn: Callable[[], Any] = ...) -> int: ...
19-
def check_output(args: Union[str, Sequence[str]], *,
20-
stdin: _FILE = ..., stderr: _FILE = ...,
21-
shell: bool = ..., universal_newlines: bool = ...,
22-
env: Mapping[str, str] = ..., cwd: str = ...) -> str: ...
9+
# Same args as Popen.__init__
10+
def call(args: Union[str, Sequence[str]],
11+
bufsize: int = ...,
12+
executable: str = ...,
13+
stdin: _FILE = ...,
14+
stdout: _FILE = ...,
15+
stderr: _FILE = ...,
16+
preexec_fn: Callable[[], Any] = ...,
17+
close_fds: bool = ...,
18+
shell: bool = ...,
19+
cwd: str = ...,
20+
env: Mapping[str, str] = ...,
21+
universal_newlines: bool = ...,
22+
startupinfo: Any = ...,
23+
creationflags: int = ...) -> int: ...
24+
25+
def check_call(args: Union[str, Sequence[str]],
26+
bufsize: int = ...,
27+
executable: str = ...,
28+
stdin: _FILE = ...,
29+
stdout: _FILE = ...,
30+
stderr: _FILE = ...,
31+
preexec_fn: Callable[[], Any] = ...,
32+
close_fds: bool = ...,
33+
shell: bool = ...,
34+
cwd: str = ...,
35+
env: Mapping[str, str] = ...,
36+
universal_newlines: bool = ...,
37+
startupinfo: Any = ...,
38+
creationflags: int = ...) -> int: ...
39+
40+
# Same args as Popen.__init__ except for stdout
41+
def check_output(args: Union[str, Sequence[str]],
42+
bufsize: int = ...,
43+
executable: str = ...,
44+
stdin: _FILE = ...,
45+
stderr: _FILE = ...,
46+
preexec_fn: Callable[[], Any] = ...,
47+
close_fds: bool = ...,
48+
shell: bool = ...,
49+
cwd: str = ...,
50+
env: Mapping[str, str] = ...,
51+
universal_newlines: bool = ...,
52+
startupinfo: Any = ...,
53+
creationflags: int = ...) -> str: ...
2354

2455
PIPE = ... # type: int
2556
STDOUT = ... # type: int

stdlib/3/subprocess.pyi

+52-12
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,61 @@
44

55
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union
66

7-
# TODO force keyword arguments
8-
# TODO more keyword arguments
9-
def call(args: Union[str, Sequence[str]], *, stdin: Any = ..., stdout: Any = ...,
10-
stderr: Any = ..., shell: bool = ...,
7+
# Same args as Popen.__init__
8+
def call(args: Union[str, Sequence[str]],
9+
bufsize: int = ...,
10+
executable: str = ...,
11+
stdin: Any = ...,
12+
stdout: Any = ...,
13+
stderr: Any = ...,
14+
preexec_fn: Callable[[], Any] = ...,
15+
close_fds: bool = ...,
16+
shell: bool = ...,
17+
cwd: str = ...,
1118
env: Mapping[str, str] = ...,
12-
cwd: str = ...) -> int: ...
13-
def check_call(args: Union[str, Sequence[str]], *, stdin: Any = ..., stdout: Any = ...,
14-
stderr: Any = ..., shell: bool = ...,
19+
universal_newlines: bool = ...,
20+
startupinfo: Any = ...,
21+
creationflags: int = ...,
22+
restore_signals: bool = ...,
23+
start_new_session: bool = ...,
24+
pass_fds: Any = ...) -> int: ...
25+
26+
# Same args as Popen.__init__
27+
def check_call(args: Union[str, Sequence[str]],
28+
bufsize: int = ...,
29+
executable: str = ...,
30+
stdin: Any = ...,
31+
stdout: Any = ...,
32+
stderr: Any = ...,
33+
preexec_fn: Callable[[], Any] = ...,
34+
close_fds: bool = ...,
35+
shell: bool = ...,
36+
cwd: str = ...,
1537
env: Mapping[str, str] = ...,
16-
cwd: str = ...) -> int: ...
17-
# Return str/bytes
18-
def check_output(args: Union[str, Sequence[str]], *, stdin: Any = ..., stderr: Any = ...,
19-
shell: bool = ..., universal_newlines: bool = ...,
38+
universal_newlines: bool = ...,
39+
startupinfo: Any = ...,
40+
creationflags: int = ...,
41+
restore_signals: bool = ...,
42+
start_new_session: bool = ...,
43+
pass_fds: Any = ...) -> int: ...
44+
45+
# Same args as Popen.__init__, except for stdout
46+
def check_output(args: Union[str, Sequence[str]],
47+
bufsize: int = ...,
48+
executable: str = ...,
49+
stdin: Any = ...,
50+
stderr: Any = ...,
51+
preexec_fn: Callable[[], Any] = ...,
52+
close_fds: bool = ...,
53+
shell: bool = ...,
54+
cwd: str = ...,
2055
env: Mapping[str, str] = ...,
21-
cwd: str = ...) -> Any: ...
56+
universal_newlines: bool = ...,
57+
startupinfo: Any = ...,
58+
creationflags: int = ...,
59+
restore_signals: bool = ...,
60+
start_new_session: bool = ...,
61+
pass_fds: Any = ...) -> bytes: ...
2262

2363
# TODO types
2464
PIPE = ... # type: Any

0 commit comments

Comments
 (0)