Skip to content

Commit ed2b703

Browse files
authored
Merge pull request #23 from Iximiel/warning/invalid-escape-sequence
Removing the '\s' warnings from regexps
2 parents 64362a0 + 2a2d56c commit ed2b703

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/PlumedToHTML/PlumedFormatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def format(self, tokensource, outfile):
6767
outfile.write( value )
6868
elif ttype==Literal :
6969
# mpirun -np for command line tools
70-
if re.search("mpirun\s+-np", value ) :
70+
if re.search(r"mpirun\s+-np", value ) :
7171
outfile.write('<span class="plumedtooltip">' + value + '<span class="right">Run instances of PLUMED on this number of MPI processes<i></i></span></span>')
7272
# --no-mpmi for command such as plumed --no-mpi tool ...
7373
elif value=="--no-mpi" :

src/PlumedToHTML/PlumedToHTML.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ def get_cltoolarg_html( inpt, name, plumedexe ) :
231231
"""
232232
# Get the cltool that we are using
233233
pl, tool = inpt.split()[0], inpt.split()[1]
234-
if re.search("^mpirun\s+-np\s+[0-9]+\s+plumed",inpt) :
234+
if re.search(r"^mpirun\s+-np\s+[0-9]+\s+plumed",inpt) :
235235
tool = inpt.split()[4]
236236
pl = inpt.split()[3]
237-
if re.search("^plumed\s+\--no-mpi\s+", inpt) :
237+
if re.search(r"^plumed\s+\--no-mpi\s+", inpt) :
238238
tool = inpt.split()[2]
239239
if pl!="plumed" and pl!="plumed-runtime" :
240240
raise Exception("first word in the command should be plumed or plumed-runtime")
@@ -712,13 +712,14 @@ def processMarkdownString( inp, filename, plumedexe, plumed_names, actions, ofil
712712
usemermaid = ""
713713
# Create a collection of cltools to regexp for
714714
plumed_syntax = getPlumedSyntax( plumedexe )
715-
cltoolregexps, clfileregexps = [], []
715+
cltoolregexps = []
716+
clfileregexps = []
716717
for key, data in plumed_syntax["cltools"].items() :
717-
cltoolregexps.append("plumed\s+" + key )
718-
cltoolregexps.append("plumed\s+--no-mpi\s+" + key )
719-
cltoolregexps.append("plumed-runtime\s+" + key )
718+
cltoolregexps.append(r"plumed\s+" + key )
719+
cltoolregexps.append(r"plumed\s+--no-mpi\s+" + key )
720+
cltoolregexps.append(r"plumed-runtime\s+" + key )
720721
if data["inputtype"]=="file" :
721-
clfileregexps.append( "#TOOL\s*=\s*" + key )
722+
clfileregexps.append( r"#TOOL\s*=\s*" + key )
722723

723724
for line in inp.splitlines() :
724725
# Detect and copy plumed input files

0 commit comments

Comments
 (0)