Add __new__ to builtin dict (#1056)

This commit is contained in:
Semyon Proshev
2017-03-22 17:33:06 +03:00
committed by Jelle Zijlstra
parent a74c31270d
commit 78d0cc32df
2 changed files with 7 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ from typing import (
Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set,
AbstractSet, FrozenSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs,
SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping,
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container,
MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, Type
)
from abc import abstractmethod, ABCMeta
from mypy_extensions import NoReturn
@@ -555,6 +555,8 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
@overload
def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ...
def has_key(self, k: _KT) -> bool: ...
def clear(self) -> None: ...
def copy(self) -> Dict[_KT, _VT]: ...

View File

@@ -5,7 +5,7 @@ from typing import (
Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic,
Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat,
SupportsBytes, SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView,
ByteString, Optional, AnyStr,
ByteString, Optional, AnyStr, Type,
)
from abc import abstractmethod, ABCMeta
from types import TracebackType
@@ -609,6 +609,9 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __init__(self, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ...
def clear(self) -> None: ...
def copy(self) -> Dict[_KT, _VT]: ...
def popitem(self) -> Tuple[_KT, _VT]: ...