Replace deprecated escapes with valid ones

This commit is contained in:
Kevin Martin
2024-02-01 10:50:52 -05:00
parent 02ebb17558
commit 39bee92bea
3 changed files with 12 additions and 12 deletions

View File

@@ -445,7 +445,7 @@ class bsplineTracker(Tracker):
except Exception:
# workaround for pivy SoInput.setBuffer() bug
buf = buf.replace("\n", "")
pts = re.findall("point \[(.*?)\]", buf)[0]
pts = re.findall("point \\[(.*?)\\]", buf)[0]
pts = pts.split(",")
pc = []
for p in pts:
@@ -523,7 +523,7 @@ class bezcurveTracker(Tracker):
except Exception:
# workaround for pivy SoInput.setBuffer() bug
buf = buf.replace("\n","")
pts = re.findall("point \[(.*?)\]", buf)[0]
pts = re.findall("point \\[(.*?)\\]", buf)[0]
pts = pts.split(",")
pc = []
for p in pts:
@@ -652,7 +652,7 @@ class arcTracker(Tracker):
except Exception:
# workaround for pivy SoInput.setBuffer() bug
buf = buf.replace("\n", "")
pts = re.findall("point \[(.*?)\]", buf)[0]
pts = re.findall("point \\[(.*?)\\]", buf)[0]
pts = pts.split(",")
pc = []
for p in pts:

View File

@@ -223,9 +223,9 @@ def deformat(text):
# t = re.sub('{([^!}]([^}]|\n)*)}', '', text)
# print("input text: ",text)
t = text.strip("{}")
t = re.sub("\\\.*?;", "", t)
t = re.sub("\\\\.*?;", "", t)
# replace UTF codes by utf chars
sts = re.split("\\\\(U\+....)", t)
sts = re.split("\\\\(U\\+....)", t)
t = u"".join(sts)
# replace degrees, diameters chars
t = re.sub('%%d', u'°', t)
@@ -3925,7 +3925,7 @@ def exportPage(page, filename):
blocks = ""
entities = ""
r12 = False
ver = re.findall("\$ACADVER\n.*?\n(.*?)\n", template)
ver = re.findall("\\$ACADVER\n.*?\n(.*?)\n", template)
if ver:
# at the moment this is not used.
# TODO: if r12, do not print ellipses or splines

View File

@@ -415,7 +415,7 @@ def getsize(length, mode='discard', base=1):
}
# Extract a number from a string like '+56215.14565E+6mm'
_num = '([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)'
_num = '([-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?)'
_unit = '(px|pt|pc|mm|cm|in|em|ex|%)?'
_full_num = _num + _unit
number, exponent, unit = re.findall(_full_num, length)[0]
@@ -725,7 +725,7 @@ class svgHandler(xml.sax.ContentHandler):
if 'inkscape:version' in data:
inks_doc_name = attrs.getValue('sodipodi:docname')
inks_full_ver = attrs.getValue('inkscape:version')
inks_ver_pars = re.search("\d+\.\d+", inks_full_ver)
inks_ver_pars = re.search("\\d+\\.\\d+", inks_full_ver)
if inks_ver_pars is not None:
inks_ver_f = float(inks_ver_pars.group(0))
else:
@@ -928,10 +928,10 @@ class svgHandler(xml.sax.ContentHandler):
_op = '([mMlLhHvVaAcCqQsStTzZ])'
_op2 = '([^mMlLhHvVaAcCqQsStTzZ]*)'
_command = '\s*?' + _op + '\s*?' + _op2 + '\s*?'
_command = '\\s*?' + _op + '\\s*?' + _op2 + '\\s*?'
pathcommandsre = re.compile(_command, re.DOTALL)
_num = '[-+]?[0-9]*\.?[0-9]+'
_num = '[-+]?[0-9]*\\.?[0-9]+'
_exp = '([eE][-+]?[0-9]+)?'
_point = '(' + _num + _exp + ')'
pointsre = re.compile(_point, re.DOTALL)
@@ -1613,8 +1613,8 @@ class svgHandler(xml.sax.ContentHandler):
The translated matrix.
"""
_op = '(matrix|translate|scale|rotate|skewX|skewY)'
_val = '\((.*?)\)'
_transf = _op + '\s*?' + _val
_val = '\\((.*?)\\)'
_transf = _op + '\\s*?' + _val
transformre = re.compile(_transf, re.DOTALL)
m = FreeCAD.Matrix()
for transformation, arguments in transformre.findall(tr):