MCPcopy Create free account
hub / github.com/python/mypy / trivial_meet

Function trivial_meet

mypy/meet.py:61–71  ·  view source on GitHub ↗

Return one of types (expanded) if it is a subtype of other, otherwise bottom type.

(s: Type, t: Type)

Source from the content-addressed store, hash-verified

59
60
61def trivial_meet(s: Type, t: Type) -> ProperType:
62 """Return one of types (expanded) if it is a subtype of other, otherwise bottom type."""
63 if is_subtype(s, t):
64 return get_proper_type(s)
65 elif is_subtype(t, s):
66 return get_proper_type(t)
67 else:
68 if state.strict_optional:
69 return UninhabitedType()
70 else:
71 return NoneType()
72
73
74def meet_types(s: Type, t: Type) -> ProperType:

Callers 1

meet_typesFunction · 0.85

Calls 4

is_subtypeFunction · 0.90
get_proper_typeFunction · 0.90
UninhabitedTypeClass · 0.90
NoneTypeClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…