(t: Type, s: Type)
| 688 | |
| 689 | |
| 690 | def is_better(t: Type, s: Type) -> bool: |
| 691 | # Given two possible results from join_instances_via_supertype(), |
| 692 | # indicate whether t is the better one. |
| 693 | t = get_proper_type(t) |
| 694 | s = get_proper_type(s) |
| 695 | |
| 696 | if isinstance(t, Instance): |
| 697 | if not isinstance(s, Instance): |
| 698 | return True |
| 699 | if t.type.is_protocol != s.type.is_protocol: |
| 700 | if t.type.fullname != "builtins.object" and s.type.fullname != "builtins.object": |
| 701 | # mro of protocol is not really relevant |
| 702 | return not t.type.is_protocol |
| 703 | # Use len(mro) as a proxy for the better choice. |
| 704 | if len(t.type.mro) > len(s.type.mro): |
| 705 | return True |
| 706 | return False |
| 707 | |
| 708 | |
| 709 | def normalize_callables(s: ProperType, t: ProperType) -> tuple[ProperType, ProperType]: |
no test coverage detected
searching dependent graphs…