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

Function load_coverage

devtools/bolt-coverage.py:107–128  ·  view source on GitHub ↗

Return {bolt: [CovRecord, ...]} from the coverage file.

(coverage_file: str)

Source from the content-addressed store, hash-verified

105
106
107def load_coverage(coverage_file: str) -> Dict[int, List[CovRecord]]:
108 """Return {bolt: [CovRecord, ...]} from the coverage file."""
109 coverage: Dict[int, List[CovRecord]] = defaultdict(list)
110 try:
111 with open(coverage_file) as f:
112 for lineno, line in enumerate(f, 1):
113 line = line.strip()
114 if not line:
115 continue
116 parts = line.split()
117 if len(parts) != 6:
118 print("{}:{}: bad coverage record (expected 6 fields): {!r}".format(
119 coverage_file, lineno, line), file=sys.stderr)
120 continue
121 bolt = int(parts[0])
122 si, start, end, src_line = int(parts[1]), int(parts[2]), int(parts[3]), int(parts[5])
123 src_file = parts[4]
124 coverage[bolt].append((si, start, end, src_file, src_line))
125 except FileNotFoundError:
126 print("Coverage file not found: {}".format(coverage_file), file=sys.stderr)
127 sys.exit(1)
128 return coverage
129
130
131def merge_intervals(intervals: List[Tuple[int, int]]) -> List[Tuple[int, int]]:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected