Skip to content
Snippets Groups Projects
Commit bac56a5f authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Don't use ambiguous `l` variable names.

parent 39bd9ead
No related branches found
No related tags found
No related merge requests found
......@@ -32,11 +32,11 @@ class DbDump(Command):
return ('db_dump', '-d', 'a', self.path)
def filter(self, line):
l = line.decode('utf-8')
val = line.decode('utf-8')
# We must strip some fields as libdb itself does not repeatedly read
# its own metadata reliably, even on the same file.
for x in ('h_hash: ', 'bt_compare: ', '\tuid: '):
if l.startswith(x):
if val.startswith(x):
return b''
return line
......
......@@ -444,14 +444,14 @@ def linediff_wagnerfischer(s, t):
(d[i][j-1][0] + 1, (i, j-1)),
(d[i-1][j-1][0] + cost, (i-1, j-1)))
l = []
coords = []
coord = (m, n)
while coord != (0, 0):
l.insert(0, coord)
coords.insert(0, coord)
x, y = coord
coord = d[x][y][1]
for coord in l:
for coord in coords:
cx, cy = coord
child_val = d[cx][cy][0]
......
......@@ -58,9 +58,14 @@ def test_obj_compare_non_existing(monkeypatch, obj1):
@skip_unless_tools_exist('otool', 'lipo')
def test_diff(obj_differences):
assert len(obj_differences) == 4
l = ['macho_expected_diff_arch', 'macho_expected_diff_headers', 'macho_expected_diff_loadcommands', 'macho_expected_diff_disassembly']
diffs = [
'macho_expected_diff_arch',
'macho_expected_diff_headers',
'macho_expected_diff_loadcommands',
'macho_expected_diff_disassembly',
]
for idx, diff in enumerate(obj_differences):
with open(os.path.join(os.path.dirname(__file__), '../data', l[idx]), 'w') as f:
with open(os.path.join(os.path.dirname(__file__), '../data', diffs[idx]), 'w') as f:
print(diff.unified_diff, file=f)
expected_diff = get_data('macho_expected_diff')
assert obj_differences[0].unified_diff == expected_diff
......@@ -27,8 +27,8 @@ def diff_ignore_line_numbers(diff):
return re_diff_line_numbers.sub(r"\1@@ -XX,XX +XX,XX @@", diff)
def _collapse_line(line, escape=html.escape):
l = len(escape(line))
return str(l - 1) + "\n" if line[-1] == "\n" else str(l)
len_ = len(escape(line))
return str(len_ - 1) + "\n" if line[-1] == "\n" else str(len_)
def _diff_collapse_line(line):
return line[0] + _collapse_line(line[1:]) if line and line[0] in '+- ' else line
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment