Fix python re warning in gen_objc

pull/26579/head
Letu Ren 3 months ago committed by FantasqueX
parent 646e87c728
commit ed9d64c9d3
  1. 8
      modules/objc/generator/gen_objc.py

@ -1120,7 +1120,7 @@ class ObjectiveCWrapperGenerator(object):
name = line[p0:p1] name = line[p0:p1]
for arg in args: for arg in args:
if arg.name == name: if arg.name == name:
toWrite.append(re.sub('\*\s*@param ', '* @param ', line)) toWrite.append(re.sub(r'\*\s*@param ', '* @param ', line))
break break
else: else:
s0 = line.find("@see") s0 = line.find("@see")
@ -1512,13 +1512,13 @@ def escape_underscore(str):
return str.replace('_', '\\_') return str.replace('_', '\\_')
def escape_texttt(str): def escape_texttt(str):
return re.sub(re.compile('texttt{(.*?)\}', re.DOTALL), lambda x: 'texttt{' + escape_underscore(x.group(1)) + '}', str) return re.sub(re.compile('texttt{(.*?)}', re.DOTALL), lambda x: 'texttt{' + escape_underscore(x.group(1)) + '}', str)
def get_macros(tex): def get_macros(tex):
out = "" out = ""
if re.search("\\\\fork\s*{", tex): if re.search(r"\\fork\s*{", tex):
out += "\\newcommand{\\fork}[4]{ \\left\\{ \\begin{array}{l l} #1 & \\text{#2}\\\\\\\\ #3 & \\text{#4}\\\\\\\\ \\end{array} \\right.} " out += "\\newcommand{\\fork}[4]{ \\left\\{ \\begin{array}{l l} #1 & \\text{#2}\\\\\\\\ #3 & \\text{#4}\\\\\\\\ \\end{array} \\right.} "
if re.search("\\\\vecthreethree\s*{", tex): if re.search(r"\\vecthreethree\s*{", tex):
out += "\\newcommand{\\vecthreethree}[9]{ \\begin{bmatrix} #1 & #2 & #3\\\\\\\\ #4 & #5 & #6\\\\\\\\ #7 & #8 & #9 \\end{bmatrix} } " out += "\\newcommand{\\vecthreethree}[9]{ \\begin{bmatrix} #1 & #2 & #3\\\\\\\\ #4 & #5 & #6\\\\\\\\ #7 & #8 & #9 \\end{bmatrix} } "
return out return out

Loading…
Cancel
Save