McCode
McCode copied to clipboard
Python 3.12 / regex related patches needed for mccodelib/utils.py
mcgui ESS_BEER_MCPL.instr
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/mcgui.py:191: SyntaxWarning: invalid escape sequence '\s'
raise Exception("checkInstrFileCandidate: \s in instr")
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/mcgui.py:631: SyntaxWarning: invalid escape sequence '\w'
pat = 'COMPONENT[ ]+([\w0-9]+)[ ]*='
loading system configuration
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:73: SyntaxWarning: invalid escape sequence '\s'
pat = 'MCDISPLAY\s*\%\{([-+.\w\s=<>,/*{}\"\'()\.&$=?;:*|]*)\%\}'
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:107: SyntaxWarning: invalid escape sequence '\s'
re_out = re.search('DEFINE\s+COMPONENT\s+(\w*)', text)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:256: SyntaxWarning: invalid escape sequence '\s'
re_out = re.search('DEFINE\s+INSTRUMENT\s+([a-zA-Z0-9_]*)\s*\(([-+.a-zA-Z0-9_ \t\n\r=,/*{}\"]*)\)', text)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:282: SyntaxWarning: invalid escape sequence '\*'
if not re.match('[ ]*\*', l):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:283: SyntaxWarning: invalid escape sequence '\/'
if not re.match('[ ]*\/\*', l):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:285: SyntaxWarning: invalid escape sequence '\*'
elif re.search('[ ]*\*\*\*\*', l):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:411: SyntaxWarning: invalid escape sequence '\%'
m5 = re.search('\%INSTRUMENT_SITE:[^\n]*\n(.*)', bites[tag_I], flags=re.DOTALL)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:426: SyntaxWarning: invalid escape sequence '\%'
if re.match('\%Description', descr):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:428: SyntaxWarning: invalid escape sequence '\%'
elif re.match('\%D', descr):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:439: SyntaxWarning: invalid escape sequence '\w'
m = re.match('(\w+):[ \t]*\[([ \w\/\(\)\\\~\-.,\":\%\^\|\{\};\*]*)\][ \t]*(.*)', l)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:445: SyntaxWarning: invalid escape sequence '\w'
m = re.match('(\w+):[ \t]*(.*)', l)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:452: SyntaxWarning: invalid escape sequence '\s'
if re.match('\s*%', l) or l.strip() == '' or re.match('\/', l):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:452: SyntaxWarning: invalid escape sequence '\/'
if re.match('\s*%', l) or l.strip() == '' or re.match('\/', l):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:459: SyntaxWarning: invalid escape sequence '\)'
'''
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:471: SyntaxWarning: invalid escape sequence '\)'
if len(lines) > 0 and not re.search('\)', lines[-1]):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:474: SyntaxWarning: invalid escape sequence '\)'
if re.search('\)', l):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:494: SyntaxWarning: invalid escape sequence '\w'
m = re.match('[ ]*(\w+)', l)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:500: SyntaxWarning: invalid escape sequence '\)'
if not re.search('\)', lines[-1]):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:503: SyntaxWarning: invalid escape sequence '\)'
if re.search('\)', l):
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:525: SyntaxWarning: invalid escape sequence '\w'
name = re.search('DEFINE[ \t]+COMPONENT[ \t]+(\w+)', text).group(1)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:526: SyntaxWarning: invalid escape sequence '\('
m = re.search('DEFINITION[ \t]+PARAMETERS[ \t]*\(([\w\,\"\s\n\t\r\.\+\-=\{\}]*)\)', text)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:530: SyntaxWarning: invalid escape sequence '\('
m = re.search('SETTING[ \t]+PARAMETERS[ \t]*\(([\w\,\"\s\n\t\r\.\+\-=\{\}]*)\)', text)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:534: SyntaxWarning: invalid escape sequence '\('
m = re.search('OUTPUT[ \t]+PARAMETERS[ \t]*\(([\w\,\"\s\n\t\r\.\+\-=]*)\)', text)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:543: SyntaxWarning: invalid escape sequence '\('
m = re.search('\(([^(^)]*)\)', defline)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:557: SyntaxWarning: invalid escape sequence '\{'
m2 = re.match('([^,{]+\{[^}]*\}\s*),(.*)', substr) # not comma or curl, then not a right curl, then a right curlt, then a comma
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:603: SyntaxWarning: invalid escape sequence '\s'
m=re.match('(.*)\s*=\s*"(.*)"', part)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:622: SyntaxWarning: invalid escape sequence '\w'
m = re.match('DEFINE[ \t]+INSTRUMENT[ \t]+(\w+)\s*\(([\w\,\"\s\n\t\r\.\+:;\-=]*)\)', text)
/Users/peterwillendrup/mambaforge/envs/tester/share/mcstas/tools/Python/mcgui/../mccodelib/utils.py:642: SyntaxWarning: invalid escape sequence '\%'
m = re.search('\%INSTRUMENT_SITE:[ \t]*(\w+)[ \t]*\n?', text)
Transitioning to r'rawstring
' or double-escaping \\
should likely do the trick
A quick search indicates that we need to at least have a look at these
./mccodelib/fcparticleparser.py
./mccodelib/mcplotloader.py
./mccodelib/pipetools.py
./mcgui/viewclasses.py
./mctest/mctest.py
./mcdisplay/mantid_xml/mcdisplay.py
./mcdoc/mcdoc.py
./mcrun/mccode.py
./mcrun/mcsplit.py