INNER CODE UNIT · Python
write
hacan359/tonkatsu_box · tool/merge_lcov.py:39
def write(path, hits):
with open(path, 'w', encoding='utf-8', newline='\n') as handle:
for source in sorted(hits):
counts = hits[source]
handle.write(f'SF:{source}\n')
for number in sorted(counts):
handle.write(f'DA:{number},{counts[number]}\n')
handle.write(f'LF:{len(counts)}\n')
handle.write(f'LH:{sum(1 for c in counts.values() if c > 0)}\n')
handle.write('end_of_record\n')
def main(argv):
if len(argv) < 3:
print(__doc__, file=sys.stderr)
return 2
hits = {}
for path in argv[2:]: