From 39a668944e62bad9c76a41faad43991a968ec3ec Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 1 Mar 2020 21:26:34 +0200 Subject: [PATCH] stdlib/2and3/builtins: change dict.fromkeys to classmethod The referenced issue in mypy is fixed. --- stdlib/2/__builtin__.pyi | 8 ++++---- stdlib/2and3/builtins.pyi | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 04bcd687ba5b..e5fda2f31734 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -996,12 +996,12 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def viewkeys(self) -> KeysView[_KT]: ... def viewvalues(self) -> ValuesView[_VT]: ... def viewitems(self) -> ItemsView[_KT, _VT]: ... - @staticmethod + @classmethod @overload - def fromkeys(__iterable: Iterable[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method (mypy/issues#328) - @staticmethod + def fromkeys(cls, __iterable: Iterable[_T]) -> Dict[_T, Any]: ... + @classmethod @overload - def fromkeys(__iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ... + def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ... def __len__(self) -> int: ... def __getitem__(self, k: _KT) -> _VT: ... def __setitem__(self, k: _KT, v: _VT) -> None: ... diff --git a/stdlib/2and3/builtins.pyi b/stdlib/2and3/builtins.pyi index 04bcd687ba5b..e5fda2f31734 100644 --- a/stdlib/2and3/builtins.pyi +++ b/stdlib/2and3/builtins.pyi @@ -996,12 +996,12 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def viewkeys(self) -> KeysView[_KT]: ... def viewvalues(self) -> ValuesView[_VT]: ... def viewitems(self) -> ItemsView[_KT, _VT]: ... - @staticmethod + @classmethod @overload - def fromkeys(__iterable: Iterable[_T]) -> Dict[_T, Any]: ... # TODO: Actually a class method (mypy/issues#328) - @staticmethod + def fromkeys(cls, __iterable: Iterable[_T]) -> Dict[_T, Any]: ... + @classmethod @overload - def fromkeys(__iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ... + def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> Dict[_T, _S]: ... def __len__(self) -> int: ... def __getitem__(self, k: _KT) -> _VT: ... def __setitem__(self, k: _KT, v: _VT) -> None: ...