Skip to content

Commit a8913d8

Browse files
hauntsaninjaJukkaL
authored andcommitted
Remove unused function custom_equality_method (#8223)
Superseded by custom_special_method
1 parent 89e259f commit a8913d8

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

mypy/checkexpr.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
YieldFromExpr, TypedDictExpr, PromoteExpr, NewTypeExpr, NamedTupleExpr, TypeVarExpr,
3333
TypeAliasExpr, BackquoteExpr, EnumCallExpr, TypeAlias, SymbolNode, PlaceholderNode,
3434
ARG_POS, ARG_OPT, ARG_NAMED, ARG_STAR, ARG_STAR2, LITERAL_TYPE, REVEAL_TYPE,
35-
SYMBOL_FUNCBASE_TYPES
3635
)
3736
from mypy.literals import literal
3837
from mypy import nodes
@@ -4305,29 +4304,6 @@ def is_expr_literal_type(node: Expression) -> bool:
43054304
return False
43064305

43074306

4308-
def custom_equality_method(typ: Type) -> bool:
4309-
"""Does this type have a custom __eq__() method?"""
4310-
typ = get_proper_type(typ)
4311-
if isinstance(typ, Instance):
4312-
method = typ.type.get('__eq__')
4313-
if method and isinstance(method.node, (SYMBOL_FUNCBASE_TYPES, Decorator, Var)):
4314-
if method.node.info:
4315-
return not method.node.info.fullname.startswith('builtins.')
4316-
return False
4317-
if isinstance(typ, UnionType):
4318-
return any(custom_equality_method(t) for t in typ.items)
4319-
if isinstance(typ, TupleType):
4320-
return custom_equality_method(tuple_fallback(typ))
4321-
if isinstance(typ, CallableType) and typ.is_type_obj():
4322-
# Look up __eq__ on the metaclass for class objects.
4323-
return custom_equality_method(typ.fallback)
4324-
if isinstance(typ, AnyType):
4325-
# Avoid false positives in uncertain cases.
4326-
return True
4327-
# TODO: support other types (see ExpressionChecker.has_member())?
4328-
return False
4329-
4330-
43314307
def has_bytes_component(typ: Type, py2: bool = False) -> bool:
43324308
"""Is this one of builtin byte types, or a union that contains it?"""
43334309
typ = get_proper_type(typ)

0 commit comments

Comments
 (0)