Skip to content

Commit 382cb5f

Browse files
wreed4matthiaskramm
authored andcommitted
Updating subprocess.pyi to support python 3.5 (#438)
* Updating subprocess.pyi to support python 3.5 Also added DEVNULL which was added in 3.3 * Incorrectly checked sys.version_info * Addressed travis build failures Forgot that __init__ should return None and also forgot "self" on a method. Like a dummy.
1 parent 8909145 commit 382cb5f

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

stdlib/3/subprocess.pyi

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,42 @@
33
# Based on http://docs.python.org/3.2/library/subprocess.html
44

55
import sys
6-
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union
6+
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, List
7+
8+
9+
if sys.version_info >= (3, 5):
10+
class CompletedProcess:
11+
args = ... # type: Union[List, str]
12+
returncode = ... # type: int
13+
stdout = ... # type: Union[str, bytes]
14+
stderr = ... # type: Union[str, bytes]
15+
def __init__(self, args: Union[List, str],
16+
returncode: int,
17+
stdout: Union[str, bytes],
18+
stderr: Union[str, bytes]) -> None: ...
19+
def check_returncode(self): ...
20+
21+
# Nearly same args as Popen.__init__ except for timeout, input, and check
22+
def run(args: Union[str, Sequence[str]],
23+
timeout: int = ...,
24+
input: Union[str, bytes] = ...,
25+
check: bool = ...,
26+
bufsize: int = ...,
27+
executable: str = ...,
28+
stdin: Any = ...,
29+
stdout: Any = ...,
30+
stderr: Any = ...,
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 = ...,
39+
restore_signals: bool = ...,
40+
start_new_session: bool = ...,
41+
pass_fds: Any = ...) -> CompletedProcess: ...
742

843
# Same args as Popen.__init__
944
def call(args: Union[str, Sequence[str]],
@@ -64,6 +99,9 @@ def check_output(args: Union[str, Sequence[str]],
6499
# TODO types
65100
PIPE = ... # type: Any
66101
STDOUT = ... # type: Any
102+
if sys.version_info >= (3, 3):
103+
DEVNULL = ... # type: Any
104+
67105

68106
class CalledProcessError(Exception):
69107
returncode = 0

0 commit comments

Comments
 (0)