diff --git a/builtins/2.7/_functools.pyi b/builtins/2.7/_functools.pyi index 09150c780..d6245db26 100644 --- a/builtins/2.7/_functools.pyi +++ b/builtins/2.7/_functools.pyi @@ -1,6 +1,6 @@ """Stub file for the '_functools' module.""" -from typing import Any, Callable, Iterator, Optional, TypeVar, Tuple, overload +from typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Tuple, overload _T = TypeVar("_T") diff --git a/builtins/2.7/_warnings.pyi b/builtins/2.7/_warnings.pyi index 99b864407..0b24966ca 100644 --- a/builtins/2.7/_warnings.pyi +++ b/builtins/2.7/_warnings.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, List default_action = ... # type: str filters = ... # type: List[tuple] diff --git a/builtins/2.7/array.pyi b/builtins/2.7/array.pyi index baaa50e13..3ff408158 100644 --- a/builtins/2.7/array.pyi +++ b/builtins/2.7/array.pyi @@ -1,7 +1,7 @@ """Stub file for the 'array' module.""" from typing import (Any, Generic, IO, Iterable, Sequence, TypeVar, - Union, overload, Iterator, Tuple, BinaryIO) + Union, overload, Iterator, Tuple, BinaryIO, List) T = TypeVar('T') diff --git a/builtins/2.7/cPickle.pyi b/builtins/2.7/cPickle.pyi index b55f96853..acfcdf4a7 100644 --- a/builtins/2.7/cPickle.pyi +++ b/builtins/2.7/cPickle.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO +from typing import Any, IO, List HIGHEST_PROTOCOL = ... # type: int compatible_formats = ... # type: List[str] diff --git a/builtins/2.7/cStringIO.pyi b/builtins/2.7/cStringIO.pyi index 65cada0b1..e5bf4653d 100644 --- a/builtins/2.7/cStringIO.pyi +++ b/builtins/2.7/cStringIO.pyi @@ -1,7 +1,7 @@ # Stubs for cStringIO (Python 2.7) # See https://docs.python.org/2/library/stringio.html -from typing import overload, IO, List, Iterable, Iterator, Union +from typing import overload, IO, List, Iterable, Iterator, Optional, Union from types import TracebackType # TODO the typing.IO[] generics should be split into input and output. @@ -18,7 +18,7 @@ class InputType(IO[str], Iterator[str]): def readlines(self, hint: int = -1) -> List[str]: ... def seek(self, offset: int, whence: int = ...) -> None: ... def tell(self) -> int: ... - def truncate(self, size: int = ...) -> None: ... + def truncate(self, size: int = ...) -> Optional[int]: ... def __iter__(self) -> 'InputType': ... def next(self) -> str: ... def reset(self) -> None: ... @@ -37,7 +37,7 @@ class OutputType(IO[str], Iterator[str]): def readlines(self, hint: int = -1) -> List[str]: ... def seek(self, offset: int, whence: int = ...) -> None: ... def tell(self) -> int: ... - def truncate(self, size: int = ...) -> None: ... + def truncate(self, size: int = ...) -> Optional[int]: ... def __iter__(self) -> 'OutputType': ... def next(self) -> str: ... def reset(self) -> None: ... diff --git a/builtins/2.7/select.pyi b/builtins/2.7/select.pyi index ba6e9afbb..533114405 100644 --- a/builtins/2.7/select.pyi +++ b/builtins/2.7/select.pyi @@ -1,6 +1,6 @@ """Stubs for the 'select' module.""" -from typing import Any, Optional, Tuple, Iterable +from typing import Any, Optional, Tuple, Iterable, List EPOLLERR = ... # type: int EPOLLET = ... # type: int diff --git a/builtins/3/_codecs.pyi b/builtins/3/_codecs.pyi index b2f7a1a93..23fcd8229 100644 --- a/builtins/3/_codecs.pyi +++ b/builtins/3/_codecs.pyi @@ -1,6 +1,6 @@ """Stub file for the '_codecs' module.""" -from typing import Any, AnyStr, Callable, Tuple, Optional +from typing import Any, AnyStr, Callable, Tuple, Optional, Dict import codecs diff --git a/builtins/3/_warnings.pyi b/builtins/3/_warnings.pyi index acf046031..03f1be1de 100644 --- a/builtins/3/_warnings.pyi +++ b/builtins/3/_warnings.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, List _defaultaction = ... # type: str _onceregistry = ... # type: dict diff --git a/builtins/3/signal.pyi b/builtins/3/signal.pyi index 8c54e40e9..f956e05bb 100644 --- a/builtins/3/signal.pyi +++ b/builtins/3/signal.pyi @@ -1,6 +1,6 @@ """Stub file for the 'signal' module.""" -from typing import Any, Callable, List, Tuple, Dict, Generic, Union, Optional, Iterable +from typing import Any, Callable, List, Tuple, Dict, Generic, Union, Optional, Iterable, Set from types import FrameType class ItimerError(IOError): ... diff --git a/stdlib/2.7/StringIO.pyi b/stdlib/2.7/StringIO.pyi index 34da578a8..872bb49ae 100644 --- a/stdlib/2.7/StringIO.pyi +++ b/stdlib/2.7/StringIO.pyi @@ -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 diff --git a/stdlib/2.7/gettext.pyi b/stdlib/2.7/gettext.pyi index 8921be97f..57f00091e 100644 --- a/stdlib/2.7/gettext.pyi +++ b/stdlib/2.7/gettext.pyi @@ -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: ... diff --git a/stdlib/2.7/urlparse.pyi b/stdlib/2.7/urlparse.pyi index bf2e7917c..832b955b7 100644 --- a/stdlib/2.7/urlparse.pyi +++ b/stdlib/2.7/urlparse.pyi @@ -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] diff --git a/stdlib/3.4/asyncio/__init__.pyi b/stdlib/3.4/asyncio/__init__.pyi index 1f86a7422..e22015e51 100644 --- a/stdlib/3.4/asyncio/__init__.pyi +++ b/stdlib/3.4/asyncio/__init__.pyi @@ -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__ + diff --git a/stdlib/3/collections.pyi b/stdlib/3/collections.pyi index fcf029d4e..ba656b684 100644 --- a/stdlib/3/collections.pyi +++ b/stdlib/3/collections.pyi @@ -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, diff --git a/third_party/2.7/google/protobuf/internal/enum_type_wrapper.pyi b/third_party/2.7/google/protobuf/internal/enum_type_wrapper.pyi index 64d359dfd..ced66b89e 100644 --- a/third_party/2.7/google/protobuf/internal/enum_type_wrapper.pyi +++ b/third_party/2.7/google/protobuf/internal/enum_type_wrapper.pyi @@ -1,4 +1,4 @@ -from typing import Any, Tuple +from typing import Any, List, Tuple class EnumTypeWrapper(object): def __init__(self, enum_type: Any) -> None: ... diff --git a/third_party/2.7/scribe/scribe.pyi b/third_party/2.7/scribe/scribe.pyi index 9447a0d64..24bf0c16c 100644 --- a/third_party/2.7/scribe/scribe.pyi +++ b/third_party/2.7/scribe/scribe.pyi @@ -2,6 +2,8 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import Any + import fb303.FacebookService from .ttypes import * from thrift.Thrift import TProcessor diff --git a/third_party/2.7/thrift/protocol/TBinaryProtocol.pyi b/third_party/2.7/thrift/protocol/TBinaryProtocol.pyi index 09a98f602..a75bf88e6 100644 --- a/third_party/2.7/thrift/protocol/TBinaryProtocol.pyi +++ b/third_party/2.7/thrift/protocol/TBinaryProtocol.pyi @@ -2,6 +2,8 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import Any + from .TProtocol import * class TBinaryProtocol(TProtocolBase): diff --git a/third_party/2.7/thrift/protocol/TProtocol.pyi b/third_party/2.7/thrift/protocol/TProtocol.pyi index 0a52f5656..93e949fda 100644 --- a/third_party/2.7/thrift/protocol/TProtocol.pyi +++ b/third_party/2.7/thrift/protocol/TProtocol.pyi @@ -2,6 +2,8 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import Any + from thrift.Thrift import * class TProtocolException(TException): diff --git a/third_party/2.7/thrift/transport/TSocket.pyi b/third_party/2.7/thrift/transport/TSocket.pyi index 3e2b793dc..da9746297 100644 --- a/third_party/2.7/thrift/transport/TSocket.pyi +++ b/third_party/2.7/thrift/transport/TSocket.pyi @@ -2,6 +2,8 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. +from typing import Any + from .TTransport import * class TSocketBase(TTransportBase):