Clean up and document project files (#4560)

This commit is contained in:
Niels Lohmann
2025-01-17 06:53:35 +01:00
committed by GitHub
parent ad2ee18539
commit 26cfec34be
519 changed files with 3301 additions and 1332 deletions

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
# 2017, Georg Sauthoff <mail@gms.tf>, GPLv3
# 2022, Alexander Stohr, ZF Friedrichshafen AG: benign handling of UTF-8 violations
import sys
@@ -49,7 +50,7 @@ def cond_lines(lines):
p = n
continue
if (p == 0 or not line[p-1].isalpha()) \
and (p+2 == len(line) or not line[p+2].isalpha()):
and (p+2 == len(line) or not line[p+2].isalpha()):
do_yield = True
state = 1
p += 2
@@ -93,7 +94,9 @@ def filter_lcov_trace(lines):
yield line
def filter_lcov_trace_file(s_filename, d_file):
with open(s_filename) as f:
# encoding is anyways the python default: utf-8
# standard error is "strict"; python style escaping is "backslashreplace"; alternate benign handler is "surrogateescape"
with open(s_filename, encoding="utf-8", errors="backslashreplace") as f:
for l in filter_lcov_trace(f):
print(l, end='', file=d_file)
@@ -106,4 +109,3 @@ if __name__ == '__main__':
#with open(sys.argv[1]) as f:
# for l in skip_comments(f):
# print(l)