From 34da686f6b0bb65a918bf587ef69039a593d966f Mon Sep 17 00:00:00 2001 From: Yen-Yu Chen Date: Thu, 10 Oct 2024 10:13:26 +0800 Subject: [PATCH] Fix "SyntaxWarning: invalid escape sequence" --- Tools/uf2conv/uf2conv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tools/uf2conv/uf2conv.py b/Tools/uf2conv/uf2conv.py index aed5bd6173..fddc9456fb 100644 --- a/Tools/uf2conv/uf2conv.py +++ b/Tools/uf2conv/uf2conv.py @@ -38,7 +38,7 @@ def is_hex(buf): w = buf[0:30].decode("utf-8") except UnicodeDecodeError: return False - if w[0] == ':' and re.match(b"^[:0-9a-fA-F\r\n]+$", buf): + if w[0] == ':' and re.match(rb"^[:0-9a-fA-F\r\n]+$", buf): return True return False @@ -179,7 +179,7 @@ def get_drives(): "get", "DeviceID,", "VolumeName,", "FileSystem,", "DriveType"]) for line in to_str(r).split('\n'): - words = re.split('\s+', line) + words = re.split(r'\s+', line) if len(words) >= 3 and words[1] == "2" and words[2] == "FAT": drives.append(words[0]) else: @@ -206,7 +206,7 @@ def has_info(d): def board_id(path): with open(path + INFO_FILE, mode='r') as file: file_content = file.read() - return re.search("Board-ID: ([^\r\n]*)", file_content).group(1) + return re.search(r"Board-ID: ([^\r\n]*)", file_content).group(1) def list_drives():