From c754f3e485f7c42bc10a8a2e2a1c03260845a933 Mon Sep 17 00:00:00 2001 From: wreed4 Date: Thu, 4 Aug 2016 17:19:50 -0400 Subject: [PATCH 1/3] Updating subprocess.pyi to support python 3.5 Also added DEVNULL which was added in 3.3 --- stdlib/3/subprocess.pyi | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/stdlib/3/subprocess.pyi b/stdlib/3/subprocess.pyi index 9de5bf4c0716..4142a7cf21a1 100644 --- a/stdlib/3/subprocess.pyi +++ b/stdlib/3/subprocess.pyi @@ -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]): ... + def check_returncode(): ... + + # 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]], @@ -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 From 8996e93685b93d3b31442311f7a2cbd2dec0a22b Mon Sep 17 00:00:00 2001 From: wreed4 Date: Thu, 4 Aug 2016 17:27:05 -0400 Subject: [PATCH 2/3] Incorrectly checked sys.version_info --- stdlib/3/subprocess.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3/subprocess.pyi b/stdlib/3/subprocess.pyi index 4142a7cf21a1..b1bf839cda98 100644 --- a/stdlib/3/subprocess.pyi +++ b/stdlib/3/subprocess.pyi @@ -6,7 +6,7 @@ import sys from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, List -if sys.version_info >= 3.5: +if sys.version_info >= (3, 5): class CompletedProcess: args = ... # type: Union[List, str] returncode = ... # type: int @@ -99,7 +99,7 @@ def check_output(args: Union[str, Sequence[str]], # TODO types PIPE = ... # type: Any STDOUT = ... # type: Any -if sys.version_info >= 3.3: +if sys.version_info >= (3, 3): DEVNULL = ... # type: Any From f1b6c5044ea231167f0666efff8d3f2ee8086d6f Mon Sep 17 00:00:00 2001 From: wreed4 Date: Fri, 5 Aug 2016 09:36:37 -0400 Subject: [PATCH 3/3] Addressed travis build failures Forgot that __init__ should return None and also forgot "self" on a method. Like a dummy. --- stdlib/3/subprocess.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/3/subprocess.pyi b/stdlib/3/subprocess.pyi index b1bf839cda98..802fd750e0ae 100644 --- a/stdlib/3/subprocess.pyi +++ b/stdlib/3/subprocess.pyi @@ -15,8 +15,8 @@ if sys.version_info >= (3, 5): def __init__(self, args: Union[List, str], returncode: int, stdout: Union[str, bytes], - stderr: Union[str, bytes]): ... - def check_returncode(): ... + 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]],