mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Fix pylint/pycodestyle warnings with latest versions
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
4a2df06483
commit
bb1afaba29
2
setup.py
2
setup.py
@ -29,7 +29,7 @@ import setuptools.command.install_egg_info
|
|||||||
#
|
#
|
||||||
# Newer setuptools will transparently support 'import distutils' though.
|
# Newer setuptools will transparently support 'import distutils' though.
|
||||||
# That can be overridden with SETUPTOOLS_USE_DISTUTILS env variable
|
# That can be overridden with SETUPTOOLS_USE_DISTUTILS env variable
|
||||||
import distutils.command.build # pylint: disable=wrong-import-order
|
import distutils.command.build # pylint: disable=wrong-import-order,deprecated-module
|
||||||
|
|
||||||
|
|
||||||
SYSPREFIX = sysconfig.get_config_var("prefix")
|
SYSPREFIX = sysconfig.get_config_var("prefix")
|
||||||
|
@ -82,6 +82,7 @@ def test_disk_dir_searchable(monkeypatch):
|
|||||||
searchdata = virtinst.DeviceDisk.check_path_search(conn,
|
searchdata = virtinst.DeviceDisk.check_path_search(conn,
|
||||||
tmpdir + "/footest")
|
tmpdir + "/footest")
|
||||||
assert searchdata.uid == os.getuid()
|
assert searchdata.uid == os.getuid()
|
||||||
|
# pylint: disable=use-implicit-booleaness-not-comparison
|
||||||
assert searchdata.fixlist == []
|
assert searchdata.fixlist == []
|
||||||
|
|
||||||
# Remove perms on the tmpdir, now it should report failures
|
# Remove perms on the tmpdir, now it should report failures
|
||||||
|
@ -371,8 +371,8 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
|
|
||||||
msg = _("These changes will take effect after "
|
msg = _("These changes will take effect after "
|
||||||
"the next guest shutdown.")
|
"the next guest shutdown.")
|
||||||
dtype = (hotplug_err and
|
dtype = (Gtk.MessageType.WARNING if hotplug_err else
|
||||||
Gtk.MessageType.WARNING or Gtk.MessageType.INFO)
|
Gtk.MessageType.INFO)
|
||||||
hotplug_msg = ""
|
hotplug_msg = ""
|
||||||
if hotplug_err:
|
if hotplug_err:
|
||||||
hotplug_msg += (hotplug_err[0] + "\n\n" +
|
hotplug_msg += (hotplug_err[0] + "\n\n" +
|
||||||
@ -1560,7 +1560,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|||||||
controller_num = [x for x in controllers if
|
controller_num = [x for x in controllers if
|
||||||
(x.type == controller_type)]
|
(x.type == controller_type)]
|
||||||
if len(controller_num) > 0:
|
if len(controller_num) > 0:
|
||||||
index_new = max([x.index for x in controller_num]) + 1
|
index_new = max(x.index for x in controller_num) + 1
|
||||||
dev.index = index_new
|
dev.index = index_new
|
||||||
|
|
||||||
dev.type = controller_type
|
dev.type = controller_type
|
||||||
|
@ -22,7 +22,7 @@ class ConnectionInfo(object):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, conn, gdev):
|
def __init__(self, conn, gdev):
|
||||||
self.gtype = gdev.type
|
self.gtype = gdev.type
|
||||||
self.gport = gdev.port and str(gdev.port) or None
|
self.gport = str(gdev.port) if gdev.port else None
|
||||||
self.gsocket = (gdev.listens and gdev.listens[0].socket) or gdev.socket
|
self.gsocket = (gdev.listens and gdev.listens[0].socket) or gdev.socket
|
||||||
self.gaddr = gdev.listen or "127.0.0.1"
|
self.gaddr = gdev.listen or "127.0.0.1"
|
||||||
self.gtlsport = gdev.tlsPort or None
|
self.gtlsport = gdev.tlsPort or None
|
||||||
|
@ -66,7 +66,7 @@ class _VMStatsList(vmmGObject):
|
|||||||
expected = self.config.get_stats_history_length()
|
expected = self.config.get_stats_history_length()
|
||||||
current = len(self._stats)
|
current = len(self._stats)
|
||||||
if current > expected: # pragma: no cover
|
if current > expected: # pragma: no cover
|
||||||
del(self._stats[expected:current])
|
del self._stats[expected:current]
|
||||||
|
|
||||||
def _calculate_rate(record_name):
|
def _calculate_rate(record_name):
|
||||||
ret = 0.0
|
ret = 0.0
|
||||||
|
@ -1306,10 +1306,10 @@ class vmmDomain(vmmLibvirtObject):
|
|||||||
def get_arch(self):
|
def get_arch(self):
|
||||||
return self.get_xmlobj().os.arch
|
return self.get_xmlobj().os.arch
|
||||||
def get_init(self):
|
def get_init(self):
|
||||||
import pipes
|
import shlex
|
||||||
init = self.get_xmlobj().os.init
|
init = self.get_xmlobj().os.init
|
||||||
initargs = " ".join(
|
initargs = " ".join(
|
||||||
[pipes.quote(i.val) for i in self.get_xmlobj().os.initargs])
|
[shlex.quote(i.val) for i in self.get_xmlobj().os.initargs])
|
||||||
return init, initargs
|
return init, initargs
|
||||||
|
|
||||||
def get_emulator(self):
|
def get_emulator(self):
|
||||||
|
@ -85,7 +85,7 @@ class VirtHelpFormatter(argparse.RawDescriptionHelpFormatter):
|
|||||||
'''
|
'''
|
||||||
oldwrap = None
|
oldwrap = None
|
||||||
|
|
||||||
# pylint: disable=arguments-differ
|
# pylint: disable=arguments-differ,protected-access
|
||||||
def _split_lines(self, *args, **kwargs):
|
def _split_lines(self, *args, **kwargs):
|
||||||
def return_default():
|
def return_default():
|
||||||
return argparse.RawDescriptionHelpFormatter._split_lines(
|
return argparse.RawDescriptionHelpFormatter._split_lines(
|
||||||
@ -1690,7 +1690,7 @@ def convert_old_force(options):
|
|||||||
if options.force:
|
if options.force:
|
||||||
if not options.check:
|
if not options.check:
|
||||||
options.check = "all=off"
|
options.check = "all=off"
|
||||||
del(options.force)
|
del options.force
|
||||||
|
|
||||||
|
|
||||||
class ParserCheck(VirtCLIParser):
|
class ParserCheck(VirtCLIParser):
|
||||||
@ -2281,7 +2281,7 @@ class ParserCPU(VirtCLIParser):
|
|||||||
policy = "disable"
|
policy = "disable"
|
||||||
|
|
||||||
if policy:
|
if policy:
|
||||||
del(self.optdict[key])
|
del self.optdict[key]
|
||||||
converted[policy].append(key[1:])
|
converted[policy].append(key[1:])
|
||||||
|
|
||||||
self.optdict.update(converted)
|
self.optdict.update(converted)
|
||||||
@ -2753,7 +2753,7 @@ class ParserBoot(VirtCLIParser):
|
|||||||
if cliname not in inst.BOOT_DEVICES:
|
if cliname not in inst.BOOT_DEVICES:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
del(self.optdict[cliname])
|
del self.optdict[cliname]
|
||||||
if cliname not in boot_order:
|
if cliname not in boot_order:
|
||||||
boot_order.append(cliname)
|
boot_order.append(cliname)
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ class DomainCapabilities(XMLBuilder):
|
|||||||
"""
|
"""
|
||||||
Return True if we know how to setup UEFI for the passed arch
|
Return True if we know how to setup UEFI for the passed arch
|
||||||
"""
|
"""
|
||||||
return self.arch in list(self._uefi_arch_patterns.keys())
|
return self.arch in self._uefi_arch_patterns
|
||||||
|
|
||||||
def supports_uefi_loader(self):
|
def supports_uefi_loader(self):
|
||||||
"""
|
"""
|
||||||
|
@ -32,7 +32,7 @@ def _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb):
|
|||||||
else:
|
else:
|
||||||
# Previously known object
|
# Previously known object
|
||||||
current[name] = origmap[name]
|
current[name] = origmap[name]
|
||||||
del(origmap[name])
|
del origmap[name]
|
||||||
|
|
||||||
return (list(origmap.values()), list(new.values()), list(current.values()))
|
return (list(origmap.values()), list(new.values()), list(current.values()))
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ def check_cdrom_option_error(options):
|
|||||||
def convert_old_printxml(options):
|
def convert_old_printxml(options):
|
||||||
if options.xmlstep:
|
if options.xmlstep:
|
||||||
options.xmlonly = options.xmlstep
|
options.xmlonly = options.xmlstep
|
||||||
del(options.xmlstep)
|
del options.xmlstep
|
||||||
|
|
||||||
|
|
||||||
def convert_old_sound(options):
|
def convert_old_sound(options):
|
||||||
@ -135,10 +135,10 @@ def convert_old_disks(options):
|
|||||||
else:
|
else:
|
||||||
_do_convert_old_disks(options)
|
_do_convert_old_disks(options)
|
||||||
|
|
||||||
del(options.file_paths)
|
del options.file_paths
|
||||||
del(options.disksize)
|
del options.disksize
|
||||||
del(options.sparse)
|
del options.sparse
|
||||||
del(options.nodisks)
|
del options.nodisks
|
||||||
log.debug("Distilled --disk options: %s", options.disk)
|
log.debug("Distilled --disk options: %s", options.disk)
|
||||||
|
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ def convert_old_os_options(options):
|
|||||||
return
|
return
|
||||||
log.warning(
|
log.warning(
|
||||||
_("--os-type is deprecated and does nothing. Please stop using it."))
|
_("--os-type is deprecated and does nothing. Please stop using it."))
|
||||||
del(options.old_os_type)
|
del options.old_os_type
|
||||||
|
|
||||||
|
|
||||||
def convert_old_memory(options):
|
def convert_old_memory(options):
|
||||||
@ -204,9 +204,9 @@ def convert_old_networks(options):
|
|||||||
networks[idx] = networks[idx].replace(prefix + ":",
|
networks[idx] = networks[idx].replace(prefix + ":",
|
||||||
prefix + "=")
|
prefix + "=")
|
||||||
|
|
||||||
del(options.mac)
|
del options.mac
|
||||||
del(options.bridge)
|
del options.bridge
|
||||||
del(options.nonetworks)
|
del options.nonetworks
|
||||||
|
|
||||||
options.network = networks
|
options.network = networks
|
||||||
log.debug("Distilled --network options: %s", options.network)
|
log.debug("Distilled --network options: %s", options.network)
|
||||||
@ -224,7 +224,7 @@ def convert_old_graphics(options):
|
|||||||
if graphics and (vnc or sdl or keymap or vncport or vnclisten):
|
if graphics and (vnc or sdl or keymap or vncport or vnclisten):
|
||||||
fail(_("Cannot mix --graphics and old style graphical options"))
|
fail(_("Cannot mix --graphics and old style graphical options"))
|
||||||
|
|
||||||
optnum = sum([bool(g) for g in [vnc, nographics, sdl, graphics]])
|
optnum = sum(bool(g) for g in [vnc, nographics, sdl, graphics])
|
||||||
if optnum > 1:
|
if optnum > 1:
|
||||||
raise ValueError(_("Can't specify more than one of VNC, SDL, "
|
raise ValueError(_("Can't specify more than one of VNC, SDL, "
|
||||||
"--graphics or --nographics"))
|
"--graphics or --nographics"))
|
||||||
|
@ -262,9 +262,9 @@ class XMLProperty(_XMLPropertyBase):
|
|||||||
self._is_onoff = is_onoff
|
self._is_onoff = is_onoff
|
||||||
self._do_abspath = do_abspath
|
self._do_abspath = do_abspath
|
||||||
|
|
||||||
conflicts = sum([int(bool(i)) for i in
|
conflicts = sum(int(bool(i)) for i in
|
||||||
[self._is_bool, self._is_int,
|
[self._is_bool, self._is_int,
|
||||||
self._is_yesno, self._is_onoff]])
|
self._is_yesno, self._is_onoff])
|
||||||
if conflicts > 1:
|
if conflicts > 1:
|
||||||
raise xmlutil.DevError("Conflict property converter options.")
|
raise xmlutil.DevError("Conflict property converter options.")
|
||||||
|
|
||||||
@ -343,7 +343,7 @@ class XMLProperty(_XMLPropertyBase):
|
|||||||
propstore = xmlbuilder._propstore
|
propstore = xmlbuilder._propstore
|
||||||
|
|
||||||
if self.propname in propstore:
|
if self.propname in propstore:
|
||||||
del(propstore[self.propname])
|
del propstore[self.propname]
|
||||||
propstore[self.propname] = val
|
propstore[self.propname] = val
|
||||||
|
|
||||||
def _nonxml_fget(self, xmlbuilder):
|
def _nonxml_fget(self, xmlbuilder):
|
||||||
|
Loading…
Reference in New Issue
Block a user