Reduce use of Any in equality methods (#7081)

Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
Alex Waygood
2022-01-29 22:59:00 +00:00
committed by GitHub
parent 9aeecb4c35
commit 45a2dad83c
21 changed files with 38 additions and 37 deletions

View File

@@ -122,7 +122,7 @@ class Password:
str: _str | None
def __init__(self, str: _str | None = ..., hashfunc: Callable[[bytes], _HashType] | None = ...) -> None: ...
def set(self, value: bytes | _str) -> None: ...
def __eq__(self, other: Any) -> bool: ...
def __eq__(self, other: _str | bytes | None) -> bool: ... # type: ignore[override]
def __len__(self) -> int: ...
def notify(

View File

@@ -62,7 +62,7 @@ class Call:
) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __deepcopy__(self, memo: Any) -> Task: ...
def __eq__(self, other: Any) -> bool: ...
def __eq__(self, other: Call) -> bool: ... # type: ignore[override]
def make_context(self, config: Config) -> Context: ...
def clone_data(self): ...
# TODO use overload

View File

@@ -14,12 +14,12 @@ def ip_network(address: object, strict: bool = ...) -> Any: ... # morally Union
def ip_interface(address: object) -> Any: ... # morally Union[IPv4Interface, IPv6Interface]
class _IPAddressBase:
def __eq__(self, other: Any) -> bool: ...
def __eq__(self, other: object) -> bool: ...
def __ge__(self: _T, other: _T) -> bool: ...
def __gt__(self: _T, other: _T) -> bool: ...
def __le__(self: _T, other: _T) -> bool: ...
def __lt__(self: _T, other: _T) -> bool: ...
def __ne__(self, other: Any) -> bool: ...
def __ne__(self, other: object) -> bool: ...
@property
def compressed(self) -> Text: ...
@property

View File

@@ -1,5 +1,6 @@
from collections.abc import Callable, Mapping, Sequence
from typing import Any, Generic, TypeVar, overload
from typing_extensions import Literal
_F = TypeVar("_F", bound=Callable[..., Any])
_T = TypeVar("_T")
@@ -40,8 +41,8 @@ class _Call(tuple[Any, ...]):
def __init__(
self, value: Any = ..., name: Any | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ...
) -> None: ...
def __eq__(self, other: Any) -> bool: ...
__ne__: Any
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __call__(self, *args: Any, **kwargs: Any) -> _Call: ...
def __getattr__(self, attr: str) -> Any: ...
@property
@@ -278,8 +279,8 @@ class MagicProxy(Base):
def __get__(self, obj: Any, _type: Any | None = ...) -> Any: ...
class _ANY:
def __eq__(self, other: Any) -> bool: ...
def __ne__(self, other: Any) -> bool: ...
def __eq__(self, other: object) -> Literal[True]: ...
def __ne__(self, other: object) -> Literal[False]: ...
ANY: Any

View File

@@ -95,8 +95,8 @@ class POEntry(_BaseEntry):
def __lt__(self, other: POEntry) -> bool: ...
def __ge__(self, other: POEntry) -> bool: ...
def __le__(self, other: POEntry) -> bool: ...
def __eq__(self, other: Any) -> bool: ...
def __ne__(self, other: Any) -> bool: ...
def __eq__(self, other: POEntry) -> bool: ... # type: ignore[override]
def __ne__(self, other: POEntry) -> bool: ... # type: ignore[override]
def translated(self) -> bool: ...
def merge(self, other: POEntry) -> None: ...
@property

View File

@@ -78,7 +78,7 @@ class Requirement:
@staticmethod
def parse(s: str | Iterable[str]) -> Requirement: ...
def __contains__(self, item: Distribution | str | tuple[str, ...]) -> bool: ...
def __eq__(self, other_requirement: Any) -> bool: ...
def __eq__(self, other_requirement: object) -> bool: ...
def load_entry_point(dist: _EPDistType, group: str, name: str) -> Any: ...
def get_entry_info(dist: _EPDistType, group: str, name: str) -> EntryPoint | None: ...