← Back to team overview

curtin-dev team mailing list archive

[Merge] ~lamoura/curtin:fix-flake into curtin:master

 

Lucas Albuquerque Medeiros de Moura has proposed merging ~lamoura/curtin:fix-flake into curtin:master.

Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~lamoura/curtin/+git/curtin/+merge/383811

Fix flake8 E741 warning
-- 
Your team curtin developers is requested to review the proposed merge of ~lamoura/curtin:fix-flake into curtin:master.
diff --git a/curtin/block/__init__.py b/curtin/block/__init__.py
index 35a91c6..35e3a64 100644
--- a/curtin/block/__init__.py
+++ b/curtin/block/__init__.py
@@ -1315,8 +1315,8 @@ def get_supported_filesystems():
     if not os.path.exists(proc_fs):
         raise RuntimeError("Unable to read 'filesystems' from %s" % proc_fs)
 
-    return [l.split('\t')[1].strip()
-            for l in util.load_file(proc_fs).splitlines()]
+    return [line.split('\t')[1].strip()
+            for line in util.load_file(proc_fs).splitlines()]
 
 
 def _discover_get_probert_data():
diff --git a/curtin/block/bcache.py b/curtin/block/bcache.py
index 188b4e0..c1a8d26 100644
--- a/curtin/block/bcache.py
+++ b/curtin/block/bcache.py
@@ -318,11 +318,11 @@ def validate_bcache_ready(bcache_device, bcache_sys_path):
         LOG.debug("validating bcache caching device '%s' from sys_path"
                   " '%s'", bcache_device, bcache_sys_path)
         # we expect a cacheN symlink to point to bcache_device/bcache
-        sys_path_links = [os.path.join(bcache_sys_path, l)
-                          for l in os.listdir(bcache_sys_path)]
-        cache_links = [l for l in sys_path_links
-                       if os.path.islink(l) and (
-                          os.path.basename(l).startswith('cache'))]
+        sys_path_links = [os.path.join(bcache_sys_path, file_name)
+                          for file_name in os.listdir(bcache_sys_path)]
+        cache_links = [file_path for file_path in sys_path_links
+                       if os.path.islink(file_path) and (
+                          os.path.basename(file_path).startswith('cache'))]
 
         if len(cache_links) == 0:
             msg = ('Failed to find any cache links in %s:%s' % (
diff --git a/curtin/block/lvm.py b/curtin/block/lvm.py
index da29c7b..bd0f1aa 100644
--- a/curtin/block/lvm.py
+++ b/curtin/block/lvm.py
@@ -23,7 +23,7 @@ def _filter_lvm_info(lvtool, match_field, query_field, match_key, args=None):
                           '-o', ','.join([match_field, query_field])] + args,
                          capture=True)
     return [qf for (mf, qf) in
-            [l.strip().split(_SEP) for l in out.strip().splitlines()]
+            [line.strip().split(_SEP) for line in out.strip().splitlines()]
             if mf == match_key]
 
 
diff --git a/tests/unittests/test_apt_source.py b/tests/unittests/test_apt_source.py
index 6ae5579..dd0d2a5 100644
--- a/tests/unittests/test_apt_source.py
+++ b/tests/unittests/test_apt_source.py
@@ -958,7 +958,8 @@ class TestDebconfSelections(CiTestCase):
         # assumes called with *args value.
         selections = m_set_sel.call_args_list[0][0][0].decode()
 
-        missing = [l for l in lines if l not in selections.splitlines()]
+        missing = [line for line in lines
+                   if line not in selections.splitlines()]
         self.assertEqual([], missing)
 
     @mock.patch("curtin.commands.apt_config.dpkg_reconfigure")
diff --git a/tests/unittests/test_block_dasd.py b/tests/unittests/test_block_dasd.py
index 95788b0..b5e2215 100644
--- a/tests/unittests/test_block_dasd.py
+++ b/tests/unittests/test_block_dasd.py
@@ -17,8 +17,8 @@ def random_device_id():
 
 class TestDasdValidDeviceId(CiTestCase):
 
-    nonhex = [l for l in string.ascii_lowercase if l not in
-              ['a', 'b', 'c', 'd', 'e', 'f']]
+    nonhex = [letter for letter in string.ascii_lowercase
+              if letter not in ['a', 'b', 'c', 'd', 'e', 'f']]
 
     invalids = [None, '', {}, ('', ), 12, '..', CiTestCase.random_string(),
                 'qz.zq.ffff', '.ff.1420', 'ff..1518', '0.0.xyyz',
diff --git a/tests/vmtests/test_fs_battery.py b/tests/vmtests/test_fs_battery.py
index ecd1729..bd44905 100644
--- a/tests/vmtests/test_fs_battery.py
+++ b/tests/vmtests/test_fs_battery.py
@@ -165,7 +165,8 @@ class TestFsBattery(VMBaseClass):
             "/etc /my/bind-ro-etc none bind,ro 0 0".split(),
         ]
         fstab_found = [
-            l.split() for l in self.load_collect_file("fstab").splitlines()]
+            line.split() for line in self.load_collect_file(
+                "fstab").splitlines()]
         self.assertEqual(expected, [e for e in expected if e in fstab_found])
 
     def test_mountinfo_has_mounts(self):
diff --git a/tests/vmtests/test_network.py b/tests/vmtests/test_network.py
index 601cad4..7d2e779 100644
--- a/tests/vmtests/test_network.py
+++ b/tests/vmtests/test_network.py
@@ -108,7 +108,9 @@ class TestNetworkBaseTestsAbs(VMBaseClass):
 
         eni_lines = eni.split('\n') + eni_cfg.split('\n')
         print("\n".join(eni_lines))
-        for line in [l for l in expected_eni.split('\n') if len(l) > 0]:
+        expected_eni_lines = [
+            line for line in expected_eni.split('\n') if len(line) > 0]
+        for line in expected_eni_lines:
             if line.startswith("#"):
                 continue
             if "hwaddress ether" in line:

Follow ups