From e37a863d7000ac2cbfe5c574ef3f2e6b233a129c Mon Sep 17 00:00:00 2001 From: Gunes Bayir Date: Tue, 13 Feb 2024 16:28:19 +0000 Subject: 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 Change-Id: Ia36ffc91008da31b8289b499594cfee6bb0da284 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/11138 Reviewed-by: Jakub Sujak Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Benchmark: Arm Jenkins --- scripts/format_code.py | 8 ++++---- 1 file 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)) -- cgit v1.2.1