Skip to content

Commit a22746e

Browse files
committed
Preprocess: use raw strings for regular expressions
This changes a few strings used with regular expressions to raw strings.
1 parent a3f556c commit a22746e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

commands/preprocess.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ def find_files_to_be_renamed(root):
132132

133133
for dir,orig_fn in files_rename:
134134
fn = orig_fn
135-
fn = re.sub('\?.*', '', fn)
135+
fn = re.sub(r'\?.*', '', fn)
136136
fn = re.sub('"', '_q_', fn)
137-
fn = re.sub('\*', '_star_', fn)
137+
fn = re.sub(r'\*', '_star_', fn)
138138
add_file_to_rename_map(rename_map, dir, orig_fn, fn)
139139

140140
# map loader names to more recognizable names
@@ -164,7 +164,7 @@ def find_html_files(root):
164164
return html_files
165165

166166
def is_loader_link(target):
167-
if re.match('https?://[a-z]+\.cppreference\.com/mwiki/load\.php', target):
167+
if re.match(r'https?://[a-z]+\.cppreference\.com/mwiki/load\.php', target):
168168
return True
169169
return False
170170

@@ -212,7 +212,7 @@ def trasform_relative_link(rename_map, target):
212212
target = target.replace(fn, new_fn)
213213
target = target.replace('../../upload.cppreference.com/mwiki/','../common/')
214214
target = target.replace('../mwiki/','../common/')
215-
target = re.sub('(\.php|\.css)\?.*', '\\1', target)
215+
target = re.sub(r'(\.php|\.css)\?.*', r'\1', target)
216216
target = urllib.parse.quote(target)
217217
target = target.replace('%23', '#')
218218
return target

0 commit comments

Comments
 (0)