MCPcopy Create free account
hub / github.com/anomalyco/opencode-sdk-python / human_join

Function human_join

src/opencode_ai/_utils/_utils.py:196–207  ·  view source on GitHub ↗
(seq: Sequence[str], *, delim: str = ", ", final: str = "or")

Source from the content-addressed store, hash-verified

194
195# copied from https://github.com/Rapptz/RoboDanny
196def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str:
197 size = len(seq)
198 if size == 0:
199 return ""
200
201 if size == 1:
202 return seq[0]
203
204 if size == 2:
205 return f"{seq[0]} {final} {seq[1]}"
206
207 return delim.join(seq[:-1]) + f" {final} {seq[-1]}"
208
209
210def quote(string: str) -> str:

Callers 1

wrapperFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected