[diffoscope] 01/04: Don't use ambiguous `l` variable names.

Chris Lamb chris at chris-lamb.co.uk
Sat Mar 3 23:46:07 CET 2018


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit bac56a5f35709db835192f66b6ea2c25702ca1ff
Author: Chris Lamb <lamby at debian.org>
Date:   Sat Mar 3 22:39:29 2018 +0000

    Don't use ambiguous `l` variable names.
---
 diffoscope/comparators/berkeley_db.py | 4 ++--
 diffoscope/diff.py                    | 6 +++---
 tests/comparators/test_macho.py       | 9 +++++++--
 tests/utils/__init__.py               | 4 ++--
 4 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/diffoscope/comparators/berkeley_db.py b/diffoscope/comparators/berkeley_db.py
index 4380bd1..7a54392 100644
--- a/diffoscope/comparators/berkeley_db.py
+++ b/diffoscope/comparators/berkeley_db.py
@@ -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
 
diff --git a/diffoscope/diff.py b/diffoscope/diff.py
index 5efab55..dc8cbfa 100644
--- a/diffoscope/diff.py
+++ b/diffoscope/diff.py
@@ -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]
 
diff --git a/tests/comparators/test_macho.py b/tests/comparators/test_macho.py
index 750cfcc..daa8851 100644
--- a/tests/comparators/test_macho.py
+++ b/tests/comparators/test_macho.py
@@ -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
diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py
index 2a6ec3c..98dc0e8 100644
--- a/tests/utils/__init__.py
+++ b/tests/utils/__init__.py
@@ -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

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list