Fix asyncio.coroutine signature

This commit is contained in:
David Fisher
2016-02-24 11:35:42 -08:00
parent 335ef31893
commit c48d66f28a
2 changed files with 8 additions and 6 deletions

View File

@@ -1,8 +1,10 @@
from typing import Callable, Any
from typing import Callable, Any, TypeVar
__all__ = ['coroutine',
'iscoroutinefunction', 'iscoroutine']
def coroutine(func: Callable[..., Any]) -> Callable[..., Any]: ...
_T = TypeVar('_T')
def coroutine(func: _T) -> _T: ...
def iscoroutinefunction(func: Callable[..., Any]) -> bool: ...
def iscoroutine(obj: Any) -> bool: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, AnyStr, Tuple
from typing import Any, AnyStr, Tuple, Union
__all__ = ['create_subprocess_exec', 'create_subprocess_shell']
@@ -35,12 +35,12 @@ class Process:
def terminatate(self) -> None: ...
def kill(self) -> None: ...
@coroutine
def communicate(self, input: AnyStr = ...) -> Tuple[AnyStr, AnyStr]: ...
def communicate(self, input: bytes = ...) -> Tuple[bytes, bytes]: ...
@coroutine
def create_subprocess_shell(
*Args: AnyStr,
*Args: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236
stdin: int = ...,
stdout: int = ...,
stderr: int = ...,
@@ -50,7 +50,7 @@ def create_subprocess_shell(
@coroutine
def create_subprocess_exec(
program: AnyStr,
program: Union[str, bytes], # Union used instead of AnyStr due to mypy issue #1236
*args: Any,
stdin: int = ...,
stdout: int = ...,