mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
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.
This commit is contained in:
@@ -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]],
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user