From 8f8bd981641e0988b9ed3276c8f2435645269b3f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Fri, 10 Mar 2023 06:28:44 +0100 Subject: [PATCH] all: Fix strings with backslash by using raw string literals. --- docs/conf.py | 2 +- ports/cc3200/tools/uniflash.py | 2 +- tools/insert-usb-ids.py | 2 +- tools/uf2conv.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 933e7b34b2..a966b3a025 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -233,7 +233,7 @@ latex_elements = { # Additional stuff for the LaTeX preamble. #'preamble': '', # Include 3 levels of headers in PDF ToC -'preamble': '\setcounter{tocdepth}{2}', +'preamble': r'\setcounter{tocdepth}{2}', } # Grouping the document tree into LaTeX files. List of tuples diff --git a/ports/cc3200/tools/uniflash.py b/ports/cc3200/tools/uniflash.py index 0ce9d0703a..83445a12d3 100644 --- a/ports/cc3200/tools/uniflash.py +++ b/ports/cc3200/tools/uniflash.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -""" +r""" Flash the WiPy (format, update service pack and program). Example: diff --git a/tools/insert-usb-ids.py b/tools/insert-usb-ids.py index 9b53f3f68a..177a68c4a4 100644 --- a/tools/insert-usb-ids.py +++ b/tools/insert-usb-ids.py @@ -16,7 +16,7 @@ def parse_usb_ids(filename): rv = dict() for line in open(filename).readlines(): line = line.rstrip("\r\n") - match = re.match("^#define\s+(\w+)\s+\(0x([0-9A-Fa-f]+)\)$", line) + match = re.match(r"^#define\s+(\w+)\s+\(0x([0-9A-Fa-f]+)\)$", line) if match and match.group(1).startswith(config_prefix): key = match.group(1).replace(config_prefix, "USB_") val = match.group(2) diff --git a/tools/uf2conv.py b/tools/uf2conv.py index ef3e481449..b66e52876b 100644 --- a/tools/uf2conv.py +++ b/tools/uf2conv.py @@ -271,7 +271,7 @@ def get_drives(): ] ) 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: