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

Function format_literal_value

mypy/messages.py:2685–2690  ·  view source on GitHub ↗
(typ: LiteralType)

Source from the content-addressed store, hash-verified

2683 return " | ".join(format_union_items(types))
2684
2685 def format_literal_value(typ: LiteralType) -> str:
2686 if typ.is_enum_literal():
2687 underlying_type = format(typ.fallback)
2688 return f"{underlying_type}.{typ.value}"
2689 else:
2690 return typ.value_repr()
2691
2692 if isinstance(typ, TypeAliasType) and typ.is_recursive:
2693 if typ.alias is None:

Callers 1

format_type_innerFunction · 0.85

Calls 3

formatFunction · 0.85
is_enum_literalMethod · 0.80
value_reprMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…