mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Loosen some types to avoid pain in real-life situations (#4870)
In this diff: * Loosen `set.__[i]sub__()` to allow typical use cases (that work at runtime). Namely, allow removing `unicode` from a set of `str`, and allow removing optional values from non-optional sets. * Avoid using union return types in `cryptography` deserialization functions. * Tune `SupportsItems` so that `dict` implements it on Python 2. Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
This commit is contained in:
@@ -807,8 +807,8 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __iand__(self, s: AbstractSet[object]) -> 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[_T]) -> Set[_T]: ...
|
||||
def __isub__(self, s: AbstractSet[_T]) -> Set[_T]: ...
|
||||
def __sub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
|
||||
def __isub__(self, s: AbstractSet[Optional[_T]]) -> 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[object]) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user