Unverified Commit 452506eb authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Fixed backslashes that were improperly interpreted as escapes (#4804)

parent cd8f19c5
...@@ -13,7 +13,7 @@ from . import version ...@@ -13,7 +13,7 @@ from . import version
if sys.platform == 'win32': if sys.platform == 'win32':
_path = os.environ['PATH'] _path = os.environ['PATH']
os.environ['PATH'] = '%(lib)s;%(lib)s\plugins;%(path)s' % { os.environ['PATH'] = r'%(lib)s;%(lib)s\plugins;%(path)s' % {
'lib': version.openmm_library_path, 'path': _path} 'lib': version.openmm_library_path, 'path': _path}
try: try:
with os.add_dll_directory(version.openmm_library_path): with os.add_dll_directory(version.openmm_library_path):
......
...@@ -59,7 +59,7 @@ def _isfloat(word): ...@@ -59,7 +59,7 @@ def _isfloat(word):
@return answer Boolean which specifies whether the string is any number @return answer Boolean which specifies whether the string is any number
""" """
return match('^[-+]?[0-9]*\.?[0-9]*([eEdD][-+]?[0-9]+)?$',word) return match(r'^[-+]?[0-9]*\.?[0-9]*([eEdD][-+]?[0-9]+)?$',word)
def _is_gro_coord(line): def _is_gro_coord(line):
""" Determines whether a line contains GROMACS data or not """ Determines whether a line contains GROMACS data or not
......
...@@ -62,7 +62,7 @@ from . import customgbforces as customgb ...@@ -62,7 +62,7 @@ from . import customgbforces as customgb
#============================================================================================= #=============================================================================================
# A regex for extracting print format info from the FORMAT lines. # A regex for extracting print format info from the FORMAT lines.
FORMAT_RE_PATTERN=re.compile("([0-9]+)\(?([a-zA-Z]+)([0-9]+)\.?([0-9]*)\)?") FORMAT_RE_PATTERN=re.compile(r"([0-9]+)\(?([a-zA-Z]+)([0-9]+)\.?([0-9]*)\)?")
# Pointer labels which map to pointer numbers at top of prmtop files # Pointer labels which map to pointer numbers at top of prmtop files
POINTER_LABELS = """ POINTER_LABELS = """
......
...@@ -1075,7 +1075,7 @@ if __name__=='__main__': ...@@ -1075,7 +1075,7 @@ if __name__=='__main__':
subdir = "ae" subdir = "ae"
full_subdir = os.path.join(pdb_dir, subdir) full_subdir = os.path.join(pdb_dir, subdir)
for pdb_file in os.listdir(full_subdir): for pdb_file in os.listdir(full_subdir):
if not re.match("pdb.%2s.\.ent\.gz" % subdir , pdb_file): if not re.match(r"pdb.%2s.\.ent\.gz" % subdir , pdb_file):
continue continue
full_pdb_file = os.path.join(full_subdir, pdb_file) full_pdb_file = os.path.join(full_subdir, pdb_file)
parse_one_pdb(full_pdb_file) parse_one_pdb(full_pdb_file)
...@@ -1086,7 +1086,7 @@ if __name__=='__main__': ...@@ -1086,7 +1086,7 @@ if __name__=='__main__':
if not os.path.isdir(full_subdir): if not os.path.isdir(full_subdir):
continue continue
for pdb_file in os.listdir(full_subdir): for pdb_file in os.listdir(full_subdir):
if not re.match("pdb.%2s.\.ent\.gz" % subdir , pdb_file): if not re.match(r"pdb.%2s.\.ent\.gz" % subdir , pdb_file):
continue continue
full_pdb_file = os.path.join(full_subdir, pdb_file) full_pdb_file = os.path.join(full_subdir, pdb_file)
parse_one_pdb(full_pdb_file) parse_one_pdb(full_pdb_file)
......
...@@ -355,16 +355,16 @@ class PdbxReader(object): ...@@ -355,16 +355,16 @@ class PdbxReader(object):
mmcifRe = re.compile( mmcifRe = re.compile(
r"(?:" r"(?:"
"(?:_(.+?)[.](\S+))" "|" # _category.attribute r"(?:_(.+?)[.](\S+))" "|" # _category.attribute
"(?:['](.*?)(?:[']\s|[']$))" "|" # single quoted strings r"(?:['](.*?)(?:[']\s|[']$))" "|" # single quoted strings
"(?:[\"](.*?)(?:[\"]\s|[\"]$))" "|" # double quoted strings r"(?:[\"](.*?)(?:[\"]\s|[\"]$))" "|" # double quoted strings
"(?:\s*#.*$)" "|" # comments (dumped) r"(?:\s*#.*$)" "|" # comments (dumped)
"(\S+)" # unquoted words r"(\S+)" # unquoted words
")") r")")
fileIter = iter(ifh) fileIter = iter(ifh)
...@@ -423,15 +423,15 @@ class PdbxReader(object): ...@@ -423,15 +423,15 @@ class PdbxReader(object):
mmcifRe = re.compile( mmcifRe = re.compile(
r"(?:" r"(?:"
"(?:_(.+?)[.](\S+))" "|" # _category.attribute r"(?:_(.+?)[.](\S+))" "|" # _category.attribute
"(?:['\"](.*?)(?:['\"]\s|['\"]$))" "|" # quoted strings r"(?:['\"](.*?)(?:['\"]\s|['\"]$))" "|" # quoted strings
"(?:\s*#.*$)" "|" # comments (dumped) r"(?:\s*#.*$)" "|" # comments (dumped)
"(\S+)" # unquoted words r"(\S+)" # unquoted words
")") r")")
""" """
......
...@@ -344,16 +344,16 @@ class PdbxReader(object): ...@@ -344,16 +344,16 @@ class PdbxReader(object):
mmcifRe = re.compile( mmcifRe = re.compile(
r"(?:" r"(?:"
"(?:_(.+?)[.](\S+))" "|" # _category.attribute r"(?:_(.+?)[.](\S+))" "|" # _category.attribute
"(?:['](.*?)(?:[']\s|[']$))" "|" # single quoted strings r"(?:['](.*?)(?:[']\s|[']$))" "|" # single quoted strings
"(?:[\"](.*?)(?:[\"]\s|[\"]$))" "|" # double quoted strings r"(?:[\"](.*?)(?:[\"]\s|[\"]$))" "|" # double quoted strings
"(?:\s*#.*$)" "|" # comments (dumped) r"(?:\s*#.*$)" "|" # comments (dumped)
"(\S+)" # unquoted words r"(\S+)" # unquoted words
")") r")")
fileIter = iter(ifh) fileIter = iter(ifh)
...@@ -416,15 +416,15 @@ class PdbxReader(object): ...@@ -416,15 +416,15 @@ class PdbxReader(object):
mmcifRe = re.compile( mmcifRe = re.compile(
r"(?:" r"(?:"
"(?:_(.+?)[.](\S+))" "|" # _category.attribute r"(?:_(.+?)[.](\S+))" "|" # _category.attribute
"(?:['\"](.*?)(?:['\"]\s|['\"]$))" "|" # quoted strings r"(?:['\"](.*?)(?:['\"]\s|['\"]$))" "|" # quoted strings
"(?:\s*#.*$)" "|" # comments (dumped) r"(?:\s*#.*$)" "|" # comments (dumped)
"(\S+)" # unquoted words r"(\S+)" # unquoted words
")") r")")
fileIter = iter(ifh) fileIter = iter(ifh)
......
...@@ -244,7 +244,7 @@ class Metadynamics(object): ...@@ -244,7 +244,7 @@ class Metadynamics(object):
# Check for any files updated by other processes. # Check for any files updated by other processes.
fileLoaded = False fileLoaded = False
pattern = re.compile('bias_(.*)_(.*)\.npy') pattern = re.compile(r'bias_(.*)_(.*)\.npy')
for filename in os.listdir(self.biasDir): for filename in os.listdir(self.biasDir):
match = pattern.match(filename) match = pattern.match(filename)
if match is not None: if match is not None:
......
...@@ -388,7 +388,7 @@ Parameters: ...@@ -388,7 +388,7 @@ Parameters:
def deserialize(inputString): def deserialize(inputString):
"""Reconstruct an object that has been serialized as XML.""" """Reconstruct an object that has been serialized as XML."""
import re import re
match = re.search("<([^?]\S*)", inputString) match = re.search(r"<([^?]\S*)", inputString)
if match is None: if match is None:
raise ValueError("Invalid input string") raise ValueError("Invalid input string")
type = match.groups()[0] type = match.groups()[0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment