Skip to content

Commit 763d5e8

Browse files
author
Thomas Preud'homme
committed
Fix ambiguous variable names
Fix Flake8's E741 errors (ambiguous variable name). This prevents confusion when reading code with a font that does not distinguish clearly between l, 1 and I. Reviewed By: tnfchris Differential Revision: https://reviews.llvm.org/D94799
1 parent 824079e commit 763d5e8

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

lnt/server/reporting/report.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
OrderAndHistory = namedtuple('OrderAndHistory', ['max_order', 'recent_orders'])
1010

1111

12-
def pairs(l):
13-
"""Make an iterable of all pairs of consecutive elements in l."""
14-
return zip(l[:-1], l[1:])
12+
def pairs(lst):
13+
"""Make an iterable of all pairs of consecutive elements in lst."""
14+
return zip(lst[:-1], lst[1:])
1515

1616

1717
# The hash color palette avoids green and red as these colours are already used

lnt/testing/profile/perf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ def deserialize(f, nm='nm', objdump='objdump', propagateExceptions=False):
3434
# Go through the data and convert counter values to percentages.
3535
for f in data['functions'].values():
3636
fc = f['counters']
37-
for l in f['data']:
38-
for k, v in l[0].items():
39-
l[0][k] = 100.0 * float(v) / fc[k]
37+
for inst_info in f['data']:
38+
for k, v in inst_info[0].items():
39+
inst_info[0][k] = 100.0 * float(v) / fc[k]
4040
for k, v in fc.items():
4141
fc[k] = 100.0 * v / data['counters'][k]
4242

lnt/testing/profile/profilev1impl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ def getFunctions(self):
8383
return d
8484

8585
def getCodeForFunction(self, fname):
86-
for l in self.data['functions'][fname].get('data', []):
87-
yield (l[0], l[1], l[2])
86+
for inst_info in self.data['functions'][fname].get('data', []):
87+
yield (inst_info[0], inst_info[1], inst_info[2])

lnt/tests/test_suite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@ def _configure(self, path, extra_cmake_defs=[], execute=True):
534534
fatal("Could not find CMake cache file: " + cache)
535535
cmake_flags += ['-C', cache]
536536

537-
for l in lines:
538-
logger.info(l)
537+
for line in lines:
538+
logger.info(line)
539539

540540
# Define compilers before specifying the cache files.
541541
early_defs = {}

lnt/util/stats.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def mean(values):
2929
return None
3030

3131

32-
def geometric_mean(l):
33-
iPow = 1. / len(l)
34-
return reduce(lambda a, b: a * b, [v ** iPow for v in l])
32+
def geometric_mean(values):
33+
iPow = 1. / len(values)
34+
return reduce(lambda a, b: a * b, [v ** iPow for v in values])
3535

3636

3737
def agg_mean(pairs):

tests/testing/profilev2impl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def test_deserialize(self):
4141
fobj = io.BytesIO(s)
4242
p2 = ProfileV2.deserialize(fobj)
4343

44-
l = list(p2.getCodeForFunction('fn1'))
44+
l1 = list(p2.getCodeForFunction('fn1'))
4545
l2 = self.test_data['functions']['fn1']['data']
46-
self.assertEqual(l, l2)
46+
self.assertEqual(l1, l2)
4747

4848
def test_getFunctions(self):
4949
p = ProfileV2.upgrade(ProfileV1(copy.deepcopy(self.test_data)))

0 commit comments

Comments
 (0)