Make python Regex Strings raw to avoid py3.12 SyntaxError

This commit is contained in:
bgbsww
2024-09-26 18:12:20 -04:00
committed by Yorik van Havre
parent e41def8c74
commit 64ecfe7a0e
26 changed files with 75 additions and 75 deletions

View File

@@ -97,7 +97,7 @@ class FilenameGenerator:
ext = ".nc"
# Check for invalid matches
for match in re.findall("%(.)", outputpath):
for match in re.findall(r"%(.)", outputpath):
Path.Log.debug(f"match: {match}")
if match not in validPathSubstitutions:
outputpath = outputpath.replace(f"%{match}", "")
@@ -105,7 +105,7 @@ class FilenameGenerator:
"Invalid substitution strings will be ignored in output path: %s\n" % match
)
for match in re.findall("%(.)", filename):
for match in re.findall(r"%(.)", filename):
Path.Log.debug(f"match: {match}")
if match not in validFilenameSubstitutions:
filename = filename.replace(f"%{match}", "")
@@ -156,10 +156,10 @@ class FilenameGenerator:
temp_filename = self.qualified_filename
Path.Log.debug(f"temp_filename: {temp_filename}")
explicit_sequence = False
matches = re.findall("%S", temp_filename)
matches = re.findall(r"%S", temp_filename)
if matches:
Path.Log.debug(f"matches: {matches}")
temp_filename = re.sub("%S", str(self.sequencenumber), temp_filename)
temp_filename = re.sub(r"%S", str(self.sequencenumber), temp_filename)
explicit_sequence = True
subpart = f"-{self.subpartname}" if self.subpartname else ""

View File

@@ -188,7 +188,7 @@ def _identifygcodeByToolNumberList(filename):
gfile.close()
# Regular expression to match tool changes in the format 'M6 Tn'
p = re.compile("[mM]+?\s?0?6\s?T\d*\s")
p = re.compile(r"[mM]+?\s?0?6\s?T\d*\s")
# split the gcode on tool changes
paths = re.split("([mM]+?\s?0?6\s?T\d*\s)", gcode)

View File

@@ -108,7 +108,7 @@ class ToolBitEditor(object):
# which aren't being needed anymore.
def labelText(name):
return re.sub("([A-Z][a-z]+)", r" \1", re.sub("([A-Z]+)", r" \1", name))
return re.sub(r"([A-Z][a-z]+)", r" \1", re.sub(r"([A-Z]+)", r" \1", name))
layout = self.form.bitParams.layout()
ui = FreeCADGui.UiLoader()