From 78e6e9b740a1fca27419a2e04d7213df09882e67 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Sat, 16 Apr 2016 13:42:17 -0700 Subject: [PATCH] Add Text to typing.pyi; it's an alias for unicode in 2.7, for str in 3. --- stdlib/2.7/typing.pyi | 2 ++ stdlib/3/typing.pyi | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/stdlib/2.7/typing.pyi b/stdlib/2.7/typing.pyi index 763f0c482..a666f7604 100644 --- a/stdlib/2.7/typing.pyi +++ b/stdlib/2.7/typing.pyi @@ -181,6 +181,8 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]): def update(self, m: Union[Mapping[_KT, _VT], Iterable[Tuple[_KT, _VT]]]) -> None: ... +Text = unicode + class IO(Iterable[AnyStr], Generic[AnyStr]): # TODO detach # TODO use abstract properties diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index 0430e2284..80da6cb1c 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -212,6 +212,8 @@ class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]): def __contains__(self, o: object) -> bool: ... def __iter__(self) -> Iterator[_VT_co]: ... +# TODO: ContextManager (only if contextlib.AbstractContextManager exists) + class Mapping(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]): # TODO: Value type should be covariant, but currently we can't give a good signature for # get if this is the case. @@ -237,6 +239,8 @@ class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]): def update(self, m: Union[Mapping[_KT, _VT], Iterable[Tuple[_KT, _VT]]]) -> None: ... +Text = str + class IO(Iterable[AnyStr], Generic[AnyStr]): # TODO detach # TODO use abstract properties