[blivet:master 3/3] Suppress unused variable warnings for index in range

mulhern amulhern at redhat.com
Mon Mar 24 17:35:37 UTC 2014


Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/devices.py                   |  3 ++-
 tests/formats_test/labeling_test.py | 10 +++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/blivet/devices.py b/blivet/devices.py
index acd6780..50c8dd1 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -3900,7 +3900,8 @@ class FileDevice(StorageDevice):
         MiB = Size(spec="1 MiB")
         count = int(self.size.convertTo(spec="MiB"))
         rem = self.size % MiB
-        for n in range(count):
+
+        for _n in range(count):
             os.write(fd, zero * MiB)
 
         if rem:
diff --git a/tests/formats_test/labeling_test.py b/tests/formats_test/labeling_test.py
index f4b9aa1..51c077a 100755
--- a/tests/formats_test/labeling_test.py
+++ b/tests/formats_test/labeling_test.py
@@ -37,14 +37,14 @@ class InitializationTestCase(unittest.TestCase):
         self.assertTrue(fs.XFS.labelFormatOK("root_filesys"))
 
         #HFS has a maximum length of 27, minimum length of 1, and does not allow colons
-        self.assertFalse(fs.HFS.labelFormatOK("".join(["n" for x in range(28)])))
+        self.assertFalse(fs.HFS.labelFormatOK("".join(["n" for _x in range(28)])))
         self.assertFalse(fs.HFS.labelFormatOK("root:file"))
         self.assertFalse(fs.HFS.labelFormatOK(""))
-        self.assertTrue(fs.HFS.labelFormatOK("".join(["n" for x in range(27)])))
+        self.assertTrue(fs.HFS.labelFormatOK("".join(["n" for _x in range(27)])))
 
         # NTFS has a maximum length of 128
-        self.assertFalse(fs.NTFS.labelFormatOK("".join(["n" for x in range(129)])))
-        self.assertTrue(fs.NTFS.labelFormatOK("".join(["n" for x in range(128)])))
+        self.assertFalse(fs.NTFS.labelFormatOK("".join(["n" for _x in range(129)])))
+        self.assertTrue(fs.NTFS.labelFormatOK("".join(["n" for _x in range(128)])))
 
         # all devices are permitted to be passed a label argument of None
         # some will ignore it completely
@@ -118,7 +118,7 @@ class ReiserFSTestCase(fslabeling.LabelingWithRelabeling):
 class HFSTestCase(fslabeling.LabelingAsRoot):
     def setUp(self):
         self._fs_class = fs.HFS
-        self._invalid_label = "".join(["n" for x in range(28)])
+        self._invalid_label = "".join(["n" for _x in range(28)])
         super(HFSTestCase, self).setUp()
 
 @unittest.skipUnless(os.geteuid() == 0, "requires root privileges")
-- 
1.8.3.1



More information about the anaconda-patches mailing list