Skip to content

Commit a066925

Browse files
committed
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.
1 parent e1d8a17 commit a066925

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/modm/platform/dma/stm32/module.lb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def get_irq_list(device):
4343
irqs = {v["position"]: v["name"] for v in device.get_driver("core")["vector"]}
4444
irqs = [v for v in irqs.values() if v.startswith("DMA") and v[3].isdigit() and not "DMA2D" in v]
4545

46-
instance_pattern = re.compile("(DMA\d_(Ch|Channel|Stream)\d(_\d)*)")
47-
channel_pattern = re.compile("DMA(?P<instance>\d)_(Ch|Channel|Stream)(?P<channels>(\d(_\d)*))")
46+
instance_pattern = re.compile(r"(DMA\d_(Ch|Channel|Stream)\d(_\d)*)")
47+
channel_pattern = re.compile(r"DMA(?P<instance>\d)_(Ch|Channel|Stream)(?P<channels>(\d(_\d)*))")
4848
irq_list = []
4949
for irq in irqs:
5050
instances = []

src/modm/platform/i2c/stm32-extended/module.lb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import re
1717
global_properties = {}
1818

1919
def get_shared_irqs(device):
20-
irq_re = re.compile("I2C\d(_\d)+")
20+
irq_re = re.compile(r"I2C\d(_\d)+")
2121
shared_irqs = [v["name"] for v in device.get_driver("core")["vector"]]
2222
shared_irqs = [v for v in shared_irqs if irq_re.fullmatch(v)]
2323
shared_irq_map = {}

tools/bitmap/pbm2c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# switch to the next line
3535
input = input[input.find("\n") + 1:]
3636

37-
result = re.match("^(\d+) (\d+)\n", input)
37+
result = re.match(r"^(\d+) (\d+)\n", input)
3838
if not result:
3939
print("bad format!")
4040

tools/font_creator/font_export.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def read_font_file(filename):
135135
lines = open(filename).readlines()
136136
for line_number, line in enumerate(lines):
137137
if char_mode:
138-
result = re.match("^\[([ #]+)\]\n", line)
138+
result = re.match(r"^\[([ #]+)\]\n", line)
139139
if not result:
140140
raise ParseException("Illegal Format in: %s" % line[:-1], line_number)
141141

@@ -165,7 +165,7 @@ def read_font_file(filename):
165165
if char_line_count == 0:
166166
char_mode = False
167167
elif line[0] == '#':
168-
result = re.match("^#(\w+)[ \t]+:[ \t]+(.*)\n", line)
168+
result = re.match(r"^#(\w+)[ \t]+:[ \t]+(.*)\n", line)
169169
if not result:
170170
print("Error in: ", line)
171171
exit(1)
@@ -184,7 +184,7 @@ def read_font_file(filename):
184184
elif key == "vspace":
185185
font.vspace = int(value)
186186
elif key == "char":
187-
charMatch = re.match("^(\d+)([ \t]*.*)", value)
187+
charMatch = re.match(r"^(\d+)([ \t]*.*)", value)
188188
if not charMatch:
189189
raise ParseException("Illegal Format in: %s" % line[:-1], line_number)
190190
number = int(charMatch.group(1))

0 commit comments

Comments
 (0)