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

Function is_string_literal

mypy/checker.py:9623–9625  ·  view source on GitHub ↗
(typ: Type)

Source from the content-addressed store, hash-verified

9621
9622
9623def is_string_literal(typ: Type) -> bool:
9624 strs = try_getting_str_literals_from_type(typ)
9625 return strs is not None and len(strs) == 1
9626
9627
9628def has_bool_item(typ: ProperType) -> bool:

Callers 2

check_match_argsMethod · 0.85
compare_stringsMethod · 0.85

Calls 2

lenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…