Skip to content

Commit 3181dd1

Browse files
authored
Fix a bunch of python lint errors (#32951)
* Fix a bunch of python lint errors * adjust indentation
1 parent 64de199 commit 3181dd1

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

benchmark/scripts/compare_perf_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,9 +551,9 @@ def compare(name):
551551

552552
comparisons = list(map(compare, comparable_tests))
553553

554-
def partition(l, p):
554+
def partition(items, p):
555555
return functools.reduce(
556-
lambda x, y: x[not p(y)].append(y) or x, l, ([], [])
556+
lambda x, y: x[not p(y)].append(y) or x, items, ([], [])
557557
)
558558

559559
decreased, not_decreased = partition(

benchmark/scripts/perf_test_driver/perf_test_driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ def run_for_opt_level(self, binary, opt_level, test_filter):
130130
print("testing driver at path: %s" % binary)
131131
names = []
132132
output = subprocess.check_output([binary, "--list"], universal_newlines=True)
133-
for l in output.split("\n")[1:]:
134-
m = BENCHMARK_OUTPUT_RE.match(l)
133+
for line in output.split("\n")[1:]:
134+
m = BENCHMARK_OUTPUT_RE.match(line)
135135
if m is None:
136136
continue
137137
names.append(m.group(1))

test/Inputs/not.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
isPosix = (sys.platform != "win32")
1111
subprocess.check_call(shlex.split(sys.argv[1], posix=isPosix))
1212
sys.exit(1)
13-
except subprocess.CalledProcessError as e:
13+
except subprocess.CalledProcessError:
1414
sys.exit(0)

unittests/Reflection/RemoteMirrorInterop/test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def libPath(path):
5656
for i in range(len(swiftcs) + 1):
5757
for localMirrorlibs in itertools.combinations(mirrorlibs, i):
5858
for i, arg in enumerate(absoluteArgs):
59-
print 'Testing', arg, 'with mirror libs:'
60-
for l in localMirrorlibs:
61-
print '\t', l
59+
print('Testing', arg, 'with mirror libs:')
60+
for lib in localMirrorlibs:
61+
print('\t', lib)
6262
callArgs = ['/tmp/test']
6363
dylibPath = os.path.join('/tmp', 'libtest' + str(i) + '.dylib')
6464
callArgs.append(dylibPath)

utils/bug_reducer/bug_reducer/list_reducer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
class ListReducer(object):
1313
"""Reduce lists of objects. Inspired by llvm bugpoint"""
1414

15-
def __init__(self, l):
16-
self.target_list = l
15+
def __init__(self, lst):
16+
self.target_list = lst
1717
# Maximal number of allowed splitting iterations,
1818
# before the elements are randomly shuffled.
1919
self.max_iters_without_progress = 3

utils/bug_reducer/bug_reducer/opt_bug_reducer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
class ReduceMiscompilingPasses(list_reducer.ListReducer):
1818

19-
def __init__(self, l, invoker):
20-
list_reducer.ListReducer.__init__(self, l)
19+
def __init__(self, lst, invoker):
20+
list_reducer.ListReducer.__init__(self, lst)
2121
self.invoker = invoker
2222

2323
def run_test(self, prefix, suffix):

utils/bug_reducer/bug_reducer/swift_tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def get_symbols(self, input_file):
236236
cmdline = self.base_args(emit_sib=False)
237237
cmdline.append(input_file)
238238
output = subprocess.check_output(cmdline)
239-
for l in output.split("\n")[:-1]:
240-
t = tuple(l.split(" "))
239+
for line in output.split("\n")[:-1]:
240+
t = tuple(line.split(" "))
241241
assert(len(t) == 2)
242242
yield t

utils/line-directive

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,8 @@ def run():
714714
break
715715
output = input
716716

717-
def decode_match(p, l):
718-
m = p.match(l)
717+
def decode_match(p, line):
718+
m = p.match(line)
719719
if m is None:
720720
return ()
721721
file, line_num = map_line_to_source_file(

utils/protocol_graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ def parse_protocol(m):
186186
else ''
187187

188188
label = node if len(requirements + generics) == 0 else (
189-
'\n<TABLE BORDER="0">\n<TR><TD>\n%s\n</TD></TR><HR/>' +
190-
'\n%s%s%s</TABLE>\n' % (
189+
('\n<TABLE BORDER="0">\n<TR><TD>\n%s\n</TD></TR><HR/>' +
190+
'\n%s%s%s</TABLE>\n') % (
191191
node,
192192
'\n'.join('<TR><TD>%s</TD></TR>' % r for r in requirements),
193193
divider,

utils/update_checkout/update_checkout/update_checkout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ def run_parallel(fn, pool_args, n_processes=0):
3737
parallel implementation.
3838
"""
3939

40-
def init(l):
40+
def init(lck):
4141
global lock
42-
lock = l
42+
lock = lck
4343

4444
if n_processes == 0:
4545
n_processes = cpu_count() * 2

0 commit comments

Comments
 (0)