mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 14:46:55 +08:00
Improve constructor for builtins.dict (#8517)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -1021,9 +1021,13 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, __map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
def __init__(self, __map: SupportsKeysAndGetItem[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, __iterable: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
def __init__(self: dict[str, _VT], __map: SupportsKeysAndGetItem[str, _VT], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, __iterable: Iterable[tuple[_KT, _VT]]) -> None: ...
|
||||
@overload
|
||||
def __init__(self: dict[str, _VT], __iterable: Iterable[tuple[str, _VT]], **kwargs: _VT) -> None: ...
|
||||
# Next overload is for dict(string.split(sep) for string in iterable)
|
||||
# Cannot be Iterable[Sequence[_T]] or otherwise dict(["foo", "bar", "baz"]) is not an error
|
||||
@overload
|
||||
|
||||
@@ -41,9 +41,13 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self: UserDict[str, _VT], __dict: None = ..., **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, __dict: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
def __init__(self, __dict: SupportsKeysAndGetItem[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, __iterable: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
def __init__(self: UserDict[str, _VT], __dict: SupportsKeysAndGetItem[str, _VT], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, __iterable: Iterable[tuple[_KT, _VT]]) -> None: ...
|
||||
@overload
|
||||
def __init__(self: UserDict[str, _VT], __iterable: Iterable[tuple[str, _VT]], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self: UserDict[str, str], __iterable: Iterable[list[str]]) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@@ -183,9 +183,13 @@ class SyncManager(BaseManager):
|
||||
@overload
|
||||
def dict(self, **kwargs: _VT) -> DictProxy[str, _VT]: ...
|
||||
@overload
|
||||
def dict(self, __map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> DictProxy[_KT, _VT]: ...
|
||||
def dict(self, __map: SupportsKeysAndGetItem[_KT, _VT]) -> DictProxy[_KT, _VT]: ...
|
||||
@overload
|
||||
def dict(self, __iterable: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> DictProxy[_KT, _VT]: ...
|
||||
def dict(self, __map: SupportsKeysAndGetItem[str, _VT], **kwargs: _VT) -> DictProxy[str, _VT]: ...
|
||||
@overload
|
||||
def dict(self, __iterable: Iterable[tuple[_KT, _VT]]) -> DictProxy[_KT, _VT]: ...
|
||||
@overload
|
||||
def dict(self, __iterable: Iterable[tuple[str, _VT]], **kwargs: _VT) -> DictProxy[str, _VT]: ...
|
||||
@overload
|
||||
def dict(self, __iterable: Iterable[list[str]]) -> DictProxy[str, str]: ...
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user