Skip to content

Commit 71da5ec

Browse files
committed
Fix flake8 warning W605 invalid escape sequence.
1 parent 4aa01e9 commit 71da5ec

14 files changed

+29
-29
lines changed

benchmark/scripts/test_compare_perf_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ def test_results_from_merge(self):
591591
def test_results_from_merge_verbose(self):
592592
"""Parsing verbose log merges all PerformanceTestSamples.
593593
...this should technically be on TestPerformanceTestResult, but it's
594-
easier to write here. ¯\_(ツ)_/¯"""
594+
easier to write here. ¯\\_(ツ)_/¯"""
595595
concatenated_logs = """
596596
Sample 0,355883
597597
Sample 1,358817

utils/backtrace-check

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ formatting.""")
3636
args = parser.parse_args()
3737

3838
TARGET_RE = re.compile(
39-
"(?P<index>\d+) +(?P<object>\S+) +(?P<address>0x[0-9a-fA-F]{16}) "
40-
"(?P<routine>[^+]+) [+] (?P<offset>\d+)")
39+
r"(?P<index>\d+) +(?P<object>\S+) +(?P<address>0x[0-9a-fA-F]{16}) "
40+
r"(?P<routine>[^+]+) [+] (?P<offset>\d+)")
4141

4242
lines = sys.stdin.readlines()
4343

utils/bug_reducer/tests/test_funcbugreducer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_basic(self):
117117
"$s9testbasic6foo413yyF" in output)
118118
re_end = 'testfuncbugreducer_testbasic_'
119119
re_end += '92196894259b5d6c98d1b77f19240904.sib'
120-
output_file_re = re.compile('\*\*\* Final File: .*' + re_end)
120+
output_file_re = re.compile(r'\*\*\* Final File: .*' + re_end)
121121
output_matches = [
122122
1 for o in output if output_file_re.match(o) is not None]
123123
self.assertEquals(sum(output_matches), 1)

utils/bug_reducer/tests/test_optbugreducer.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_basic(self):
105105
self.assertTrue('*** Found miscompiling passes!' in output)
106106
self.assertTrue('*** Final Passes: --bug-reducer-tester' in output)
107107
re_end = 'testoptbugreducer_testbasic_initial'
108-
output_file_re = re.compile('\*\*\* Final File: .*' + re_end)
108+
output_file_re = re.compile(r'\*\*\* Final File: .*' + re_end)
109109
output_matches = [
110110
1 for o in output if output_file_re.match(o) is not None]
111111
self.assertEquals(sum(output_matches), 1)
@@ -134,7 +134,7 @@ def test_suffix_in_need_of_prefix(self):
134134
self.assertTrue('*** Found miscompiling passes!' in output)
135135
self.assertTrue('*** Final Passes: --bug-reducer-tester' in output)
136136
re_end = 'testoptbugreducer_testsuffixinneedofprefix_initial'
137-
output_file_re = re.compile('\*\*\* Final File: .*' + re_end)
137+
output_file_re = re.compile(r'\*\*\* Final File: .*' + re_end)
138138
output_matches = [
139139
1 for o in output if output_file_re.match(o) is not None]
140140
self.assertEquals(sum(output_matches), 1)
@@ -167,7 +167,7 @@ def test_reduce_function(self):
167167
self.assertTrue('*** Final Passes: --bug-reducer-tester' in output)
168168
re_end = 'testoptbugreducer_testreducefunction_initial_'
169169
re_end += '30775a3d942671a403702a9846afa7a4.sib'
170-
output_file_re = re.compile('\*\*\* Final File: .*' + re_end)
170+
output_file_re = re.compile(r'\*\*\* Final File: .*' + re_end)
171171
output_matches = [
172172
1 for o in output if output_file_re.match(o) is not None]
173173
self.assertEquals(sum(output_matches), 1)

utils/cmpcodesize/cmpcodesize/compare.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
["CPP", re.compile('^(__Z|_+swift)')],
2222

2323
# Objective-C
24-
["ObjC", re.compile('^[+-]\[')],
24+
["ObjC", re.compile(r'^[+-]\[')],
2525

2626
# Swift
2727
["Partial Apply", re.compile('^__(TPA|T0.*T[aA]$)')],
@@ -80,7 +80,7 @@ def read_sizes(sizes, file_name, function_details, group_by_prefix):
8080
architectures = subprocess.check_output(
8181
["otool", "-V", "-f", file_name]).split("\n")
8282
arch = None
83-
arch_pattern = re.compile('architecture ([\S]+)')
83+
arch_pattern = re.compile(r'architecture ([\S]+)')
8484
for architecture in architectures:
8585
arch_match = arch_pattern.match(architecture)
8686
if arch_match:
@@ -115,10 +115,10 @@ def read_sizes(sizes, file_name, function_details, group_by_prefix):
115115
start_addr = None
116116
end_addr = None
117117

118-
section_pattern = re.compile(' +sectname ([\S]+)')
119-
size_pattern = re.compile(' +size ([\da-fx]+)')
120-
asmline_pattern = re.compile('^([0-9a-fA-F]+)\s')
121-
label_pattern = re.compile('^((\-*\[[^\]]*\])|[^\/\s]+):$')
118+
section_pattern = re.compile(r' +sectname ([\S]+)')
119+
size_pattern = re.compile(r' +size ([\da-fx]+)')
120+
asmline_pattern = re.compile(r'^([0-9a-fA-F]+)\s')
121+
label_pattern = re.compile(r'^((\-*\[[^\]]*\])|[^\/\s]+):$')
122122

123123
for line in content:
124124
asmline_match = asmline_pattern.match(line)

utils/create-filecheck-test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
args = parser.parse_args()
2626

2727
seen_variables = set([])
28-
ssa_re = re.compile('[%](\d+)')
28+
ssa_re = re.compile(r'[%](\d+)')
2929
for line in args.input.readlines():
3030
line = line[:line.find('//')].rstrip() + "\n"
3131
have_match = False

utils/generate_confusables.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def main(args=sys.argv):
5757

5858
pairs = []
5959
with open(confusablesFilePath, 'r') as f:
60-
pattern = re.compile("(.+)\W+;\W+(.+)\W+;")
60+
pattern = re.compile(r"(.+)\W+;\W+(.+)\W+;")
6161
for line in f:
6262
match = pattern.match(line)
6363
if match is not None:

utils/gyb.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def split_lines(s):
9999
)
100100
''', re.VERBOSE | re.MULTILINE)
101101

102-
gyb_block_close = re.compile('\}%[ \t]*\n?')
102+
gyb_block_close = re.compile(r'\}%[ \t]*\n?')
103103

104104

105105
def token_pos_to_index(token_pos, start, line_starts):

utils/jobstats/jobstats.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def to_lnt_test_obj(self, args):
199199
AUXPAT = re.compile(AUXPATSTR)
200200

201201
TIMERPATSTR = (r"time\.swift-(?P<jobkind>\w+)\." + AUXPATSTR +
202-
"\.(?P<timerkind>\w+)$")
202+
r"\.(?P<timerkind>\w+)$")
203203
TIMERPAT = re.compile(TIMERPATSTR)
204204

205205
FILEPATSTR = (r"^stats-(?P<start>\d+)-swift-(?P<kind>\w+)-" +

utils/pass-pipeline/scripts/pipelines_build_script.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def run_build_script_with_data_file(build_script, data_file, verbose=False):
2424
build_script_args = [
2525
build_script,
2626
DEFAULT_PRESENTS,
27-
'extra_swift_args=^Swift$;-Xfrontend\;' +
28-
'-external-pass-pipeline-filename\;-Xfrontend\;%s' % data_file]
27+
r'extra_swift_args=^Swift$;-Xfrontend\;' +
28+
r'-external-pass-pipeline-filename\;-Xfrontend\;%s' % data_file]
2929
sys.stdout.write("Running build script with: %s..." %
3030
' '.join(build_script_args))
3131
sys.stdout.flush()

utils/process-stats-dir.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
load_stats_dir, merge_all_jobstats)
3434

3535

36-
MODULE_PAT = re.compile('^(\w+)\.')
36+
MODULE_PAT = re.compile(r'^(\w+)\.')
3737

3838

3939
def module_name_of_stat(name):
@@ -439,7 +439,7 @@ def evaluate(args):
439439
vargs = vars_of_args(args)
440440
merged = merge_all_jobstats(load_stats_dir(d, **vargs), **vargs)
441441
env = {}
442-
ident = re.compile('(\w+)$')
442+
ident = re.compile(r'(\w+)$')
443443
for (k, v) in merged.stats.items():
444444
if k.startswith("time.") or '.time.' in k:
445445
continue
@@ -472,7 +472,7 @@ def evaluate_delta(args):
472472
new_stats = merge_all_jobstats(load_stats_dir(new, **vargs), **vargs)
473473

474474
env = {}
475-
ident = re.compile('(\w+)$')
475+
ident = re.compile(r'(\w+)$')
476476
for r in compare_stats(args, old_stats.stats, new_stats.stats):
477477
if r.name.startswith("time.") or '.time.' in r.name:
478478
continue

utils/pygments/swift.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SwiftLexer(RegexLexer):
3333

3434
_isa = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(:)(\s*)([A-Z0-9_][a-zA-Z0-9_]*)'
3535
_isa_comma = r'([a-zA-Z_][a-zA-Z0-9_]*)(\s*)(:)(\s*)' + \
36-
'([A-Z0-9_][a-zA-Z0-9_]*)(,\s?)'
36+
r'([A-Z0-9_][a-zA-Z0-9_]*)(,\s?)'
3737
_name = u'([@a-zA-Z_\U00000100-\U00100000]' + \
3838
u'[a-zA-Z0-9_\U00000100-\U00100000]*)'
3939

@@ -206,7 +206,7 @@ class SwiftLexer(RegexLexer):
206206
Name.Attribute,
207207
Punctuation,
208208
Whitespace)),
209-
(':\s*', Punctuation),
209+
(r':\s*', Punctuation),
210210
include('tuple'),
211211
include('var-isa-comma'),
212212
include('var-isa-pop'),
@@ -299,7 +299,7 @@ class SwiftLexer(RegexLexer):
299299
],
300300

301301
'in-interpolated': [
302-
('\)', String.Interpol, '#pop'),
302+
(r'\)', String.Interpol, '#pop'),
303303
include('root2'),
304304
],
305305

utils/resolve-crashes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ def execute_cmd(cmd):
1818

1919
# The regular expression we use to match compiler-crasher lines.
2020
regex = re.compile(
21-
'.*Swift(.*) :: '
22-
'(compiler_crashers|compiler_crashers_2|IDE/crashers|SIL/crashers)'
23-
'/(.*\.swift|.*\.sil).*')
21+
r'.*Swift(.*) :: '
22+
r'(compiler_crashers|compiler_crashers_2|IDE/crashers|SIL/crashers)'
23+
r'/(.*\.swift|.*\.sil).*')
2424

2525
# Take the output of lit as standard input.
2626
for line in sys.stdin:

utils/swift-bench.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def process_source(self, name):
174174
N = CommandLine.arguments[1].toInt()!
175175
}
176176
"""
177-
main_body = """
177+
main_body = r"""
178178
name = "%s"
179179
if CommandLine.arguments.count <= 2 || CommandLine.arguments[2] == name {
180180
let start = __mach_absolute_time__()

0 commit comments

Comments
 (0)