Skip to content

Commit

Permalink
Fix remaining PEP8 violations.
Browse files Browse the repository at this point in the history
The only violations that have not been addressed at this point are
overly long lines, which I would like to address eventually.
  • Loading branch information
dwlehman authored and vathpela committed Nov 6, 2015
1 parent bdec5c6 commit bfeae82
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion blivet/arch.py
Expand Up @@ -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():
Expand Down
24 changes: 12 additions & 12 deletions blivet/devicelibs/edd.py
Expand Up @@ -196,31 +196,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"
Expand Down Expand Up @@ -501,7 +501,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")
Expand Down
3 changes: 1 addition & 2 deletions blivet/devicetree.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion blivet/formats/fs.py
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion blivet/iscsi.py
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions blivet/util.py
Expand Up @@ -538,13 +538,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:
Expand Down Expand Up @@ -656,7 +656,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))
Expand Down
6 changes: 3 additions & 3 deletions tests/action_test.py
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/devicefactory_test.py
Expand Up @@ -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)

Expand Down

0 comments on commit bfeae82

Please sign in to comment.