MCPcopy Index your code
hub / github.com/lincolnloop/python-qrcode / commas

Function commas

qrcode/console_scripts.py:171–177  ·  view source on GitHub ↗
(items: Iterable[str], joiner="or")

Source from the content-addressed store, hash-verified

169
170
171def commas(items: Iterable[str], joiner="or") -> str:
172 items = tuple(items)
173 if not items:
174 return ""
175 if len(items) == 1:
176 return items[0]
177 return f"{', '.join(items[:-1])} {joiner} {items[-1]}"
178
179
180if __name__ == "__main__": # pragma: no cover

Callers 3

test_commasFunction · 0.90
mainFunction · 0.85
get_drawer_helpFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_commasFunction · 0.72