Have frozenset inherit from FrozenSet (#726)

Fixes python/mypy#2514
This commit is contained in:
Josiah Boning
2016-11-30 17:58:11 -08:00
committed by Guido van Rossum
parent d1081b94ee
commit c9ad4b8dc0
2 changed files with 6 additions and 5 deletions

View File

@@ -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

View File

@@ -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]: ...