From 0f21b59a3095201cd3b76614bee1937f4cf5ac78 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 6 Jan 2016 16:38:14 -0800 Subject: [PATCH] Some updates now typing.Container is defined. --- stdlib/2.7/typing.pyi | 7 ++----- stdlib/3/typing.pyi | 2 -- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/stdlib/2.7/typing.pyi b/stdlib/2.7/typing.pyi index 92d8d23e8..a0538b0a2 100644 --- a/stdlib/2.7/typing.pyi +++ b/stdlib/2.7/typing.pyi @@ -44,8 +44,6 @@ _V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers. _VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers. _T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant. -# TODO Container etc. - class SupportsInt(metaclass=ABCMeta): @abstractmethod def __int__(self) -> int: ... @@ -115,7 +113,7 @@ class MutableSequence(Sequence[_T], Generic[_T]): def remove(self, object: _T) -> None: ... def __iadd__(self, x: Iterable[_T]) -> MutableSequence[_T]: ... -class AbstractSet(Sized, Iterable[_T_co], Generic[_T_co]): +class AbstractSet(Sized, Iterable[_T_co], Container[_T_co], Generic[_T_co]): @abstractmethod def __contains__(self, x: object) -> bool: ... # Mixin methods @@ -144,7 +142,7 @@ class MutableSet(AbstractSet[_T], Generic[_T]): def __ixor__(self, s: AbstractSet[_S]) -> MutableSet[Union[_T, _S]]: ... def __isub__(self, s: AbstractSet[Any]) -> MutableSet[_T]: ... -class Mapping(Sized, Iterable[_KT], Generic[_KT, _VT]): +class Mapping(Sized, Iterable[_KT], Container[_KT], Generic[_KT, _VT]): @abstractmethod def __getitem__(self, k: _KT) -> _VT: ... # Mixin methods @@ -155,7 +153,6 @@ class Mapping(Sized, Iterable[_KT], Generic[_KT, _VT]): def iterkeys(self) -> Iterator[_KT]: ... def itervalues(self) -> Iterator[_VT]: ... def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... - def __contains__(self, o: object) -> bool: ... class MutableMapping(Mapping[_KT, _VT], Generic[_KT, _VT]): @abstractmethod diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index eca395c54..da4f69f8f 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -46,8 +46,6 @@ _KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers. _VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers. _T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant. -# TODO Container etc. - class SupportsInt(metaclass=ABCMeta): @abstractmethod def __int__(self) -> int: ...