Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Python syntax #1149

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/modm-devices
4 changes: 2 additions & 2 deletions src/modm/platform/dma/stm32/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -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<instance>\d)_(Ch|Channel|Stream)(?P<channels>(\d(_\d)*))")
instance_pattern = re.compile(r"(DMA\d_(Ch|Channel|Stream)\d(_\d)*)")
channel_pattern = re.compile(r"DMA(?P<instance>\d)_(Ch|Channel|Stream)(?P<channels>(\d(_\d)*))")
irq_list = []
for irq in irqs:
instances = []
Expand Down
2 changes: 1 addition & 1 deletion src/modm/platform/i2c/stm32-extended/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
2 changes: 1 addition & 1 deletion tools/bitmap/pbm2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!")

Expand Down
6 changes: 3 additions & 3 deletions tools/font_creator/font_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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))
Expand Down