From 73698fa028be57ae710940f47f536f6d822a44bb Mon Sep 17 00:00:00 2001 From: xu0o0 Date: Mon, 26 Aug 2024 22:53:35 +0800 Subject: [PATCH] Fix invalid escape sequence in utils, minor cleanup in python script (#948) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit According to the Python document[1], any invalid escape sequences in string literals now generate a DeprecationWarning (SyntaxWarning as of 3.12) and in the future this will become a SyntaxError. This Change uses Python’s raw string notation for regular expression patterns to avoid it. [1]: https://docs.python.org/3.10/library/re.html Signed-off-by: haoqixu --- utils/generate-unit-test-header.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/generate-unit-test-header.py b/utils/generate-unit-test-header.py index 1b2619e40..b83e0797d 100755 --- a/utils/generate-unit-test-header.py +++ b/utils/generate-unit-test-header.py @@ -4,7 +4,7 @@ import re UNIT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + '/../src/unit') TEST_FILE = UNIT_DIR + '/test_files.h' -TEST_PROTOTYPE = '(int (test_[a-zA-Z0-9_]*)\(.*\)).*{' +TEST_PROTOTYPE = r'(int (test_[a-zA-Z0-9_]*)\(.*\)).*{' if __name__ == '__main__': with open(TEST_FILE, 'w') as output: