Update 2.7 built-in set to be the same as PY3 set. AbstractSet does not have a union() method.

This commit is contained in:
Guido van Rossum
2016-01-06 16:06:58 -08:00
parent 76b746ba3f
commit 71b8a9f9ec
2 changed files with 28 additions and 17 deletions

View File

@@ -539,28 +539,40 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __str__(self) -> str: ...
class set(MutableSet[_T], Generic[_T]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, iterable: Iterable[_T]) -> None: ...
def __init__(self, iterable: Iterable[_T]=None) -> None: ...
def add(self, element: _T) -> None: ...
def remove(self, element: _T) -> None: ...
def copy(self) -> AbstractSet[_T]: ...
def isdisjoint(self, s: AbstractSet[_T]) -> bool: ...
def issuperset(self, s: AbstractSet[_T]) -> bool: ...
def issubset(self, s: AbstractSet[_T]) -> bool: ...
def update(self, s: AbstractSet[_T]) -> None: ...
def difference_update(self, s: AbstractSet[_T]) -> None: ...
def clear(self) -> None: ...
def copy(self) -> set[_T]: ...
def difference(self, s: Iterable[Any]) -> set[_T]: ...
def difference_update(self, s: Iterable[Any]) -> None: ...
def discard(self, element: _T) -> None: ...
def intersection_update(self, s: AbstractSet[_T]) -> None: ...
def intersection(self, s: Iterable[Any]) -> set[_T]: ...
def intersection_update(self, s: Iterable[Any]) -> None: ...
def isdisjoint(self, s: AbstractSet[Any]) -> bool: ...
def issubset(self, s: AbstractSet[Any]) -> bool: ...
def issuperset(self, s: AbstractSet[Any]) -> bool: ...
def pop(self) -> _T: ...
def remove(self, element: _T) -> None: ...
def symmetric_difference(self, s: Iterable[_T]) -> set[_T]: ...
def symmetric_difference_update(self, s: Iterable[_T]) -> None: ...
def union(self, s: Iterable[_T]) -> set[_T]: ...
def update(self, s: Iterable[_T]) -> None: ...
def __len__(self) -> int: ...
def __contains__(self, o: object) -> bool: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[_T]) -> AbstractSet[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> AbstractSet[Union[_T, _S]]: ...
def __sub__(self, s: AbstractSet[_T]) -> AbstractSet[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> AbstractSet[Union[_T, _S]]: ...
def __and__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __iand__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __ior__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __sub__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __isub__(self, s: AbstractSet[Any]) -> set[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __ixor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
def __le__(self, s: AbstractSet[Any]) -> bool: ...
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
# TODO more set operations
class frozenset(AbstractSet[_T], Generic[_T]):

View File

@@ -129,7 +129,6 @@ class AbstractSet(Sized, Iterable[_T_co], Generic[_T_co]):
def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
# TODO: argument can be any container?
def isdisjoint(self, s: AbstractSet[Any]) -> bool: ...
def union(self, s: AbstractSet[_T]) -> AbstractSet[Union[_T_co, _T]]: ...
class MutableSet(AbstractSet[_T], Generic[_T]):
@abstractmethod