mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-10 12:58:27 +03: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.
|
||||
# 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")
|
||||
|
@ -82,6 +82,7 @@ def test_disk_dir_searchable(monkeypatch):
|
||||
searchdata = virtinst.DeviceDisk.check_path_search(conn,
|
||||
tmpdir + "/footest")
|
||||
assert searchdata.uid == os.getuid()
|
||||
# pylint: disable=use-implicit-booleaness-not-comparison
|
||||
assert searchdata.fixlist == []
|
||||
|
||||
# Remove perms on the tmpdir, now it should report failures
|
||||
|
@ -371,8 +371,8 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
|
||||
msg = _("These changes will take effect after "
|
||||
"the next guest shutdown.")
|
||||
dtype = (hotplug_err and
|
||||
Gtk.MessageType.WARNING or Gtk.MessageType.INFO)
|
||||
dtype = (Gtk.MessageType.WARNING if hotplug_err else
|
||||
Gtk.MessageType.INFO)
|
||||
hotplug_msg = ""
|
||||
if hotplug_err:
|
||||
hotplug_msg += (hotplug_err[0] + "\n\n" +
|
||||
@ -1560,7 +1560,7 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
controller_num = [x for x in controllers if
|
||||
(x.type == controller_type)]
|
||||
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.type = controller_type
|
||||
|
@ -22,7 +22,7 @@ class ConnectionInfo(object):
|
||||
"""
|
||||
def __init__(self, conn, gdev):
|
||||
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.gaddr = gdev.listen or "127.0.0.1"
|
||||
self.gtlsport = gdev.tlsPort or None
|
||||
|
@ -66,7 +66,7 @@ class _VMStatsList(vmmGObject):
|
||||
expected = self.config.get_stats_history_length()
|
||||
current = len(self._stats)
|
||||
if current > expected: # pragma: no cover
|
||||
del(self._stats[expected:current])
|
||||
del self._stats[expected:current]
|
||||
|
||||
def _calculate_rate(record_name):
|
||||
ret = 0.0
|
||||
|
@ -1306,10 +1306,10 @@ class vmmDomain(vmmLibvirtObject):
|
||||
def get_arch(self):
|
||||
return self.get_xmlobj().os.arch
|
||||
def get_init(self):
|
||||
import pipes
|
||||
import shlex
|
||||
init = self.get_xmlobj().os.init
|
||||
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
|
||||
|
||||
def get_emulator(self):
|
||||
|
@ -85,7 +85,7 @@ class VirtHelpFormatter(argparse.RawDescriptionHelpFormatter):
|
||||
'''
|
||||
oldwrap = None
|
||||
|
||||
# pylint: disable=arguments-differ
|
||||
# pylint: disable=arguments-differ,protected-access
|
||||
def _split_lines(self, *args, **kwargs):
|
||||
def return_default():
|
||||
return argparse.RawDescriptionHelpFormatter._split_lines(
|
||||
@ -1690,7 +1690,7 @@ def convert_old_force(options):
|
||||
if options.force:
|
||||
if not options.check:
|
||||
options.check = "all=off"
|
||||
del(options.force)
|
||||
del options.force
|
||||
|
||||
|
||||
class ParserCheck(VirtCLIParser):
|
||||
@ -2281,7 +2281,7 @@ class ParserCPU(VirtCLIParser):
|
||||
policy = "disable"
|
||||
|
||||
if policy:
|
||||
del(self.optdict[key])
|
||||
del self.optdict[key]
|
||||
converted[policy].append(key[1:])
|
||||
|
||||
self.optdict.update(converted)
|
||||
@ -2753,7 +2753,7 @@ class ParserBoot(VirtCLIParser):
|
||||
if cliname not in inst.BOOT_DEVICES:
|
||||
continue
|
||||
|
||||
del(self.optdict[cliname])
|
||||
del self.optdict[cliname]
|
||||
if cliname not in boot_order:
|
||||
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 self.arch in list(self._uefi_arch_patterns.keys())
|
||||
return self.arch in self._uefi_arch_patterns
|
||||
|
||||
def supports_uefi_loader(self):
|
||||
"""
|
||||
|
@ -32,7 +32,7 @@ def _new_poll_helper(origmap, typename, list_cb, build_cb, support_cb):
|
||||
else:
|
||||
# Previously known object
|
||||
current[name] = origmap[name]
|
||||
del(origmap[name])
|
||||
del origmap[name]
|
||||
|
||||
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):
|
||||
if options.xmlstep:
|
||||
options.xmlonly = options.xmlstep
|
||||
del(options.xmlstep)
|
||||
del options.xmlstep
|
||||
|
||||
|
||||
def convert_old_sound(options):
|
||||
@ -135,10 +135,10 @@ def convert_old_disks(options):
|
||||
else:
|
||||
_do_convert_old_disks(options)
|
||||
|
||||
del(options.file_paths)
|
||||
del(options.disksize)
|
||||
del(options.sparse)
|
||||
del(options.nodisks)
|
||||
del options.file_paths
|
||||
del options.disksize
|
||||
del options.sparse
|
||||
del options.nodisks
|
||||
log.debug("Distilled --disk options: %s", options.disk)
|
||||
|
||||
|
||||
@ -147,7 +147,7 @@ def convert_old_os_options(options):
|
||||
return
|
||||
log.warning(
|
||||
_("--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):
|
||||
@ -204,9 +204,9 @@ def convert_old_networks(options):
|
||||
networks[idx] = networks[idx].replace(prefix + ":",
|
||||
prefix + "=")
|
||||
|
||||
del(options.mac)
|
||||
del(options.bridge)
|
||||
del(options.nonetworks)
|
||||
del options.mac
|
||||
del options.bridge
|
||||
del options.nonetworks
|
||||
|
||||
options.network = networks
|
||||
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):
|
||||
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:
|
||||
raise ValueError(_("Can't specify more than one of VNC, SDL, "
|
||||
"--graphics or --nographics"))
|
||||
|
@ -262,9 +262,9 @@ class XMLProperty(_XMLPropertyBase):
|
||||
self._is_onoff = is_onoff
|
||||
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_yesno, self._is_onoff]])
|
||||
self._is_yesno, self._is_onoff])
|
||||
if conflicts > 1:
|
||||
raise xmlutil.DevError("Conflict property converter options.")
|
||||
|
||||
@ -343,7 +343,7 @@ class XMLProperty(_XMLPropertyBase):
|
||||
propstore = xmlbuilder._propstore
|
||||
|
||||
if self.propname in propstore:
|
||||
del(propstore[self.propname])
|
||||
del propstore[self.propname]
|
||||
propstore[self.propname] = val
|
||||
|
||||
def _nonxml_fget(self, xmlbuilder):
|
||||
|
Loading…
x
Reference in New Issue
Block a user