[blivet:master 2/3] Suppress some unused variable warnings.
mulhern
amulhern at redhat.com
Mon Mar 24 17:35:36 UTC 2014
Suppress warnings when the unused variable is in a tuple that matches
the result of a split() or partition() operation and the possibility
of a failure to match is handled appropriately.
Note that sometimes a failure to match is fine and does not explicitly
need to be checked for as in matching an optional comment.
Suppress by prepending unused variables with an underscore.
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/__init__.py | 13 +++++++------
blivet/devicetree.py | 3 ++-
blivet/util.py | 4 ++--
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 4372b9d..882ea8a 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -2210,7 +2210,8 @@ class BlkidTab(object):
continue
line = line[len("<device "):-len("</device>\n")]
- (data, sep, device) = line.partition(">")
+
+ (data, _sep, device) = line.partition(">")
if not device:
continue
@@ -2254,7 +2255,7 @@ class CryptTab(object):
self.blkidTab = None
for line in f.readlines():
- (line, pound, comment) = line.partition("#")
+ (line, _pound, _comment) = line.partition("#")
fields = line.split()
if not 2 <= len(fields) <= 4:
continue
@@ -2585,8 +2586,8 @@ class FSSet(object):
self.origFStab = ''.join(lines)
for line in lines:
- # strip off comments
- (line, pound, comment) = line.partition("#")
+
+ (line, _pound, _comment) = line.partition("#")
fields = line.split()
if not 4 <= len(fields) <= 6:
@@ -3167,8 +3168,8 @@ def parseFSTab(devicetree, chroot=None):
with open(path) as f:
log.debug("parsing %s", path)
for line in f.readlines():
- # strip off comments
- (line, pound, comment) = line.partition("#")
+
+ (line, _pound, _comment) = line.partition("#")
fields = line.split(None, 4)
if len(fields) < 5:
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 3818c75..ea1f913 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -2587,7 +2587,8 @@ class DeviceTree(object):
# for each logical volume?
# three just doesn't seem like enough.
name = devspec[5:] # strip off leading "/dev/"
- (vg_name, slash, lv_name) = name.partition("/")
+
+ (vg_name, _slash, lv_name) = name.partition("/")
if lv_name and not "/" in lv_name:
# looks like we may have one
lv = "%s-%s" % (vg_name, lv_name)
diff --git a/blivet/util.py b/blivet/util.py
index d609051..adc9cd5 100644
--- a/blivet/util.py
+++ b/blivet/util.py
@@ -95,7 +95,7 @@ def get_mount_paths(dev):
mount_paths = []
for mount in mounts:
try:
- (device, path, rest) = mount.split(None, 2)
+ (device, path, _rest) = mount.split(None, 2)
except ValueError:
continue
@@ -112,7 +112,7 @@ def get_mount_device(mountpoint):
mount_device = None
for mount in mounts:
try:
- (device, path, rest) = mount.split(None, 2)
+ (device, path, _rest) = mount.split(None, 2)
except ValueError:
continue
--
1.8.3.1
More information about the anaconda-patches
mailing list