From c9ad4b8dc0ede6aed87430102329b99ae833e48b Mon Sep 17 00:00:00 2001 From: Josiah Boning Date: Wed, 30 Nov 2016 17:58:11 -0800 Subject: [PATCH] Have frozenset inherit from FrozenSet (#726) Fixes python/mypy#2514 --- stdlib/2/__builtin__.pyi | 4 ++-- stdlib/3/builtins.pyi | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/stdlib/2/__builtin__.pyi b/stdlib/2/__builtin__.pyi index 121fe7de3..b6de92b57 100644 --- a/stdlib/2/__builtin__.pyi +++ b/stdlib/2/__builtin__.pyi @@ -6,7 +6,7 @@ from typing import ( TypeVar, Iterator, Iterable, overload, Sequence, Mapping, Tuple, List, Any, Dict, Callable, Generic, Set, - AbstractSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, + AbstractSet, FrozenSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsAbs, SupportsRound, IO, BinaryIO, Union, AnyStr, MutableSequence, MutableMapping, MutableSet, ItemsView, KeysView, ValuesView, Optional, Container, ) @@ -602,7 +602,7 @@ class set(MutableSet[_T], Generic[_T]): def __gt__(self, s: AbstractSet[Any]) -> bool: ... # TODO more set operations -class frozenset(AbstractSet[_T], Generic[_T]): +class frozenset(FrozenSet[_T], Generic[_T]): @overload def __init__(self) -> None: ... @overload diff --git a/stdlib/3/builtins.pyi b/stdlib/3/builtins.pyi index 8c7570689..7bf2f962a 100644 --- a/stdlib/3/builtins.pyi +++ b/stdlib/3/builtins.pyi @@ -3,8 +3,9 @@ from typing import ( TypeVar, Iterator, Iterable, overload, Container, Sequence, MutableSequence, Mapping, MutableMapping, Tuple, List, Any, Dict, Callable, Generic, - Set, AbstractSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, SupportsBytes, - SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, ByteString, Optional + Set, AbstractSet, FrozenSet, MutableSet, Sized, Reversible, SupportsInt, SupportsFloat, + SupportsBytes, SupportsAbs, SupportsRound, IO, Union, ItemsView, KeysView, ValuesView, + ByteString, Optional ) from abc import abstractmethod, ABCMeta from types import TracebackType @@ -610,7 +611,7 @@ class set(MutableSet[_T], Generic[_T]): def __gt__(self, s: AbstractSet[Any]) -> bool: ... # TODO more set operations -class frozenset(AbstractSet[_T], Generic[_T]): +class frozenset(FrozenSet[_T], Generic[_T]): def __init__(self, iterable: Iterable[_T] = ...) -> None: ... def copy(self) -> frozenset[_T]: ... def difference(self, *s: Iterable[Any]) -> frozenset[_T]: ...