MCPcopy Index your code
hub / github.com/python/mypy / format_string_list

Function format_string_list

mypy/messages.py:3299–3310  ·  view source on GitHub ↗
(lst: list[str])

Source from the content-addressed store, hash-verified

3297
3298
3299def format_string_list(lst: list[str]) -> str:
3300 assert lst
3301 if len(lst) == 1:
3302 return lst[0]
3303 elif len(lst) <= 5:
3304 return f"{', '.join(lst[:-1])} and {lst[-1]}"
3305 else:
3306 return "%s, ... and %s (%i methods suppressed)" % (
3307 ", ".join(lst[:2]),
3308 lst[-1],
3309 len(lst) - 3,
3310 )
3311
3312
3313def format_item_name_list(s: Iterable[str]) -> str:

Callers 1

Calls 2

lenFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…