Subject: Fix some pylint From: Cole Robinson crobinso@redhat.com Tue Sep 12 11:54:04 2023 -0400 Date: Tue Sep 12 11:54:04 2023 -0400: Git: 0f706cf87436af598b8694aecf4b42657bfa5b11 Signed-off-by: Cole Robinson --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -449,7 +449,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, --- a/tests/test_xmlparse.py +++ b/tests/test_xmlparse.py @@ -1183,7 +1183,7 @@ def testUnknownEmulatorDomcapsLookup(mon """ 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" --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -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 --- a/virtinst/guest.py +++ b/virtinst/guest.py @@ -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): --- a/virtinst/xmlbuilder.py +++ b/virtinst/xmlbuilder.py @@ -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)