diff --git a/benchmark/scripts/compare_perf_tests.py b/benchmark/scripts/compare_perf_tests.py
index ef461dbde2aa6..57ad939720820 100755
--- a/benchmark/scripts/compare_perf_tests.py
+++ b/benchmark/scripts/compare_perf_tests.py
@@ -551,9 +551,9 @@ def compare(name):
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(
diff --git a/benchmark/scripts/perf_test_driver/perf_test_driver.py b/benchmark/scripts/perf_test_driver/perf_test_driver.py
index 599d28eafb7d6..c662345333682 100644
--- a/benchmark/scripts/perf_test_driver/perf_test_driver.py
+++ b/benchmark/scripts/perf_test_driver/perf_test_driver.py
@@ -130,8 +130,8 @@ def run_for_opt_level(self, binary, opt_level, test_filter):
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))
diff --git a/test/Inputs/not.py b/test/Inputs/not.py
index 6e1c8b8270968..4e8163b257e68 100644
--- a/test/Inputs/not.py
+++ b/test/Inputs/not.py
@@ -10,5 +10,5 @@
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)
diff --git a/unittests/Reflection/RemoteMirrorInterop/test.py b/unittests/Reflection/RemoteMirrorInterop/test.py
index a18ca81c6ef63..9fa771ab95a28 100755
--- a/unittests/Reflection/RemoteMirrorInterop/test.py
+++ b/unittests/Reflection/RemoteMirrorInterop/test.py
@@ -56,9 +56,9 @@ def libPath(path):
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)
diff --git a/utils/bug_reducer/bug_reducer/list_reducer.py b/utils/bug_reducer/bug_reducer/list_reducer.py
index d1f9f72abd0f9..0d15dfa66ec08 100644
--- a/utils/bug_reducer/bug_reducer/list_reducer.py
+++ b/utils/bug_reducer/bug_reducer/list_reducer.py
@@ -12,8 +12,8 @@
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
diff --git a/utils/bug_reducer/bug_reducer/opt_bug_reducer.py b/utils/bug_reducer/bug_reducer/opt_bug_reducer.py
index ca8ffd82b8166..b184063f8ae23 100644
--- a/utils/bug_reducer/bug_reducer/opt_bug_reducer.py
+++ b/utils/bug_reducer/bug_reducer/opt_bug_reducer.py
@@ -16,8 +16,8 @@
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):
diff --git a/utils/bug_reducer/bug_reducer/swift_tools.py b/utils/bug_reducer/bug_reducer/swift_tools.py
index c6ac2fc73cf4b..a657c0635b89d 100644
--- a/utils/bug_reducer/bug_reducer/swift_tools.py
+++ b/utils/bug_reducer/bug_reducer/swift_tools.py
@@ -236,7 +236,7 @@ def get_symbols(self, input_file):
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
diff --git a/utils/line-directive b/utils/line-directive
index 4d22240a48595..56b688e28b6af 100755
--- a/utils/line-directive
+++ b/utils/line-directive
@@ -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(
diff --git a/utils/protocol_graph.py b/utils/protocol_graph.py
index 3dc0304ea5dcb..f237f654b9013 100644
--- a/utils/protocol_graph.py
+++ b/utils/protocol_graph.py
@@ -186,8 +186,8 @@ def parse_protocol(m):
else ''
label = node if len(requirements + generics) == 0 else (
- '\n
\n' % (
+ ('\n\n') % (
node,
'\n'.join('%s |
' % r for r in requirements),
divider,
diff --git a/utils/update_checkout/update_checkout/update_checkout.py b/utils/update_checkout/update_checkout/update_checkout.py
index a13b626443ffe..78e447b299ec6 100755
--- a/utils/update_checkout/update_checkout/update_checkout.py
+++ b/utils/update_checkout/update_checkout/update_checkout.py
@@ -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