mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-09 13:02:22 +08:00
Add dict views to python 2 (#376)
This commit is contained in:
committed by
Guido van Rossum
parent
d787dbe984
commit
368c703078
@@ -43,6 +43,7 @@ _KT = TypeVar('_KT') # Key type.
|
||||
_VT = TypeVar('_VT') # Value type.
|
||||
_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers.
|
||||
_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
|
||||
_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.
|
||||
|
||||
@@ -157,6 +158,21 @@ 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 MappingView(Sized):
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class ItemsView(AbstractSet[Tuple[_KT_co, _VT_co]], MappingView, Generic[_KT_co, _VT_co]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[Tuple[_KT_co, _VT_co]]: ...
|
||||
|
||||
class KeysView(AbstractSet[_KT_co], MappingView, Generic[_KT_co]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_KT_co]: ...
|
||||
|
||||
class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]):
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_VT_co]: ...
|
||||
|
||||
class Mapping(Sized, Iterable[_KT], Container[_KT], Generic[_KT, _VT]):
|
||||
@abstractmethod
|
||||
def __getitem__(self, k: _KT) -> _VT: ...
|
||||
|
||||
Reference in New Issue
Block a user