diff options
author | Gunes Bayir <gunes.bayir@arm.com> | 2024-02-13 16:28:19 +0000 |
---|---|---|
committer | Gunes Bayir <gunes.bayir@arm.com> | 2024-02-14 17:50:25 +0000 |
commit | e37a863d7000ac2cbfe5c574ef3f2e6b233a129c (patch) | |
tree | 9ae20dfc6d15e0b51f4dd482d4db32b04afbca83 /scripts | |
parent | 7976f082599cfadeb93b00d6f99f6b6e0ab570d7 (diff) | |
download | ComputeLibrary-e37a863d7000ac2cbfe5c574ef3f2e6b233a129c.tar.gz |
Fix escape character issues in format_code script
In recent versions of python, the escape characters cause issues if the string is not interpreted as a raw string, or the escape characters are not escaped themselves.
Signed-off-by: Gunes Bayir <gunes.bayir@arm.com>
Change-Id: Ia36ffc91008da31b8289b499594cfee6bb0da284
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/11138
Reviewed-by: Jakub Sujak <jakub.sujak@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/format_code.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/format_code.py b/scripts/format_code.py index b456bd4359..8bfb3f5601 100755 --- a/scripts/format_code.py +++ b/scripts/format_code.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright (c) 2023 Arm Limited. +# Copyright (c) 2023-2024 Arm Limited. # # SPDX-License-Identifier: MIT # @@ -79,7 +79,7 @@ def check_copyright( filename ): start = 2 if("SConscript" in filename): start = 3 - m = re.match("(# Copyright \(c\) )(.*\d{4})( [Arm|ARM].*)", content[start]) + m = re.match(r"(# Copyright \(c\) )(.*\d{4})( [Arm|ARM].*)", content[start]) line = m.group(1) if m.group(2): # Is there a year already? @@ -101,7 +101,7 @@ def check_copyright( filename ): return # This only works until year 9999 - m = re.match("(.*Copyright \(c\) )(.*\d{4})( [Arm|ARM].*)", content[1]) + m = re.match(r"(.*Copyright \(c\) )(.*\d{4})( [Arm|ARM].*)", content[1]) start =len(ref)+2 if content[0] != "/*\n" or not m: start = 0 @@ -146,7 +146,7 @@ def check_license(filename): year = datetime.datetime.now().year # This only works until year 9999 - m = re.match("(.*Copyright \(c\) )(.*\d{4})( [Arm|ARM].*)", content[2]) + m = re.match(r"(.*Copyright \(c\) )(.*\d{4})( [Arm|ARM].*)", content[2]) if not m: f.write("Copyright (c) {} Arm Limited\n".format(year)) |