|
32 | 32 | YieldFromExpr, TypedDictExpr, PromoteExpr, NewTypeExpr, NamedTupleExpr, TypeVarExpr,
|
33 | 33 | TypeAliasExpr, BackquoteExpr, EnumCallExpr, TypeAlias, SymbolNode, PlaceholderNode,
|
34 | 34 | ARG_POS, ARG_OPT, ARG_NAMED, ARG_STAR, ARG_STAR2, LITERAL_TYPE, REVEAL_TYPE,
|
35 |
| - SYMBOL_FUNCBASE_TYPES |
36 | 35 | )
|
37 | 36 | from mypy.literals import literal
|
38 | 37 | from mypy import nodes
|
@@ -4305,29 +4304,6 @@ def is_expr_literal_type(node: Expression) -> bool:
|
4305 | 4304 | return False
|
4306 | 4305 |
|
4307 | 4306 |
|
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 |
| - |
4331 | 4307 | def has_bytes_component(typ: Type, py2: bool = False) -> bool:
|
4332 | 4308 | """Is this one of builtin byte types, or a union that contains it?"""
|
4333 | 4309 | typ = get_proper_type(typ)
|
|
0 commit comments