Fix some pylint

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2023-09-12 11:54:04 -04:00
parent ccd4757533
commit 0f706cf874
5 changed files with 6 additions and 6 deletions

View File

@ -455,7 +455,7 @@ class App(object):
self._add(cat, args, None, check_success=True, **kwargs)
def add_invalid(self, cat, args, **kwargs):
if "grep" not in kwargs:
raise Exception("grep= must be passed for add_invalid")
raise RuntimeError("grep= must be passed for add_invalid")
self._add(cat, args, None, check_success=False, **kwargs)
def add_compare(self, cat, args, compbase, **kwargs):
self._add(cat, args, compbase,

View File

@ -1183,7 +1183,7 @@ def testUnknownEmulatorDomcapsLookup(monkeypatch):
"""
seen = False
def fake_build_from_params(conn, emulator, arch, machine, hvtype):
def fake_build_from_params(conn, emulator, arch, machine, _hvtype):
nonlocal seen
seen = True
assert arch == "mips"

View File

@ -1276,7 +1276,7 @@ class _InitClass(type):
but without giving us an explicit dep on python 3.6
"""
def __new__(cls, *args, **kwargs):
def __new__(cls, *args, **kwargs): # pylint: disable=bad-mcs-classmethod-argument
if len(args) != 3:
return super().__new__(cls, *args) # pragma: no cover
dummy = kwargs

View File

@ -636,7 +636,7 @@ class Guest(XMLBuilder):
capsinfo = self.lookup_capsinfo()
except Exception:
log.exception("Error fetching machine list for alias "
"resolution, assuming mismatch");
"resolution, assuming mismatch")
return False
if capsinfo.is_machine_alias(self.os.machine, domcaps.machine):
return True
@ -743,7 +743,7 @@ class Guest(XMLBuilder):
if original_machine_type.startswith(prefix):
self.os.machine = machine_alias
return
raise Exception("Don't know how to refresh machine type '%s'" %
raise RuntimeError("Don't know how to refresh machine type '%s'" %
original_machine_type)
def set_smbios_serial_cloudinit(self):

View File

@ -54,7 +54,7 @@ class XMLManualAction(object):
val = self.xpath_value
else:
if "=" not in str(xpath):
raise Exception(
raise ValueError(
"%s: Setting xpath must be in the form of XPATH=VALUE" %
xpath)
xpath, val = xpath.rsplit("=", 1)