mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix a bunch of python lint errors (#32951)
* Fix a bunch of python lint errors * adjust indentation
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user