mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-24 21:01:52 +08:00
Reduce use of Any in equality methods (#7081)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
This commit is contained in:
@@ -41,6 +41,6 @@ class DFAState:
|
||||
def __init__(self, nfaset: dict[NFAState, Any], final: NFAState) -> None: ...
|
||||
def addarc(self, next: DFAState, label: Text) -> None: ...
|
||||
def unifystate(self, old: DFAState, new: DFAState) -> None: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override]
|
||||
|
||||
def generate_grammar(filename: StrPath = ...) -> PgenGrammar: ...
|
||||
|
||||
@@ -20,7 +20,7 @@ class Base:
|
||||
children: list[_NL]
|
||||
was_changed: bool
|
||||
was_checked: bool
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def _eq(self: _P, other: _P) -> bool: ...
|
||||
def clone(self: Self) -> Self: ...
|
||||
def post_order(self) -> Iterator[_NL]: ...
|
||||
|
||||
@@ -46,8 +46,8 @@ class Complex(Number):
|
||||
def __rpow__(self, base: Any) -> Any: ...
|
||||
def __abs__(self) -> Real: ...
|
||||
def conjugate(self) -> Any: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
|
||||
class Real(Complex, SupportsFloat):
|
||||
@abstractmethod
|
||||
|
||||
@@ -9,8 +9,8 @@ class BaseSet(Iterable[_T]):
|
||||
def __len__(self) -> int: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __cmp__(self, other: Any) -> int: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def copy(self: Self) -> Self: ...
|
||||
def __copy__(self: Self) -> Self: ...
|
||||
def __deepcopy__(self: Self, memo: MutableMapping[int, BaseSet[_T]]) -> Self: ...
|
||||
|
||||
@@ -71,7 +71,7 @@ class NamedNodeMap:
|
||||
def values(self): ...
|
||||
def get(self, name, value: Any | None = ...): ...
|
||||
def __len__(self) -> int: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ge__(self, other: Any) -> bool: ...
|
||||
def __gt__(self, other: Any) -> bool: ...
|
||||
def __le__(self, other: Any) -> bool: ...
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Iterator
|
||||
from typing import Iterator
|
||||
|
||||
QP: int # undocumented
|
||||
BASE64: int # undocumented
|
||||
@@ -17,8 +17,8 @@ class Charset:
|
||||
def header_encode(self, string: str) -> str: ...
|
||||
def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> list[str]: ...
|
||||
def body_encode(self, string: str) -> str: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
|
||||
def add_charset(
|
||||
charset: str, header_enc: int | None = ..., body_enc: int | None = ..., output_charset: str | None = ...
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
from email.charset import Charset
|
||||
from typing import Any
|
||||
|
||||
class Header:
|
||||
def __init__(
|
||||
@@ -13,8 +12,8 @@ class Header:
|
||||
) -> None: ...
|
||||
def append(self, s: bytes | str, charset: Charset | str | None = ..., errors: str = ...) -> None: ...
|
||||
def encode(self, splitchars: str = ..., maxlinelen: int | None = ..., linesep: str = ...) -> str: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
|
||||
def decode_header(header: Header | str) -> list[tuple[bytes, str | None]]: ...
|
||||
def make_header(
|
||||
|
||||
@@ -14,12 +14,12 @@ def ip_network(address: object, strict: bool = ...) -> IPv4Network | IPv6Network
|
||||
def ip_interface(address: object) -> IPv4Interface | IPv6Interface: ...
|
||||
|
||||
class _IPAddressBase:
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ge__(self: Self, other: Self) -> bool: ...
|
||||
def __gt__(self: Self, other: Self) -> bool: ...
|
||||
def __le__(self: Self, other: Self) -> bool: ...
|
||||
def __lt__(self: Self, other: Self) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
@property
|
||||
def compressed(self) -> str: ...
|
||||
@property
|
||||
|
||||
@@ -41,6 +41,6 @@ class DFAState:
|
||||
def __init__(self, nfaset: dict[NFAState, Any], final: NFAState) -> None: ...
|
||||
def addarc(self, next: DFAState, label: str) -> None: ...
|
||||
def unifystate(self, old: DFAState, new: DFAState) -> None: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override]
|
||||
|
||||
def generate_grammar(filename: StrPath = ...) -> PgenGrammar: ...
|
||||
|
||||
@@ -19,7 +19,7 @@ class Base:
|
||||
children: list[_NL]
|
||||
was_changed: bool
|
||||
was_checked: bool
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def _eq(self: Self, other: Self) -> bool: ...
|
||||
def clone(self: Self) -> Self: ...
|
||||
def post_order(self) -> Iterator[_NL]: ...
|
||||
|
||||
@@ -42,7 +42,7 @@ class Complex(Number):
|
||||
def __rpow__(self, base: Any) -> Any: ...
|
||||
def __abs__(self) -> Real: ...
|
||||
def conjugate(self) -> Any: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
class Real(Complex, SupportsFloat):
|
||||
@abstractmethod
|
||||
|
||||
@@ -309,8 +309,8 @@ if sys.version_info >= (3, 7):
|
||||
__qualname__: str
|
||||
__objclass__: type
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __ne__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
@final
|
||||
class MethodDescriptorType:
|
||||
__name__: str
|
||||
|
||||
@@ -745,7 +745,7 @@ if sys.version_info >= (3, 7):
|
||||
else:
|
||||
def __init__(self, arg: str, is_argument: bool = ...) -> None: ...
|
||||
def _evaluate(self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None) -> Any | None: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import sys
|
||||
from typing import Any, Awaitable, Callable, Generic, Iterable, Mapping, Sequence, TypeVar, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_TT = TypeVar("_TT", bound=type[Any])
|
||||
@@ -83,8 +84,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: Any) -> Any: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
@@ -418,8 +419,8 @@ class MagicProxy:
|
||||
def __get__(self, obj, _type: Any | None = ...): ...
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class NamedNodeMap:
|
||||
def values(self): ...
|
||||
def get(self, name, value: Any | None = ...): ...
|
||||
def __len__(self) -> int: ...
|
||||
def __eq__(self, other: Any) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ge__(self, other: Any) -> bool: ...
|
||||
def __gt__(self, other: Any) -> bool: ...
|
||||
def __le__(self, other: Any) -> bool: ...
|
||||
|
||||
Reference in New Issue
Block a user