1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
|
From de5020b3c831cf6813456528eef0b6a297ebeed6 Mon Sep 17 00:00:00 2001
From: peastman <peastman@stanford.edu>
Date: Tue, 18 Feb 2025 16:30:20 -0800
Subject: [PATCH] Fixed backslashes that were improperly interpreted as escapes
---
wrappers/python/openmm/__init__.py | 2 +-
wrappers/python/openmm/app/gromacsgrofile.py | 2 +-
.../openmm/app/internal/amber_file_parser.py | 2 +-
.../openmm/app/internal/pdbstructure.py | 4 ++--
.../app/internal/pdbx/reader/PdbxParser.py | 22 +++++++++----------
.../app/internal/pdbx/reader/PdbxReader.py | 22 +++++++++----------
wrappers/python/openmm/app/metadynamics.py | 2 +-
.../src/swig_doxygen/swig_lib/python/extend.i | 2 +-
8 files changed, 29 insertions(+), 29 deletions(-)
Index: openmm/wrappers/python/openmm/__init__.py
===================================================================
--- openmm.orig/wrappers/python/openmm/__init__.py 2025-02-19 17:29:34.756366992 +0100
+++ openmm/wrappers/python/openmm/__init__.py 2025-02-19 17:29:34.752366954 +0100
@@ -13,7 +13,7 @@
if sys.platform == 'win32':
_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}
try:
with os.add_dll_directory(version.openmm_library_path):
Index: openmm/wrappers/python/openmm/app/gromacsgrofile.py
===================================================================
--- openmm.orig/wrappers/python/openmm/app/gromacsgrofile.py 2025-02-19 17:29:34.756366992 +0100
+++ openmm/wrappers/python/openmm/app/gromacsgrofile.py 2025-02-19 17:29:34.752366954 +0100
@@ -59,7 +59,7 @@
@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):
""" Determines whether a line contains GROMACS data or not
Index: openmm/wrappers/python/openmm/app/internal/amber_file_parser.py
===================================================================
--- openmm.orig/wrappers/python/openmm/app/internal/amber_file_parser.py 2025-02-19 17:29:34.756366992 +0100
+++ openmm/wrappers/python/openmm/app/internal/amber_file_parser.py 2025-02-19 17:29:34.752366954 +0100
@@ -62,7 +62,7 @@
#=============================================================================================
# 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 = """
Index: openmm/wrappers/python/openmm/app/internal/pdbstructure.py
===================================================================
--- openmm.orig/wrappers/python/openmm/app/internal/pdbstructure.py 2025-02-19 17:29:34.756366992 +0100
+++ openmm/wrappers/python/openmm/app/internal/pdbstructure.py 2025-02-19 17:29:34.752366954 +0100
@@ -1068,7 +1068,7 @@
subdir = "ae"
full_subdir = os.path.join(pdb_dir, 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
full_pdb_file = os.path.join(full_subdir, pdb_file)
parse_one_pdb(full_pdb_file)
@@ -1079,7 +1079,7 @@
if not os.path.isdir(full_subdir):
continue
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
full_pdb_file = os.path.join(full_subdir, pdb_file)
parse_one_pdb(full_pdb_file)
Index: openmm/wrappers/python/openmm/app/internal/pdbx/reader/PdbxParser.py
===================================================================
--- openmm.orig/wrappers/python/openmm/app/internal/pdbx/reader/PdbxParser.py 2025-02-19 17:29:34.756366992 +0100
+++ openmm/wrappers/python/openmm/app/internal/pdbx/reader/PdbxParser.py 2025-02-19 17:29:34.752366954 +0100
@@ -355,16 +355,16 @@
mmcifRe = re.compile(
r"(?:"
- "(?:_(.+?)[.](\S+))" "|" # _category.attribute
+ r"(?:_(.+?)[.](\S+))" "|" # _category.attribute
- "(?:['](.*?)(?:[']\s|[']$))" "|" # single quoted strings
- "(?:[\"](.*?)(?:[\"]\s|[\"]$))" "|" # double quoted strings
+ r"(?:['](.*?)(?:[']\s|[']$))" "|" # single 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)
@@ -423,15 +423,15 @@
mmcifRe = re.compile(
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")")
"""
Index: openmm/wrappers/python/openmm/app/internal/pdbx/reader/PdbxReader.py
===================================================================
--- openmm.orig/wrappers/python/openmm/app/internal/pdbx/reader/PdbxReader.py 2025-02-19 17:29:34.756366992 +0100
+++ openmm/wrappers/python/openmm/app/internal/pdbx/reader/PdbxReader.py 2025-02-19 17:29:34.752366954 +0100
@@ -344,16 +344,16 @@
mmcifRe = re.compile(
r"(?:"
- "(?:_(.+?)[.](\S+))" "|" # _category.attribute
+ r"(?:_(.+?)[.](\S+))" "|" # _category.attribute
- "(?:['](.*?)(?:[']\s|[']$))" "|" # single quoted strings
- "(?:[\"](.*?)(?:[\"]\s|[\"]$))" "|" # double quoted strings
+ r"(?:['](.*?)(?:[']\s|[']$))" "|" # single 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)
@@ -416,15 +416,15 @@
mmcifRe = re.compile(
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)
Index: openmm/wrappers/python/openmm/app/metadynamics.py
===================================================================
--- openmm.orig/wrappers/python/openmm/app/metadynamics.py 2025-02-19 17:29:34.756366992 +0100
+++ openmm/wrappers/python/openmm/app/metadynamics.py 2025-02-19 17:29:34.752366954 +0100
@@ -244,7 +244,7 @@
# Check for any files updated by other processes.
fileLoaded = False
- pattern = re.compile('bias_(.*)_(.*)\.npy')
+ pattern = re.compile(r'bias_(.*)_(.*)\.npy')
for filename in os.listdir(self.biasDir):
match = pattern.match(filename)
if match is not None:
Index: openmm/wrappers/python/src/swig_doxygen/swig_lib/python/extend.i
===================================================================
--- openmm.orig/wrappers/python/src/swig_doxygen/swig_lib/python/extend.i 2025-02-19 17:29:34.756366992 +0100
+++ openmm/wrappers/python/src/swig_doxygen/swig_lib/python/extend.i 2025-02-19 17:29:34.752366954 +0100
@@ -371,7 +371,7 @@
def deserialize(inputString):
"""Reconstruct an object that has been serialized as XML."""
import re
- match = re.search("<([^?]\S*)", inputString)
+ match = re.search(r"<([^?]\S*)", inputString)
if match is None:
raise ValueError("Invalid input string")
type = match.groups()[0]
|