Add None to type union for subprocess.Popen.communicate input. (#743)

* Add `None` to type union for `subprocess.Popen.communicate` stub's `input` parameter.

* subprocess.communicate `input` annotated as `Optional[AnyStr]` for both 2.7 and 3.x; `timeout` as `Optional[float]`.
This commit is contained in:
George King
2016-12-07 17:46:34 -05:00
committed by Jukka Lehtosalo
parent f39f9bf694
commit dccc29bc2f
2 changed files with 5 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
# Based on http://docs.python.org/2/library/subprocess.html and Python 3 stub
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Union, Optional
from typing import Sequence, Any, AnyStr, Mapping, Callable, Tuple, IO, Union, Optional
_FILE = Union[int, IO[Any]]
@@ -87,7 +87,7 @@ class Popen:
def poll(self) -> int: ...
def wait(self) -> int: ...
def communicate(self, input: Union[bytes, unicode] = ...) -> Tuple[Optional[bytes], Optional[bytes]]: ...
def communicate(self, input: Optional[AnyStr] = ...) -> Tuple[Optional[bytes], Optional[bytes]]: ...
def send_signal(self, signal: int) -> None: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...

View File

@@ -2,7 +2,7 @@
# Based on http://docs.python.org/3.5/library/subprocess.html
import sys
from typing import Sequence, Any, Mapping, Callable, Tuple, IO, Optional, Union, List, Type
from typing import Sequence, Any, AnyStr, Mapping, Callable, Tuple, IO, Optional, Union, List, Type
from types import TracebackType
@@ -234,9 +234,9 @@ class Popen:
def wait(self) ->int: ...
# Return str/bytes
if sys.version_info >= (3, 3):
def communicate(self, input: Union[str, bytes] = ..., timeout: float = ...) -> Tuple[Any, Any]: ...
def communicate(self, input: Optional[AnyStr] = ..., timeout: Optional[float] = ...) -> Tuple[Any, Any]: ...
else:
def communicate(self, input: Union[str, bytes] = ...) -> Tuple[Any, Any]: ...
def communicate(self, input: Optional[AnyStr] = ...) -> Tuple[Any, Any]: ...
def send_signal(self, signal: int) -> None: ...
def terminate(self) -> None: ...
def kill(self) -> None: ...