mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Make signature of DictMixin.get consistent with Mapping.get (#838)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from typing import (Any, Container, Dict, Generic, Iterable, Iterator, List,
|
||||
Mapping, Sized, Tuple, TypeVar, overload)
|
||||
Mapping, Optional, Sized, Tuple, TypeVar, Union, overload)
|
||||
|
||||
_KT = TypeVar('_KT')
|
||||
_VT = TypeVar('_VT')
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
data = ... # type: Mapping[_KT, _VT]
|
||||
@@ -19,7 +20,10 @@ class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]):
|
||||
|
||||
# From typing.Mapping[_KT, _VT]
|
||||
# (can't inherit because of keys())
|
||||
def get(self, k: _KT, default: _VT = ...) -> _VT: ...
|
||||
@overload
|
||||
def get(self, k: _KT) -> Optional[_VT]: ...
|
||||
@overload
|
||||
def get(self, k: _KT, default: _T) -> Union[_VT, _T]: ...
|
||||
def values(self) -> List[_VT]: ...
|
||||
def items(self) -> List[Tuple[_KT, _VT]]: ...
|
||||
def iterkeys(self) -> Iterator[_KT]: ...
|
||||
|
||||
Reference in New Issue
Block a user