Mark some types as non-hashable (#3219)

Based on @JelleZijlstra's PR #2221.

Fixes #2148
This commit is contained in:
Sebastian Rittau
2019-09-04 17:38:09 +02:00
committed by GitHub
parent 1d21315773
commit efb4af0108
3 changed files with 22 additions and 16 deletions

View File

@@ -734,7 +734,7 @@ class bytearray(MutableSequence[int], ByteString):
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
__hash__: None # type: ignore
@overload
def __getitem__(self, i: int) -> int: ...
@overload
@@ -849,6 +849,7 @@ class slice(object):
def __init__(self, stop: Any) -> None: ...
@overload
def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
__hash__: None # type: ignore
def indices(self, len: int) -> Tuple[int, int, int]: ...
class tuple(Sequence[_T_co], Generic[_T_co]):
@@ -906,7 +907,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __hash__(self) -> int: ...
__hash__: None # type: ignore
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
@@ -980,6 +981,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __delitem__(self, v: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
class set(MutableSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
@@ -1016,6 +1018,7 @@ class set(MutableSet[_T], Generic[_T]):
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
def __gt__(self, s: AbstractSet[object]) -> bool: ...
__hash__: None # type: ignore
class frozenset(AbstractSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...

View File

@@ -734,7 +734,7 @@ class bytearray(MutableSequence[int], ByteString):
def __repr__(self) -> str: ...
def __int__(self) -> int: ...
def __float__(self) -> float: ...
def __hash__(self) -> int: ...
__hash__: None # type: ignore
@overload
def __getitem__(self, i: int) -> int: ...
@overload
@@ -849,6 +849,7 @@ class slice(object):
def __init__(self, stop: Any) -> None: ...
@overload
def __init__(self, start: Any, stop: Any, step: Any = ...) -> None: ...
__hash__: None # type: ignore
def indices(self, len: int) -> Tuple[int, int, int]: ...
class tuple(Sequence[_T_co], Generic[_T_co]):
@@ -906,7 +907,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __len__(self) -> int: ...
def __iter__(self) -> Iterator[_T]: ...
def __str__(self) -> str: ...
def __hash__(self) -> int: ...
__hash__: None # type: ignore
@overload
def __getitem__(self, i: int) -> _T: ...
@overload
@@ -980,6 +981,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def __delitem__(self, v: _KT) -> None: ...
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
__hash__: None # type: ignore
class set(MutableSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
@@ -1016,6 +1018,7 @@ class set(MutableSet[_T], Generic[_T]):
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
def __gt__(self, s: AbstractSet[object]) -> bool: ...
__hash__: None # type: ignore
class frozenset(AbstractSet[_T], Generic[_T]):
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...

View File

@@ -11,8 +11,8 @@ def is_immutable(self): ...
def iter_multi_items(mapping): ...
def native_itermethods(names): ...
class ImmutableListMixin:
def __hash__(self): ...
class ImmutableListMixin(object):
def __hash__(self) -> int: ...
def __reduce_ex__(self, protocol): ...
def __delitem__(self, key): ...
def __delslice__(self, i, j): ...
@@ -28,13 +28,13 @@ class ImmutableListMixin:
def reverse(self): ...
def sort(self, cmp: Optional[Any] = ..., key: Optional[Any] = ..., reverse: Optional[Any] = ...): ...
class ImmutableList(ImmutableListMixin, list): ...
class ImmutableList(ImmutableListMixin, list): ... # type: ignore
class ImmutableDictMixin:
class ImmutableDictMixin(object):
@classmethod
def fromkeys(cls, *args, **kwargs): ...
def __reduce_ex__(self, protocol): ...
def __hash__(self): ...
def __hash__(self) -> int: ...
def setdefault(self, key, default: Optional[Any] = ...): ...
def update(self, *args, **kwargs): ...
def pop(self, key, default: Optional[Any] = ...): ...
@@ -71,7 +71,7 @@ class TypeConversionDict(Dict[_K, _V]):
@overload
def get(self, key: _K, default: _D, type: Callable[[_V], _R]) -> Union[_R, _D]: ...
class ImmutableTypeConversionDict(ImmutableDictMixin, TypeConversionDict[_K, _V]):
class ImmutableTypeConversionDict(ImmutableDictMixin, TypeConversionDict[_K, _V]): # type: ignore
def copy(self) -> TypeConversionDict[_K, _V]: ...
def __copy__(self) -> ImmutableTypeConversionDict[_K, _V]: ...
@@ -207,7 +207,7 @@ class EnvironHeaders(ImmutableHeadersMixin, Headers):
def __iter__(self): ...
def copy(self): ...
class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict):
class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict): # type: ignore
def __reduce_ex__(self, protocol): ...
dicts: Any
def __init__(self, dicts: Optional[Any] = ...): ...
@@ -231,15 +231,15 @@ class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict):
class FileMultiDict(MultiDict):
def add_file(self, name, file, filename: Optional[Any] = ..., content_type: Optional[Any] = ...): ...
class ImmutableDict(ImmutableDictMixin, dict):
class ImmutableDict(ImmutableDictMixin, dict): # type: ignore
def copy(self): ...
def __copy__(self): ...
class ImmutableMultiDict(ImmutableMultiDictMixin, MultiDict):
class ImmutableMultiDict(ImmutableMultiDictMixin, MultiDict): # type: ignore
def copy(self): ...
def __copy__(self): ...
class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict):
class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict): # type: ignore
def copy(self): ...
def __copy__(self): ...
@@ -280,7 +280,7 @@ class _CacheControl(UpdateDictMixin, dict):
def __init__(self, values=..., on_update: Optional[Any] = ...): ...
def to_header(self): ...
class RequestCacheControl(ImmutableDictMixin, _CacheControl):
class RequestCacheControl(ImmutableDictMixin, _CacheControl): # type: ignore
max_stale: Any
min_fresh: Any
no_transform: Any
@@ -360,7 +360,7 @@ class ContentRange:
def __nonzero__(self): ...
__bool__: Any
class Authorization(ImmutableDictMixin, Dict[str, Any]):
class Authorization(ImmutableDictMixin, Dict[str, Any]): # type: ignore
type: str
def __init__(self, auth_type: str, data: Optional[Mapping[str, Any]] = ...) -> None: ...
@property