Use _typeshed.Self in Python 2, too (#6932)

This commit is contained in:
Alex Waygood
2022-01-16 22:44:51 +00:00
committed by GitHub
parent 0949e9e90d
commit 6a88d5e7ae
29 changed files with 156 additions and 160 deletions

View File

@@ -1,8 +1,8 @@
from _typeshed import Self
from typing import Any, Hashable, Iterable, Iterator, MutableMapping, TypeVar, Union
_T = TypeVar("_T")
_Setlike = Union[BaseSet[_T], Iterable[_T]]
_SelfT = TypeVar("_SelfT")
class BaseSet(Iterable[_T]):
def __init__(self) -> None: ...
@@ -13,17 +13,17 @@ class BaseSet(Iterable[_T]):
def __cmp__(self, other: Any) -> int: ...
def __eq__(self, other: Any) -> bool: ...
def __ne__(self, other: Any) -> bool: ...
def copy(self: _SelfT) -> _SelfT: ...
def __copy__(self: _SelfT) -> _SelfT: ...
def __deepcopy__(self: _SelfT, memo: MutableMapping[int, BaseSet[_T]]) -> _SelfT: ...
def __or__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def union(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ...
def __and__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def intersection(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ...
def __xor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def symmetric_difference(self: _SelfT, other: _Setlike[_T]) -> _SelfT: ...
def __sub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def difference(self: _SelfT, other: _Setlike[Any]) -> _SelfT: ...
def copy(self: Self) -> Self: ...
def __copy__(self: Self) -> Self: ...
def __deepcopy__(self: Self, memo: MutableMapping[int, BaseSet[_T]]) -> Self: ...
def __or__(self: Self, other: BaseSet[_T]) -> Self: ...
def union(self: Self, other: _Setlike[_T]) -> Self: ...
def __and__(self: Self, other: BaseSet[_T]) -> Self: ...
def intersection(self: Self, other: _Setlike[Any]) -> Self: ...
def __xor__(self: Self, other: BaseSet[_T]) -> Self: ...
def symmetric_difference(self: Self, other: _Setlike[_T]) -> Self: ...
def __sub__(self: Self, other: BaseSet[_T]) -> Self: ...
def difference(self: Self, other: _Setlike[Any]) -> Self: ...
def __contains__(self, element: Any) -> bool: ...
def issubset(self, other: BaseSet[_T]) -> bool: ...
def issuperset(self, other: BaseSet[_T]) -> bool: ...
@@ -38,13 +38,13 @@ class ImmutableSet(BaseSet[_T], Hashable):
class Set(BaseSet[_T]):
def __init__(self, iterable: _Setlike[_T] | None = ...) -> None: ...
def __ior__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def __ior__(self: Self, other: BaseSet[_T]) -> Self: ...
def union_update(self, other: _Setlike[_T]) -> None: ...
def __iand__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def __iand__(self: Self, other: BaseSet[_T]) -> Self: ...
def intersection_update(self, other: _Setlike[Any]) -> None: ...
def __ixor__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def __ixor__(self: Self, other: BaseSet[_T]) -> Self: ...
def symmetric_difference_update(self, other: _Setlike[_T]) -> None: ...
def __isub__(self: _SelfT, other: BaseSet[_T]) -> _SelfT: ...
def __isub__(self: Self, other: BaseSet[_T]) -> Self: ...
def difference_update(self, other: _Setlike[Any]) -> None: ...
def update(self, iterable: _Setlike[_T]) -> None: ...
def clear(self) -> None: ...