diff --git a/blivet/arch.py b/blivet/arch.py index 9a26e8f96..20964877f 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/devicelibs/edd.py b/blivet/devicelibs/edd.py index f4a091762..de1150043 100644 --- a/blivet/devicelibs/edd.py +++ b/blivet/devicelibs/edd.py @@ -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" @@ -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") diff --git a/blivet/devicetree.py b/blivet/devicetree.py index b8eb84350..00267a84c 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 d386a21cc..2b8b65713 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 3a1453782..d0411ffd4 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 2d61c2bd0..56d0aee76 100644 --- a/blivet/util.py +++ b/blivet/util.py @@ -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: @@ -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)) diff --git a/tests/action_test.py b/tests/action_test.py index fe3c75984..03cd2b5ea 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 1ea3f7485..b48a3e16e 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)