From a0669259a26dfd5dfb03b8500b965cb3733cf81f Mon Sep 17 00:00:00 2001 From: Raphael Lehmann Date: Thu, 14 Mar 2024 20:13:49 +0100 Subject: [PATCH 1/2] Fix Python syntax Since Python 3.6 backslash-character pairs that are not valid escape sequences are deprecated and generate a 'SyntaxWarning: invalid escape sequence' warning. This is fixed by using raw string. --- src/modm/platform/dma/stm32/module.lb | 4 ++-- src/modm/platform/i2c/stm32-extended/module.lb | 2 +- tools/bitmap/pbm2c.py | 2 +- tools/font_creator/font_export.py | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modm/platform/dma/stm32/module.lb b/src/modm/platform/dma/stm32/module.lb index 0c13840264..3f4cc4344b 100644 --- a/src/modm/platform/dma/stm32/module.lb +++ b/src/modm/platform/dma/stm32/module.lb @@ -43,8 +43,8 @@ def get_irq_list(device): irqs = {v["position"]: v["name"] for v in device.get_driver("core")["vector"]} irqs = [v for v in irqs.values() if v.startswith("DMA") and v[3].isdigit() and not "DMA2D" in v] - instance_pattern = re.compile("(DMA\d_(Ch|Channel|Stream)\d(_\d)*)") - channel_pattern = re.compile("DMA(?P\d)_(Ch|Channel|Stream)(?P(\d(_\d)*))") + instance_pattern = re.compile(r"(DMA\d_(Ch|Channel|Stream)\d(_\d)*)") + channel_pattern = re.compile(r"DMA(?P\d)_(Ch|Channel|Stream)(?P(\d(_\d)*))") irq_list = [] for irq in irqs: instances = [] diff --git a/src/modm/platform/i2c/stm32-extended/module.lb b/src/modm/platform/i2c/stm32-extended/module.lb index 970bc19be7..5c2a6124a8 100644 --- a/src/modm/platform/i2c/stm32-extended/module.lb +++ b/src/modm/platform/i2c/stm32-extended/module.lb @@ -17,7 +17,7 @@ import re global_properties = {} def get_shared_irqs(device): - irq_re = re.compile("I2C\d(_\d)+") + irq_re = re.compile(r"I2C\d(_\d)+") shared_irqs = [v["name"] for v in device.get_driver("core")["vector"]] shared_irqs = [v for v in shared_irqs if irq_re.fullmatch(v)] shared_irq_map = {} diff --git a/tools/bitmap/pbm2c.py b/tools/bitmap/pbm2c.py index 7c745c8d44..94e0477d6b 100644 --- a/tools/bitmap/pbm2c.py +++ b/tools/bitmap/pbm2c.py @@ -34,7 +34,7 @@ # switch to the next line input = input[input.find("\n") + 1:] - result = re.match("^(\d+) (\d+)\n", input) + result = re.match(r"^(\d+) (\d+)\n", input) if not result: print("bad format!") diff --git a/tools/font_creator/font_export.py b/tools/font_creator/font_export.py index abd6c558cb..8f6718f56c 100755 --- a/tools/font_creator/font_export.py +++ b/tools/font_creator/font_export.py @@ -135,7 +135,7 @@ def read_font_file(filename): lines = open(filename).readlines() for line_number, line in enumerate(lines): if char_mode: - result = re.match("^\[([ #]+)\]\n", line) + result = re.match(r"^\[([ #]+)\]\n", line) if not result: raise ParseException("Illegal Format in: %s" % line[:-1], line_number) @@ -165,7 +165,7 @@ def read_font_file(filename): if char_line_count == 0: char_mode = False elif line[0] == '#': - result = re.match("^#(\w+)[ \t]+:[ \t]+(.*)\n", line) + result = re.match(r"^#(\w+)[ \t]+:[ \t]+(.*)\n", line) if not result: print("Error in: ", line) exit(1) @@ -184,7 +184,7 @@ def read_font_file(filename): elif key == "vspace": font.vspace = int(value) elif key == "char": - charMatch = re.match("^(\d+)([ \t]*.*)", value) + charMatch = re.match(r"^(\d+)([ \t]*.*)", value) if not charMatch: raise ParseException("Illegal Format in: %s" % line[:-1], line_number) number = int(charMatch.group(1)) From c43be03e82b22f5980e50415a855bee10ee70c59 Mon Sep 17 00:00:00 2001 From: Raphael Lehmann Date: Thu, 14 Mar 2024 20:15:17 +0100 Subject: [PATCH 2/2] [ext] Update modm-devices submodule --- ext/modm-devices | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/modm-devices b/ext/modm-devices index 3c437bbfa7..cd25d12721 160000 --- a/ext/modm-devices +++ b/ext/modm-devices @@ -1 +1 @@ -Subproject commit 3c437bbfa740d61d99a66de8a36d64281806fd54 +Subproject commit cd25d127216a27390a86eaddbc002a454b3f6997