Skip to content

Add Async classes to typing stub. #30

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 1 commit into from
Dec 3, 2015
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions stdlib/3.4/asyncio/events.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, TypeVar, List, Callable, Tuple, Union, Dict
from typing import Any, Awaitable, TypeVar, List, Callable, Tuple, Union, Dict
from abc import ABCMeta, abstractmethod
from asyncio.futures import Future

Expand Down Expand Up @@ -34,7 +34,7 @@ class AbstractEventLoop(metaclass=ABCMeta):
@abstractmethod
def run_forever(self) -> None: ...
@abstractmethod
def run_until_complete(self, future: Future[_T]) -> _T: ...
def run_until_complete(self, future: Union[Awaitable[_T], Future[_T]]) -> _T: ...
@abstractmethod
def stop(self) -> None: ...
@abstractmethod
Expand Down
30 changes: 29 additions & 1 deletion stdlib/3/typing.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Stubs for typing

from abc import abstractmethod, ABCMeta
from asyncio.futures import Future

# Definitions of special type checking related constructs. Their definition
# are not used, so their value does not matter.
Expand Down Expand Up @@ -94,7 +95,34 @@ class Iterable(Generic[_T_co]):
class Iterator(Iterable[_T_co], Generic[_T_co]):
@abstractmethod
def __next__(self) -> _T_co: ...
def __iter__(self) -> Iterator[_T_co]: ...
def __iter__(self) -> 'Iterator[_T_co]': ...

class Generator(Iterator[_T_co], Generic[_T_co, _T_contra, _V_co]):
@abstractmethod
def __next__(self) -> _T_co:...

@abstractmethod
def send(self, value: _T_contra) -> _T_co:...

@abstractmethod
def throw(self, typ: BaseException, val: Any=None, tb=None) -> None:...

@abstractmethod
def close(self) -> None:...

class Awaitable(Generic[_T_co]):
@abstractmethod
def __await__(self) -> Generator[Future, Any, _T_co]:...

class AsyncIterable(Generic[_T_co]):
@abstractmethod
def __anext__(self) -> Awaitable[_T_co]:...

class AsyncIterator(AsyncIterable[_T_co],
Generic[_T_co]):
@abstractmethod
def __anext__(self) -> Awaitable[_T_co]:...
def __aiter__(self) -> 'AsyncIterator[_T_co]':...

class Container(Generic[_T_co]):
@abstractmethod
Expand Down