MCPcopy Create free account
hub / github.com/ElementsProject/lightning / snippet

Function snippet

devtools/bolt-coverage.py:166–171  ·  view source on GitHub ↗

Return a short excerpt of text[start:end], from the tail or head.

(text: str, start: int, end: int, tail: bool = False, maxlen: int = 60)

Source from the content-addressed store, hash-verified

164
165
166def snippet(text: str, start: int, end: int, tail: bool = False, maxlen: int = 60) -> str:
167 """Return a short excerpt of text[start:end], from the tail or head."""
168 s = text[start:end].strip()
169 if tail:
170 return ("..." + s[-maxlen:]) if len(s) > maxlen else ("..." + s)
171 return (s[:maxlen] + "...") if len(s) > maxlen else (s + "...")
172
173
174def show_gaps(boltpath: str, bolt_num: int, si: int,

Callers 1

show_gapsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected