Skip to content

Commit d103815

Browse files
committed
[NFC] Python Lint: Fix E275(missing whitespace after keyword) issues.
1 parent 8f096bf commit d103815

File tree

20 files changed

+68
-68
lines changed

20 files changed

+68
-68
lines changed

test/Driver/Inputs/filelists/check-filelist-abc.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828

2929
with open(filelistFile, 'r') as f:
3030
lines = f.readlines()
31-
assert(lines[0].endswith("/a.swift\n") or
32-
lines[0].endswith("/a.swiftmodule\n"))
33-
assert(lines[1].endswith("/b.swift\n") or
34-
lines[1].endswith("/b.swiftmodule\n"))
35-
assert(lines[2].endswith("/c.swift\n") or
36-
lines[2].endswith("/c.swiftmodule\n"))
31+
assert (lines[0].endswith("/a.swift\n") or
32+
lines[0].endswith("/a.swiftmodule\n"))
33+
assert (lines[1].endswith("/b.swift\n") or
34+
lines[1].endswith("/b.swiftmodule\n"))
35+
assert (lines[2].endswith("/c.swift\n") or
36+
lines[2].endswith("/c.swiftmodule\n"))
3737

3838
if primaryFile:
3939
print("Command-line primary", os.path.basename(primaryFile))
@@ -42,7 +42,7 @@
4242
primaryFilelistFile = sys.argv[sys.argv.index('-primary-filelist') + 1]
4343
with open(primaryFilelistFile, 'r') as f:
4444
lines = f.readlines()
45-
assert(len(lines) == 1)
45+
assert len(lines) == 1
4646
print("Handled", os.path.basename(lines[0]).rstrip())
4747
elif lines[0].endswith(".swiftmodule\n"):
4848
print("Handled modules")
@@ -63,7 +63,7 @@
6363
outputListFile = sys.argv[sys.argv.index('-output-filelist') + 1]
6464
with open(outputListFile, 'r') as f:
6565
lines = f.readlines()
66-
assert(lines[0].endswith("/a.o\n") or lines[0].endswith("/a.bc\n"))
67-
assert(lines[1].endswith("/b.o\n") or lines[1].endswith("/b.bc\n"))
68-
assert(lines[2].endswith("/c.o\n") or lines[2].endswith("/c.bc\n"))
66+
assert lines[0].endswith("/a.o\n") or lines[0].endswith("/a.bc\n")
67+
assert lines[1].endswith("/b.o\n") or lines[1].endswith("/b.bc\n")
68+
assert lines[2].endswith("/c.o\n") or lines[2].endswith("/c.bc\n")
6969
print("...with output!")

test/Serialization/Inputs/binary_sub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44

55
(_, old, new) = sys.argv
6-
assert(len(old) == len(new))
6+
assert len(old) == len(new)
77

88
if sys.version_info[0] < 3:
99
data = sys.stdin.read()

tools/SourceKit/bindings/python/sourcekitd/capi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def to_python_object(self):
232232
elif var_ty == VariantType.UID:
233233
return UIdent(conf.lib.sourcekitd_variant_uid_get_value(self))
234234
else:
235-
assert(var_ty == VariantType.BOOL)
235+
assert var_ty == VariantType.BOOL
236236
return conf.lib.sourcekitd_variant_bool_get_value(self)
237237

238238
def to_python_array(self):

utils/GYBUnicodeDataUtils.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def verify(self, unicode_property):
339339
for cp in range(0, 0x110000):
340340
expected_value = unicode_property.get_value(cp)
341341
actual_value = self.get_value(cp)
342-
assert(expected_value == actual_value)
342+
assert expected_value == actual_value
343343

344344
def freeze(self):
345345
"""Compress internal trie representation.
@@ -405,12 +405,12 @@ def map_index(idx):
405405

406406
def _int_to_le_bytes(self, data, width):
407407
if width == 1:
408-
assert(data & ~0xff == 0)
408+
assert data & ~0xff == 0
409409
return [data]
410410
if width == 2:
411-
assert(data & ~0xffff == 0)
411+
assert data & ~0xffff == 0
412412
return [data & 0xff, data & 0xff00]
413-
assert(False)
413+
assert False
414414

415415
def _int_list_to_le_bytes(self, ints, width):
416416
return [
@@ -512,7 +512,7 @@ def get_extended_grapheme_cluster_rules_matrix(grapheme_cluster_break_table):
512512
rules_matrix[first][second] = action
513513

514514
# Make sure we can pack one row of the matrix into a 'uint16_t'.
515-
assert(len(any_value) <= 16)
515+
assert len(any_value) <= 16
516516

517517
result = []
518518
for first in any_value:
@@ -572,9 +572,9 @@ def _convert_line(line):
572572
return (test, boundaries)
573573

574574
# Self-test.
575-
assert(_convert_line(u'÷ 0903 × 0308 ÷ AC01 ÷ # abc') == (
576-
'\\xe0\\xa4\\x83\\xcc\\x88\\xea\\xb0\\x81', [0, 5, 8]))
577-
assert(_convert_line(u'÷ D800 ÷ # abc') == ('\\xe2\\x80\\x8b', [0, 3]))
575+
assert (_convert_line(u'÷ 0903 × 0308 ÷ AC01 ÷ # abc') ==
576+
('\\xe0\\xa4\\x83\\xcc\\x88\\xea\\xb0\\x81', [0, 5, 8]))
577+
assert _convert_line(u'÷ D800 ÷ # abc') == ('\\xe2\\x80\\x8b', [0, 3])
578578

579579
result = []
580580

@@ -627,9 +627,9 @@ def _convert_line(line):
627627
return (test, boundaries)
628628

629629
# Self-test.
630-
assert(_convert_line('÷ 0903 × 0308 ÷ AC01 ÷ # abc') == ([
631-
0x0903, 0x0308, 0xac01], [0, 2, 3]))
632-
assert(_convert_line('÷ D800 ÷ # abc') == ([0x200b], [0, 1]))
630+
assert (_convert_line('÷ 0903 × 0308 ÷ AC01 ÷ # abc') ==
631+
([0x0903, 0x0308, 0xac01], [0, 2, 3]))
632+
assert _convert_line('÷ D800 ÷ # abc') == ([0x200b], [0, 1])
633633

634634
result = []
635635

utils/backtrace-check

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def main():
7575
# First see if we found the start of our stack trace start. If so, set
7676
# the found stack trace flag and continue.
7777
if line == 'Current stack trace:':
78-
assert(not found_stack_trace_start)
78+
assert not found_stack_trace_start
7979
found_stack_trace_start = True
8080
continue
8181

@@ -97,11 +97,11 @@ def main():
9797

9898
# Check for unavailable symbols, if that was requested.
9999
if args.check_unavailable:
100-
assert('unavailable' not in matches.group('routine'))
100+
assert 'unavailable' not in matches.group('routine')
101101

102102
# Once we have processed all of the lines, make sure that we found at least
103103
# one stack trace entry.
104-
assert(found_stack_trace_entry)
104+
assert found_stack_trace_entry
105105

106106

107107
if __name__ == '__main__':

utils/bug_reducer/bug_reducer/list_reducer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _test_prefix_suffix(self, mid, prefix, suffix):
9292
self._reset_progress()
9393
return False
9494

95-
assert(result == TESTRESULT_NOFAILURE)
95+
assert result == TESTRESULT_NOFAILURE
9696
# The property does not hold. Some of the elements we removed must
9797
# be necessary to maintain the property.
9898
self.mid_top = mid
@@ -165,7 +165,7 @@ def _trim_try_backjump_and_trim_suffix(self):
165165
def reduce_list(self):
166166
random.seed(0x6e5ea738) # Seed the random number generator
167167
(result, self.target_list, kept) = self.run_test(self.target_list, [])
168-
assert(result in TESTRESULTS)
168+
assert result in TESTRESULTS
169169
(should_continue, result) = self._should_continue(result)
170170
if not should_continue:
171171
return result

utils/bug_reducer/bug_reducer/swift_tools.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ def tool(self):
157157
return self.tools.sil_opt
158158

159159
def _cmdline(self, input_file, passes, emit_sib, output_file='-'):
160-
assert(isinstance(emit_sib, bool))
161-
assert(isinstance(output_file, str))
160+
assert isinstance(emit_sib, bool)
161+
assert isinstance(output_file, str)
162162
base_args = self.base_args(emit_sib)
163163
sanity_check_file_exists(input_file)
164164
base_args.extend([input_file, '-o', output_file])
@@ -189,12 +189,12 @@ def tool(self):
189189

190190
def _cmdline(self, input_file, funclist_path, emit_sib, output_file='-',
191191
invert=False):
192-
assert(isinstance(emit_sib, bool))
193-
assert(isinstance(output_file, str))
192+
assert isinstance(emit_sib, bool)
193+
assert isinstance(output_file, str)
194194

195195
sanity_check_file_exists(input_file)
196196
sanity_check_file_exists(funclist_path)
197-
assert(isinstance(funclist_path, str))
197+
assert isinstance(funclist_path, str)
198198
base_args = self.base_args(emit_sib)
199199
base_args.extend([input_file, '-o', output_file,
200200
'-func-file=%s' % funclist_path])
@@ -204,7 +204,7 @@ def _cmdline(self, input_file, funclist_path, emit_sib, output_file='-',
204204

205205
def _invoke(self, input_file, funclist_path, output_filename,
206206
invert=False):
207-
assert(isinstance(funclist_path, str))
207+
assert isinstance(funclist_path, str)
208208
cmdline = self._cmdline(input_file,
209209
funclist_path,
210210
True,
@@ -214,7 +214,7 @@ def _invoke(self, input_file, funclist_path, output_filename,
214214

215215
def invoke_with_functions(self, funclist_path, output_filename,
216216
invert=False):
217-
assert(isinstance(funclist_path, str))
217+
assert isinstance(funclist_path, str)
218218
return self._invoke(self.input_file, funclist_path, output_filename,
219219
invert)
220220

@@ -236,5 +236,5 @@ def get_symbols(self, input_file):
236236
output = subprocess.check_output(cmdline)
237237
for line in output.split("\n")[:-1]:
238238
t = tuple(line.split(" "))
239-
assert(len(t) == 2)
239+
assert len(t) == 2
240240
yield t

utils/build_swift/tests/build_swift/test_cache_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_replaced_with_functools_lru_cache_python_3_2(self):
4747
def func():
4848
return None
4949

50-
assert(mock_lru_cache.called)
50+
assert mock_lru_cache.called
5151

5252
def test_call_with_no_args(self):
5353
# Increments the counter once per unique call.

utils/build_swift/tests/build_swift/test_shell.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_echo_command(self):
115115

116116
mock_stream.write.assert_called_with(
117117
'>>> {}\n'.format(shell.quote(test_command)))
118-
assert(mock_stream.flush.called)
118+
assert mock_stream.flush.called
119119

120120
@utils.requires_module('unittest.mock')
121121
def test_echo_command_custom_prefix(self):
@@ -124,7 +124,7 @@ def test_echo_command_custom_prefix(self):
124124
shell._echo_command('ls', mock_stream, prefix='$ ')
125125

126126
mock_stream.write.assert_called_with('$ ls\n')
127-
assert(mock_stream.flush.called)
127+
assert mock_stream.flush.called
128128

129129
# -------------------------------------------------------------------------
130130
# _normalize_args

utils/dev-scripts/scurve_printer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def main():
7373
ax.set_xlim(0.0, 1.0)
7474
y_min = args.y_axis_min or 1.0 - y_limit
7575
y_max = args.y_axis_max or 1.0 + y_limit
76-
assert(y_min <= y_max)
76+
assert y_min <= y_max
7777
ax.set_ylim(y_min, y_max)
7878
ax.grid(True)
7979
ax.xaxis.set_ticks(np.arange(0.0, 1.0, 0.05))

0 commit comments

Comments
 (0)