Skip to content

Fix a bunch of python lint errors #32951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions benchmark/scripts/compare_perf_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions benchmark/scripts/perf_test_driver/perf_test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion test/Inputs/not.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 3 additions & 3 deletions unittests/Reflection/RemoteMirrorInterop/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions utils/bug_reducer/bug_reducer/list_reducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions utils/bug_reducer/bug_reducer/opt_bug_reducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions utils/bug_reducer/bug_reducer/swift_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions utils/line-directive
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions utils/protocol_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ def parse_protocol(m):
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,
Expand Down
4 changes: 2 additions & 2 deletions utils/update_checkout/update_checkout/update_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down