Skip to content

Updating subprocess.pyi to support python 3.5 #438

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 3 commits into from
Aug 5, 2016
Merged
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
40 changes: 39 additions & 1 deletion stdlib/3/subprocess.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,42 @@
# Based on http://docs.python.org/3.2/library/subprocess.html

import sys
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, List


if sys.version_info >= (3, 5):
class CompletedProcess:
args = ... # type: Union[List, str]
returncode = ... # type: int
stdout = ... # type: Union[str, bytes]
stderr = ... # type: Union[str, bytes]
def __init__(self, args: Union[List, str],
returncode: int,
stdout: Union[str, bytes],
stderr: Union[str, bytes]) -> None: ...
def check_returncode(self): ...

# Nearly same args as Popen.__init__ except for timeout, input, and check
def run(args: Union[str, Sequence[str]],
timeout: int = ...,
input: Union[str, bytes] = ...,
check: bool = ...,
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] = ...,
universal_newlines: bool = ...,
startupinfo: Any = ...,
creationflags: int = ...,
restore_signals: bool = ...,
start_new_session: bool = ...,
pass_fds: Any = ...) -> CompletedProcess: ...

# Same args as Popen.__init__
def call(args: Union[str, Sequence[str]],
Expand Down Expand Up @@ -64,6 +99,9 @@ def check_output(args: Union[str, Sequence[str]],
# TODO types
PIPE = ... # type: Any
STDOUT = ... # type: Any
if sys.version_info >= (3, 3):
DEVNULL = ... # type: Any


class CalledProcessError(Exception):
returncode = 0
Expand Down