From cf8355ccb3531e1353669e9f322bba4e436b653f Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Mon, 4 Nov 2024 19:22:33 +0000 Subject: [PATCH] BIM,CAM: Resolve Python invalid escape sequence warnings --- src/Mod/BIM/importers/importIFClegacy.py | 4 ++-- src/Mod/CAM/CAMTests/TestPathPost.py | 2 +- src/Mod/CAM/Path/Post/scripts/gcode_pre.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Mod/BIM/importers/importIFClegacy.py b/src/Mod/BIM/importers/importIFClegacy.py index 5c04548c4c..fbbf9a8f07 100644 --- a/src/Mod/BIM/importers/importIFClegacy.py +++ b/src/Mod/BIM/importers/importIFClegacy.py @@ -1433,9 +1433,9 @@ class IfcSchema: entity = {} raw_entity_str = m.groups()[0] - entity["name"] = re.search("(.*?)[;|\s]", raw_entity_str).groups()[0].upper() + entity["name"] = re.search(r"(.*?)[;|\s]", raw_entity_str).groups()[0].upper() - subtypeofmatch = re.search(".*SUBTYPE OF \((.*?)\);", raw_entity_str) + subtypeofmatch = re.search(r".*SUBTYPE OF \((.*?)\);", raw_entity_str) entity["supertype"] = subtypeofmatch.groups()[0].upper() if subtypeofmatch else None # find the shortest string matched from the end of the entity type header to the diff --git a/src/Mod/CAM/CAMTests/TestPathPost.py b/src/Mod/CAM/CAMTests/TestPathPost.py index b4b7dc563a..eece893d6c 100644 --- a/src/Mod/CAM/CAMTests/TestPathPost.py +++ b/src/Mod/CAM/CAMTests/TestPathPost.py @@ -40,7 +40,7 @@ Path.Log.setLevel(Path.Log.Level.INFO, PathCommand.LOG_MODULE) class TestFileNameGenerator(unittest.TestCase): - """ + r""" String substitution allows the following: %D ... directory of the active document %d ... name of the active document (with extension) diff --git a/src/Mod/CAM/Path/Post/scripts/gcode_pre.py b/src/Mod/CAM/Path/Post/scripts/gcode_pre.py index 36341d7176..fd798516ad 100644 --- a/src/Mod/CAM/Path/Post/scripts/gcode_pre.py +++ b/src/Mod/CAM/Path/Post/scripts/gcode_pre.py @@ -191,7 +191,7 @@ def _identifygcodeByToolNumberList(filename): 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) + paths = re.split(r"([mM]+?\s?0?6\s?T\d*\s)", gcode) # iterate the gcode sections and add customs for each toolnumber = 0