Fix stubs that assumed reexport without as

This commit is contained in:
Ben Longbons
2015-10-16 14:48:27 -07:00
parent 2f49dfa1f5
commit c2f892a409
19 changed files with 59 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
# Stubs for StringIO (Python 2)
from typing import Any, IO, AnyStr, Iterator, Iterable, Generic
from typing import Any, IO, AnyStr, Iterator, Iterable, Generic, List
class StringIO(IO[AnyStr], Generic[AnyStr]):
closed = ... # type: bool

View File

@@ -1,6 +1,6 @@
# TODO(MichalPokorny): better types
from typing import Any, IO, Optional, Union
from typing import Any, IO, List, Optional, Union
def bindtextdomain(domain: str, localedir: str = None) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str = None) -> str: ...

View File

@@ -1,6 +1,6 @@
# Stubs for urlparse (Python 2)
from typing import List, NamedTuple, Tuple
from typing import Dict, List, NamedTuple, Tuple
uses_relative = [] # type: List[str]
uses_netloc = [] # type: List[str]

View File

@@ -1,11 +1,31 @@
"""The asyncio package, tracking PEP 3156."""
from asyncio.futures import Future
from asyncio.tasks import (coroutine, sleep, Task, FIRST_COMPLETED,
FIRST_EXCEPTION, ALL_COMPLETED, wait, wait_for)
from asyncio.events import (AbstractEventLoopPolicy, AbstractEventLoop,
Handle, get_event_loop)
from asyncio.queues import (Queue, PriorityQueue, LifoQueue, JoinableQueue,
QueueFull, QueueEmpty)
from asyncio.futures import (
Future as Future,
)
from asyncio.tasks import (
coroutine as coroutine,
sleep as sleep,
Task as Task,
FIRST_COMPLETED as FIRST_COMPLETED,
FIRST_EXCEPTION as FIRST_EXCEPTION,
ALL_COMPLETED as ALL_COMPLETED,
wait as wait,
wait_for as wait_for,
)
from asyncio.events import (
AbstractEventLoopPolicy as AbstractEventLoopPolicy,
AbstractEventLoop as AbstractEventLoop,
Handle as Handle,
get_event_loop as get_event_loop,
)
from asyncio.queues import (
Queue as Queue,
PriorityQueue as PriorityQueue,
LifoQueue as LifoQueue,
JoinableQueue as JoinableQueue,
QueueFull as QueueFull,
QueueEmpty as QueueEmpty,
)
__all__ = (futures.__all__ +
tasks.__all__ +

View File

@@ -7,12 +7,19 @@
# TODO UserString
# TODO more abstract base classes (interfaces in mypy)
# These are not exported.
from typing import (
TypeVar, Iterable, Generic, Iterator, Dict, overload,
Mapping, List, Tuple, Callable, Set, Sequence, Sized,
Mapping, List, Tuple, Callable, Sized,
Optional, Union
)
import typing
# These are exported.
# TODO reexport more.
from typing import (
MutableMapping as MutableMapping,
Sequence as Sequence,
AbstractSet as Set,
)
_T = TypeVar('_T')
_KT = TypeVar('_KT')
@@ -23,9 +30,6 @@ _VT = TypeVar('_VT')
namedtuple = object()
MutableMapping = typing.MutableMapping
class deque(Sized, Iterable[_T], Generic[_T]):
maxlen = 0 # type: Optional[int] # TODO readonly
def __init__(self, iterable: Iterable[_T] = None,