[master 4/6] Fix remaining PEP8 violations.
dwlehman
installerbot-noreply at redhat.com
Wed Oct 28 20:13:20 UTC 2015
From: David Lehman <dlehman at redhat.com>
The only violations that have not been addressed at this point are
overly long lines, which I would like to address eventually.
---
blivet/arch.py | 2 +-
blivet/autopart.py | 2 ++
blivet/devicelibs/edd.py | 24 ++++++++++++------------
blivet/devicetree.py | 3 +--
blivet/formats/fs.py | 2 +-
blivet/iscsi.py | 2 +-
blivet/util.py | 8 ++++----
tests/action_test.py | 6 +++---
tests/devicefactory_test.py | 2 +-
9 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/blivet/arch.py b/blivet/arch.py
index 9a26e8f..2096487 100644
--- a/blivet/arch.py
+++ b/blivet/arch.py
@@ -165,7 +165,7 @@ def get_ppc_mac_book():
if get_ppc_machine() != "PMac":
return False
- #@TBD - Search for 'book' anywhere in cpuinfo? Shouldn't this be more restrictive?
+ # @TBD - Search for 'book' anywhere in cpuinfo? Shouldn't this be more restrictive?
with open('/proc/cpuinfo', 'r') as f:
for line in f:
if 'book' in line.lower():
diff --git a/blivet/autopart.py b/blivet/autopart.py
index 1a54739..99a51a1 100644
--- a/blivet/autopart.py
+++ b/blivet/autopart.py
@@ -427,6 +427,7 @@ def _schedule_volumes(storage, devs):
# schedule the device for creation
storage.create_device(dev)
+
def do_reqpart(storage, requests):
"""Perform automatic partitioning of just required platform-specific
partitions. This is incompatible with do_autopart.
@@ -448,6 +449,7 @@ def do_reqpart(storage, requests):
_schedule_partitions(storage, disks, [], requests=requests)
+
def do_autopart(storage, data, min_luks_entropy=0):
""" Perform automatic partitioning.
diff --git a/blivet/devicelibs/edd.py b/blivet/devicelibs/edd.py
index edf2964..d9e2790 100644
--- a/blivet/devicelibs/edd.py
+++ b/blivet/devicelibs/edd.py
@@ -194,31 +194,31 @@ def sysfspath(self):
def _fmt(self, line_pad, separator):
s = "%(t)spath: %(_sysfspath)s version: %(version)s %(nl)s" \
"mbr_signature: %(mbr_sig)s sectors: %(sectors)s"
- if self.type != None:
+ if self.type is not None:
s += " %(type)s"
- if self.sysfslink != None:
+ if self.sysfslink is not None:
s += "%(nl)s%(t)ssysfs pci path: %(sysfslink)s"
- if any([self.host_bus, self.pci_dev, self.channel != None]):
+ if any([self.host_bus, self.pci_dev, self.channel is not None]):
s += "%(nl)s%(t)shost_bus: %(host_bus)s pci_dev: %(pci_dev)s "\
"channel: %(channel)s"
- if self.interface != None:
+ if self.interface is not None:
s += "%(nl)s%(t)sinterface: \"%(interface)s\""
- if any([self.atapi_device != None, self.atapi_lun != None]):
+ if any([self.atapi_device is not None, self.atapi_lun is not None]):
s += "%(nl)s%(t)satapi_device: %(atapi_device)s " \
"atapi_lun: %(atapi_lun)s"
- if self.ata_device != None:
+ if self.ata_device is not None:
s += "%(nl)s%(t)sata_device: %(ata_device)s"
- if self.ata_pmp != None:
+ if self.ata_pmp is not None:
s += ", ata_pmp: %(ata_pmp)s"
- if any([self.scsi_id != None, self.scsi_lun != None]):
+ if any([self.scsi_id is not None, self.scsi_lun is not None]):
s += "%(nl)s%(t)sscsi_id: %(scsi_id)s, scsi_lun: %(scsi_lun)s"
- if self.usb_serial != None:
+ if self.usb_serial is not None:
s += "%(nl)s%(t)susb_serial: %(usb_serial)s"
- if self.ieee1394_eui64 != None:
+ if self.ieee1394_eui64 is not None:
s += "%(nl)s%(t)s1394_eui: %(ieee1394_eui64)s"
if any([self.fibre_wwid, self.fibre_lun]):
s += "%(nl)s%(t)sfibre wwid: %(fibre_wwid)s lun: %s(fibre_lun)s"
- if self.i2o_identity != None:
+ if self.i2o_identity is not None:
s += "%(nl)s%(t)si2o_identity: %(i2o_identity)s"
if any([self.sas_address, self.sas_lun]):
s += "%(nl)s%(t)ssas_address: %(sas_address)s sas_lun: %(sas_lun)s"
@@ -484,7 +484,7 @@ def devname_from_virt_pci_dev(self):
def devname_from_pci_dev(self):
name = self.devname_from_virt_pci_dev()
- if not name is None:
+ if name is not None:
return name
unsupported = ("ATAPI", "USB", "1394", "I2O", "RAID", "FIBRE", "SAS")
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index b8eb843..00267a8 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -845,7 +845,6 @@ def devices(self):
@property
def filesystems(self):
""" List of filesystems. """
- #""" Dict with mountpoint keys and filesystem values. """
filesystems = []
for dev in self.leaves:
if dev.format and getattr(dev.format, 'mountpoint', None):
@@ -1022,7 +1021,7 @@ def resolve_device(self, devspec, blkid_tab=None, crypt_tab=None, options=None):
name = devspec[5:] # strip off leading "/dev/"
(vg_name, _slash, lv_name) = name.partition("/")
- if lv_name and not "/" in lv_name:
+ if lv_name and "/" not in lv_name:
# looks like we may have one
lv = "%s-%s" % (vg_name, lv_name)
device = self.get_device_by_name(lv)
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index d386a21..2b8b657 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -593,7 +593,7 @@ def _setup(self, **kwargs):
#
# os.path.join("/mnt/foo", "/") -> "/"
#
- #mountpoint = os.path.join(chroot, mountpoint)
+ # mountpoint = os.path.join(chroot, mountpoint)
chrooted_mountpoint = os.path.normpath("%s/%s" % (chroot, mountpoint))
self._mount.do_task(chrooted_mountpoint, options=options)
diff --git a/blivet/iscsi.py b/blivet/iscsi.py
index 3a14537..d0411ff 100644
--- a/blivet/iscsi.py
+++ b/blivet/iscsi.py
@@ -457,7 +457,7 @@ def add_target(self, ipaddr, port="3260", user=None, pw=None,
found_nodes = self.discover(ipaddr, port, discover_user, discover_pw,
discover_user_in, discover_pw_in)
- if found_nodes == None:
+ if found_nodes is None:
raise IOError(_("No iSCSI nodes discovered"))
for node in found_nodes:
diff --git a/blivet/util.py b/blivet/util.py
index 9d1aa20..96889be 100644
--- a/blivet/util.py
+++ b/blivet/util.py
@@ -532,13 +532,13 @@ def compare(first, second):
This method replaces Python 2 cmp() built-in-function.
"""
- if first == None and second == None:
+ if first is None and second is None:
return 0
- elif first == None:
+ elif first is None:
return -1
- elif second == None:
+ elif second is None:
return 1
else:
@@ -637,7 +637,7 @@ def variable_copy(obj, memo, omit=None, shallow=None, duplicate=None):
new = obj.__class__.__new__(obj.__class__)
memo[id(obj)] = new
for (attr, value) in obj.__dict__.items():
- if attr in omit or value == None:
+ if attr in omit or value is None:
setattr(new, attr, value)
elif attr in shallow:
setattr(new, attr, copy.copy(value))
diff --git a/tests/action_test.py b/tests/action_test.py
index fe3c759..03cd2b5 100644
--- a/tests/action_test.py
+++ b/tests/action_test.py
@@ -441,7 +441,7 @@ def test_action_obsoletes(self):
# sda1 exists
sda1 = self.storage.devicetree.get_device_by_name("sda1")
self.assertNotEqual(sda1, None)
- #sda1.format._resizable = True
+ # sda1.format._resizable = True
resize_sda1_format = ActionResizeFormat(sda1,
sda1.size - Size("50 MiB"))
resize_sda1_format.apply()
@@ -561,7 +561,7 @@ def test_action_dependencies(self):
self.assertNotEqual(lv_root, None)
lv_root.format._min_instance_size = Size("10 MiB")
lv_root.format._target_size = lv_root.format._min_instance_size
- #lv_root.format._resizable = True
+ # lv_root.format._resizable = True
shrink_format = ActionResizeFormat(lv_root,
lv_root.size - Size("5 GiB"))
shrink_format.apply()
@@ -968,7 +968,7 @@ def test_action_apply_cancel(self):
lv_root.format._target_size = lv_root.size
original_format_size = lv_root.format.current_size
target_size = lv_root.size - Size("1 GiB")
- #lv_root.format._resizable = True
+ # lv_root.format._resizable = True
action = ActionResizeFormat(lv_root, target_size)
self.assertEqual(lv_root.format.size, original_format_size)
action.apply()
diff --git a/tests/devicefactory_test.py b/tests/devicefactory_test.py
index 1ea3f74..b48a3e1 100644
--- a/tests/devicefactory_test.py
+++ b/tests/devicefactory_test.py
@@ -499,7 +499,7 @@ def test_device_factory(self):
kwargs["label"] = "fedora 53 root"
kwargs["fstype"] = "xfs"
kwargs["device"] = device
- #kwargs["encrypted"] = False
+ # kwargs["encrypted"] = False
device = self._factory_device(device_type, size, **kwargs)
self._validate_factory_device(device, device_type, size, **kwargs)
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/683f421b3118ed6fe33e524cea4a0883178c5e18
More information about the anaconda-patches
mailing list