Fix a bunch of python lint errors (#32951)

* Fix a bunch of python lint errors

* adjust indentation
This commit is contained in:
tbkka
2020-07-17 14:30:21 -07:00
committed by GitHub
parent 64de19944c
commit 3181dd1e4c
10 changed files with 20 additions and 20 deletions

View File

@@ -551,9 +551,9 @@ class TestComparator(object):
comparisons = list(map(compare, comparable_tests))
def partition(l, p):
def partition(items, p):
return functools.reduce(
lambda x, y: x[not p(y)].append(y) or x, l, ([], [])
lambda x, y: x[not p(y)].append(y) or x, items, ([], [])
)
decreased, not_decreased = partition(

View File

@@ -130,8 +130,8 @@ class BenchmarkDriver(object):
print("testing driver at path: %s" % binary)
names = []
output = subprocess.check_output([binary, "--list"], universal_newlines=True)
for l in output.split("\n")[1:]:
m = BENCHMARK_OUTPUT_RE.match(l)
for line in output.split("\n")[1:]:
m = BENCHMARK_OUTPUT_RE.match(line)
if m is None:
continue
names.append(m.group(1))

View File

@@ -10,5 +10,5 @@ try:
isPosix = (sys.platform != "win32")
subprocess.check_call(shlex.split(sys.argv[1], posix=isPosix))
sys.exit(1)
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError:
sys.exit(0)

View File

@@ -56,9 +56,9 @@ for i, (swiftc, swiftlib) in enumerate(zip(swiftcs, swiftlibs)):
for i in range(len(swiftcs) + 1):
for localMirrorlibs in itertools.combinations(mirrorlibs, i):
for i, arg in enumerate(absoluteArgs):
print 'Testing', arg, 'with mirror libs:'
for l in localMirrorlibs:
print '\t', l
print('Testing', arg, 'with mirror libs:')
for lib in localMirrorlibs:
print('\t', lib)
callArgs = ['/tmp/test']
dylibPath = os.path.join('/tmp', 'libtest' + str(i) + '.dylib')
callArgs.append(dylibPath)

View File

@@ -12,8 +12,8 @@ TESTRESULTS = set([TESTRESULT_NOFAILURE, TESTRESULT_KEEPSUFFIX,
class ListReducer(object):
"""Reduce lists of objects. Inspired by llvm bugpoint"""
def __init__(self, l):
self.target_list = l
def __init__(self, lst):
self.target_list = lst
# Maximal number of allowed splitting iterations,
# before the elements are randomly shuffled.
self.max_iters_without_progress = 3

View File

@@ -16,8 +16,8 @@ import swift_tools
class ReduceMiscompilingPasses(list_reducer.ListReducer):
def __init__(self, l, invoker):
list_reducer.ListReducer.__init__(self, l)
def __init__(self, lst, invoker):
list_reducer.ListReducer.__init__(self, lst)
self.invoker = invoker
def run_test(self, prefix, suffix):

View File

@@ -236,7 +236,7 @@ class SILNMInvoker(SILToolInvoker):
cmdline = self.base_args(emit_sib=False)
cmdline.append(input_file)
output = subprocess.check_output(cmdline)
for l in output.split("\n")[:-1]:
t = tuple(l.split(" "))
for line in output.split("\n")[:-1]:
t = tuple(line.split(" "))
assert(len(t) == 2)
yield t

View File

@@ -714,8 +714,8 @@ def run():
break
output = input
def decode_match(p, l):
m = p.match(l)
def decode_match(p, line):
m = p.match(line)
if m is None:
return ()
file, line_num = map_line_to_source_file(

View File

@@ -186,8 +186,8 @@ for node in sorted(graph.keys()):
else ''
label = node if len(requirements + generics) == 0 else (
'\n<TABLE BORDER="0">\n<TR><TD>\n%s\n</TD></TR><HR/>' +
'\n%s%s%s</TABLE>\n' % (
('\n<TABLE BORDER="0">\n<TR><TD>\n%s\n</TD></TR><HR/>' +
'\n%s%s%s</TABLE>\n') % (
node,
'\n'.join('<TR><TD>%s</TD></TR>' % r for r in requirements),
divider,

View File

@@ -37,9 +37,9 @@ def run_parallel(fn, pool_args, n_processes=0):
parallel implementation.
"""
def init(l):
def init(lck):
global lock
lock = l
lock = lck
if n_processes == 0:
n_processes = cpu_count() * 2