From 4cd3c1cff1d32079a28149a1789f8b3a4b231cf2 Mon Sep 17 00:00:00 2001 From: Thorsten Vitt Date: Tue, 4 Sep 2018 10:24:36 +0200 Subject: [PATCH] highlight-errors compatibility with older python versions --- src/main/tools/highlight-errors.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/tools/highlight-errors.py b/src/main/tools/highlight-errors.py index 832d3a7..237a847 100755 --- a/src/main/tools/highlight-errors.py +++ b/src/main/tools/highlight-errors.py @@ -56,7 +56,7 @@ def marker_string(columns): last_column = 0 for column in columns: c = str(column) - result += ' ' * (column - len(c) - last_column) + f'{c}' + result += ' ' * (column - len(c) - last_column) + '' + c + '' last_column = column return result @@ -76,11 +76,11 @@ def annotate_file(invalid_file, errors, out_path=None, strip_components=0): out.write(PREFIX) for lineno, raw_line in enumerate(xml, start=1): line = escape(raw_line[:-1]) - out.write(f'{lineno}{line}\n') + out.write('{0}{1}\n'.format(lineno, line)) if lineno in errors: current_errors = errors[lineno] markers = marker_string(error['column'] for error in current_errors) - out.write(f' {markers}\n
') + out.write(' {}\n
'.format(markers)) for error in current_errors: out.write(('

{line}:{column} {message}

\n' + '

{resolution}

\n').format_map(error)) @@ -122,5 +122,5 @@ def _main(): if __name__ == '__main__': - logging.basicConfig(level=logging.INFO,filename='target/highlight-errors.log') + logging.basicConfig(level=logging.INFO) _main()