diff --git a/stdlib/2.7/UserList.pyi b/stdlib/2.7/UserList.pyi new file mode 100644 index 000000000..4f31b93b0 --- /dev/null +++ b/stdlib/2.7/UserList.pyi @@ -0,0 +1,3 @@ +import collections + +class UserList(collections.MutableSequence): ... diff --git a/stdlib/2.7/UserString.pyi b/stdlib/2.7/UserString.pyi new file mode 100644 index 000000000..d2a33c32a --- /dev/null +++ b/stdlib/2.7/UserString.pyi @@ -0,0 +1,4 @@ +import collections + +class UserString(collections.Sequence): ... +class MutableString(UserString, collections.MutableSequence): ... \ No newline at end of file diff --git a/stdlib/2.7/collections.pyi b/stdlib/2.7/collections.pyi index ab40403a6..69f13677a 100644 --- a/stdlib/2.7/collections.pyi +++ b/stdlib/2.7/collections.pyi @@ -2,16 +2,13 @@ # Based on http://docs.python.org/2.7/library/collections.html -# TODO UserDict -# TODO UserList -# TODO UserString # TODO more abstract base classes (interfaces in mypy) # NOTE: These are incomplete! from typing import ( Dict, Generic, TypeVar, Iterable, Tuple, Callable, Mapping, overload, Iterator, Sized, - Optional, List, Set, Sequence, Union, Reversible + Optional, List, Set, Sequence, Union, Reversible, MutableMapping, MutableSequence ) import typing @@ -22,8 +19,6 @@ _VT = TypeVar('_VT') # namedtuple is special-cased in the type checker; the initializer is ignored. namedtuple = object() -MutableMapping = typing.MutableMapping - class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]): def __init__(self, iterable: Iterable[_T] = ..., maxlen: int = ...) -> None: ... diff --git a/stdlib/3/collections.pyi b/stdlib/3/collections.pyi index 956cb286f..4939e9268 100644 --- a/stdlib/3/collections.pyi +++ b/stdlib/3/collections.pyi @@ -2,9 +2,6 @@ # Based on http://docs.python.org/3.2/library/collections.html -# TODO UserDict -# TODO UserList -# TODO UserString # TODO more abstract base classes (interfaces in mypy) # These are not exported. @@ -30,6 +27,10 @@ _VT = TypeVar('_VT') # namedtuple is special-cased in the type checker; the initializer is ignored. namedtuple = object() +class UserDict(MutableMapping): ... +class UserList(MutableSequence): ... +class UserString(Sequence): ... +class MutableString(UserString, MutableSequence): ... # Technically, deque only derives from MutableSequence in 3.5. # But in practice it's not worth losing sleep over. diff --git a/third_party/2.7/six/moves/__init__.pyi b/third_party/2.7/six/moves/__init__.pyi index 827ee8a5d..1347e7510 100644 --- a/third_party/2.7/six/moves/__init__.pyi +++ b/third_party/2.7/six/moves/__init__.pyi @@ -14,8 +14,8 @@ from __builtin__ import reduce as reduce from pipes import quote as shlex_quote from StringIO import StringIO as StringIO from UserDict import UserDict as UserDict -## from UserList import UserList as UserList -## from UserString import UserString as UserString +from UserList import UserList as UserList +from UserString import UserString as UserString from __builtin__ import xrange as xrange from itertools import izip as zip from itertools import izip_longest as zip_longest diff --git a/third_party/3/six/moves/__init__.pyi b/third_party/3/six/moves/__init__.pyi index 4f41143e9..49cf9bcab 100644 --- a/third_party/3/six/moves/__init__.pyi +++ b/third_party/3/six/moves/__init__.pyi @@ -16,9 +16,9 @@ from imp import reload as reload_module from functools import reduce as reduce from shlex import quote as shlex_quote from io import StringIO as StringIO -# from collections import UserDict as UserDict -# from collections import UserList as UserList -# from collections import UserString as UserString +from collections import UserDict as UserDict +from collections import UserList as UserList +from collections import UserString as UserString from builtins import range as xrange from builtins import zip as zip from itertools import zip_longest as zip_longest