From 9cc81d4eeba49623f57dfbc7d706d90deeb6b147 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 27 Jan 2016 15:20:46 -0800 Subject: [PATCH] Add 2.7 stubs for dict.fromkeys(). Fixes mypy #1176. --- stdlib/2.7/__builtin__.pyi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/stdlib/2.7/__builtin__.pyi b/stdlib/2.7/__builtin__.pyi index bdbb42a4f..fac290b03 100644 --- a/stdlib/2.7/__builtin__.pyi +++ b/stdlib/2.7/__builtin__.pyi @@ -531,6 +531,12 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def iterkeys(self) -> Iterator[_KT]: ... def itervalues(self) -> Iterator[_VT]: ... def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ... + @staticmethod + @overload + def fromkeys(seq: Sequence[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method + @staticmethod + @overload + def fromkeys(seq: Sequence[_T], value: _S) -> Dict[_T, _S]: ... def __len__(self) -> int: ... def __getitem__(self, k: _KT) -> _VT: ... def __setitem__(self, k: _KT, v: _VT) -> None: ...