mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-29 07:06:55 +08:00
ChainMap fixes (#878)
- It didn't exist before 3.3 (https://docs.python.org/3/library/collections.html#chainmap-objects) - It's not a subclass of dict
This commit is contained in:
committed by
Guido van Rossum
parent
bb5ba13315
commit
6e84021f56
@@ -92,17 +92,3 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __init__(self, default_factory: Callable[[], _VT],
|
||||
iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
|
||||
class ChainMap(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ...
|
||||
|
||||
@property
|
||||
def maps(self) -> List[Mapping[_KT, _VT]]: ...
|
||||
|
||||
def new_child(self, m: Mapping[_KT, _VT] = ...) -> ChainMap[_KT, _VT]: ...
|
||||
|
||||
@property
|
||||
def parents(self) -> ChainMap[_KT, _VT]: ...
|
||||
|
||||
@@ -166,16 +166,17 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
# TODO __reversed__
|
||||
|
||||
class ChainMap(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ...
|
||||
if sys.version_info >= (3, 3):
|
||||
class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ...
|
||||
|
||||
@property
|
||||
def maps(self) -> List[Mapping[_KT, _VT]]: ...
|
||||
@property
|
||||
def maps(self) -> List[Mapping[_KT, _VT]]: ...
|
||||
|
||||
def new_child(self, m: Mapping[_KT, _VT] = ...) -> ChainMap[_KT, _VT]: ...
|
||||
def new_child(self, m: Mapping[_KT, _VT] = ...) -> ChainMap[_KT, _VT]: ...
|
||||
|
||||
@property
|
||||
def parents(self) -> ChainMap[_KT, _VT]: ...
|
||||
@property
|
||||
def parents(self) -> ChainMap[_KT, _VT]: ...
|
||||
|
||||
Reference in New Issue
Block a user