mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Return ItemsView/KeysView from Mapping methods (#6014)
* Return ItemsView/KeysView from Mapping methods * Make RawConfigParser compatible with Mapping
This commit is contained in:
@@ -435,7 +435,7 @@ class AsyncContextManager(Protocol[_T_co]):
|
||||
|
||||
class Mapping(_Collection[_KT], Generic[_KT, _VT_co]):
|
||||
# TODO: We wish the key type could also be covariant, but that doesn't work,
|
||||
# see discussion in https: //github.com/python/typing/pull/273.
|
||||
# see discussion in https://github.com/python/typing/pull/273.
|
||||
@abstractmethod
|
||||
def __getitem__(self, k: _KT) -> _VT_co: ...
|
||||
# Mixin methods
|
||||
@@ -443,8 +443,8 @@ class Mapping(_Collection[_KT], Generic[_KT, _VT_co]):
|
||||
def get(self, key: _KT) -> _VT_co | None: ...
|
||||
@overload
|
||||
def get(self, key: _KT, default: _VT_co | _T) -> _VT_co | _T: ...
|
||||
def items(self) -> AbstractSet[Tuple[_KT, _VT_co]]: ...
|
||||
def keys(self) -> AbstractSet[_KT]: ...
|
||||
def items(self) -> ItemsView[_KT, _VT_co]: ...
|
||||
def keys(self) -> KeysView[_KT]: ...
|
||||
def values(self) -> ValuesView[_VT_co]: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user