tests: pylint: Silence/fix a bunch of new warnings
This commit is contained in:
parent
c75b3a99b1
commit
4e7a6ad728
|
@ -3,11 +3,12 @@
|
|||
# can either give multiple identifier separated by comma (,) or put this option
|
||||
# multiple time (only on the command line, not in the configuration file where
|
||||
# it should appear only once).
|
||||
disable=Design,Similarities,invalid-name,missing-docstring,line-too-long,too-many-lines,superfluous-parens,bad-whitespace,locally-disabled,no-self-use,unnecessary-lambda,star-args,fixme,global-statement,bare-except,anomalous-backslash-in-string,broad-except,cyclic-import,bad-continuation,locally-enabled,unidiomatic-typecheck,redefined-variable-type,bad-option-value,wrong-import-position
|
||||
disable=Design,Similarities,invalid-name,missing-docstring,line-too-long,too-many-lines,superfluous-parens,bad-whitespace,locally-disabled,no-self-use,unnecessary-lambda,star-args,fixme,global-statement,bare-except,anomalous-backslash-in-string,broad-except,cyclic-import,bad-continuation,locally-enabled,unidiomatic-typecheck,redefined-variable-type,bad-option-value,wrong-import-position,consider-using-ternary,no-else-return,len-as-condition
|
||||
|
||||
|
||||
[REPORTS]
|
||||
reports=no
|
||||
score=no
|
||||
|
||||
|
||||
[FORMAT]
|
||||
|
@ -25,6 +26,10 @@ notes=FIXME,XXX,TODO
|
|||
# (i.e. not used).
|
||||
dummy-variables-rgx=ignore.*|.*_ignore
|
||||
|
||||
# Argument names that match this expression will be ignored. Default to name
|
||||
# with leading underscore
|
||||
ignored-argument-names=_.*|ignore.*|.*_ignore
|
||||
|
||||
# List of additional names supposed to be defined in builtins. Remember that
|
||||
# you should avoid to define new builtins when possible.
|
||||
additional-builtins=_
|
||||
|
|
|
@ -126,11 +126,9 @@ class TestXMLMisc(unittest.TestCase):
|
|||
|
||||
def testDefaultBridge(self):
|
||||
# Test our handling of the default bridge routines
|
||||
origfunc = None
|
||||
try:
|
||||
from virtinst import deviceinterface
|
||||
origfunc = getattr(deviceinterface, "_default_bridge")
|
||||
|
||||
try:
|
||||
def newbridge(ignore_conn):
|
||||
return "bzz0"
|
||||
setattr(deviceinterface, "_default_bridge", newbridge)
|
||||
|
@ -164,8 +162,6 @@ class TestXMLMisc(unittest.TestCase):
|
|||
" <mac address=\"22:22:33:44:55:68\"/>\n"
|
||||
"</interface>\n")
|
||||
finally:
|
||||
if origfunc:
|
||||
from virtinst import deviceinterface
|
||||
setattr(deviceinterface, "_default_bridge", origfunc)
|
||||
|
||||
def testCpustrToTuple(self):
|
||||
|
|
|
@ -45,8 +45,8 @@ def install_specified(location, cdpath, pxe, import_install):
|
|||
def cdrom_specified(guest, disk=None):
|
||||
disks = guest.get_devices("disk")
|
||||
|
||||
for disk in disks:
|
||||
if disk.device == virtinst.VirtualDisk.DEVICE_CDROM:
|
||||
for d in disks:
|
||||
if d.device == virtinst.VirtualDisk.DEVICE_CDROM:
|
||||
return True
|
||||
|
||||
# Probably haven't set up disks yet
|
||||
|
|
1
virt-xml
1
virt-xml
|
@ -454,6 +454,7 @@ def main(conn=None):
|
|||
if options.build_xml:
|
||||
devs = action_build_xml(conn, options, parserclass)
|
||||
for dev in devs:
|
||||
# pylint: disable=no-member
|
||||
print_stdout(dev.get_xml_config())
|
||||
return 0
|
||||
|
||||
|
|
|
@ -163,10 +163,10 @@ class vmmAddStorage(vmmGObjectUI):
|
|||
errmsg = _("Errors were encountered changing permissions for the "
|
||||
"following directories:")
|
||||
details = ""
|
||||
for path, error in errors.items():
|
||||
if path not in broken_paths:
|
||||
for p, error in errors.items():
|
||||
if p not in broken_paths:
|
||||
continue
|
||||
details += "%s : %s\n" % (path, error)
|
||||
details += "%s : %s\n" % (p, error)
|
||||
details += "\nIt is very likely the VM will fail to start up."
|
||||
|
||||
logging.debug("Permission errors:\n%s", details)
|
||||
|
|
|
@ -445,6 +445,7 @@ class vmmConnection(vmmGObject):
|
|||
locals()[_supportname] = getattr(virtinst.VirtualConnection,
|
||||
_supportname)
|
||||
def check_support(self, *args):
|
||||
# pylint: disable=no-value-for-parameter
|
||||
return self._backend.check_support(*args)
|
||||
|
||||
def is_storage_capable(self):
|
||||
|
|
|
@ -1164,8 +1164,8 @@ class vmmDomain(vmmLibvirtObject):
|
|||
def class_name(self):
|
||||
return "domain"
|
||||
|
||||
def _define(self, newxml):
|
||||
self.conn.define_domain(newxml)
|
||||
def _define(self, xml):
|
||||
self.conn.define_domain(xml)
|
||||
def _XMLDesc(self, flags):
|
||||
return self._backend.XMLDesc(flags)
|
||||
def _get_backend_status(self):
|
||||
|
@ -2090,8 +2090,8 @@ class vmmDomainVirtinst(vmmDomain):
|
|||
ignore = flags
|
||||
return self._backend.get_xml_config()
|
||||
|
||||
def _define(self, newxml):
|
||||
ignore = newxml
|
||||
def _define(self, xml):
|
||||
ignore = xml
|
||||
self.emit("state-changed")
|
||||
|
||||
def _invalidate_xml(self):
|
||||
|
|
|
@ -160,9 +160,9 @@ def set_grid_row_visible(child, visible):
|
|||
"not %s" % type(parent))
|
||||
|
||||
row = child_get_property(parent, child, "top-attach")
|
||||
for child in parent.get_children():
|
||||
if child_get_property(parent, child, "top-attach") == row:
|
||||
child.set_visible(visible)
|
||||
for c in parent.get_children():
|
||||
if child_get_property(parent, c, "top-attach") == row:
|
||||
c.set_visible(visible)
|
||||
|
||||
|
||||
def init_combo_text_column(combo, col):
|
||||
|
|
|
@ -206,7 +206,7 @@ class Viewer(vmmGObject):
|
|||
|
||||
def _get_scaling(self):
|
||||
raise NotImplementedError()
|
||||
def _set_scaling(self, val):
|
||||
def _set_scaling(self, scaling):
|
||||
raise NotImplementedError()
|
||||
|
||||
def _set_resizeguest(self, val):
|
||||
|
@ -456,9 +456,9 @@ class VNCViewer(Viewer):
|
|||
# Connection routines #
|
||||
#######################
|
||||
|
||||
def _open(self, *args, **kwargs):
|
||||
def _open(self):
|
||||
self._init_widget()
|
||||
return Viewer._open(self, *args, **kwargs)
|
||||
return Viewer._open(self)
|
||||
|
||||
def _open_host(self):
|
||||
host, port, ignore = self._ginfo.get_conn_host()
|
||||
|
@ -727,8 +727,8 @@ class SpiceViewer(Viewer):
|
|||
self._create_spice_session()
|
||||
self._spice_session.open_fd(fd)
|
||||
|
||||
def _set_username(self, val):
|
||||
ignore = val
|
||||
def _set_username(self, cred):
|
||||
ignore = cred
|
||||
def _set_password(self, cred):
|
||||
self._spice_session.set_property("password", cred)
|
||||
fd = self._get_fd_for_open()
|
||||
|
|
|
@ -144,6 +144,7 @@ class VirtHelpFormatter(argparse.RawDescriptionHelpFormatter):
|
|||
'''
|
||||
oldwrap = None
|
||||
|
||||
# pylint: disable=arguments-differ
|
||||
def _split_lines(self, *args, **kwargs):
|
||||
def return_default():
|
||||
return argparse.RawDescriptionHelpFormatter._split_lines(
|
||||
|
|
|
@ -185,9 +185,9 @@ class StoragePool(_StorageObject):
|
|||
obj = StoragePool(conn)
|
||||
obj.type = pool_type
|
||||
obj.source_path = parseobj.source_path
|
||||
for host in parseobj.hosts:
|
||||
parseobj.remove_host(host)
|
||||
obj.add_host_obj(host)
|
||||
for h in parseobj.hosts:
|
||||
parseobj.remove_host(h)
|
||||
obj.add_host_obj(h)
|
||||
obj.source_name = parseobj.source_name
|
||||
obj.format = parseobj.format
|
||||
|
||||
|
|
|
@ -494,16 +494,15 @@ def getDistroStore(guest, fetcher):
|
|||
logging.debug("variant=%s has distro=%s, looking for matching "
|
||||
"distro store to prioritize",
|
||||
guest.os_variant, urldistro)
|
||||
found = False
|
||||
found_store = None
|
||||
for store in stores:
|
||||
if store.urldistro == urldistro:
|
||||
found = True
|
||||
break
|
||||
found_store = store
|
||||
|
||||
if found:
|
||||
logging.debug("Prioritizing distro store=%s", store)
|
||||
stores.remove(store)
|
||||
stores.insert(0, store)
|
||||
if found_store:
|
||||
logging.debug("Prioritizing distro store=%s", found_store)
|
||||
stores.remove(found_store)
|
||||
stores.insert(0, found_store)
|
||||
else:
|
||||
logging.debug("No matching store found, not prioritizing anything")
|
||||
|
||||
|
@ -782,8 +781,8 @@ class RedHatDistro(Distro):
|
|||
|
||||
def _get_method_arg(self):
|
||||
if (self._version_number is not None and
|
||||
((self.urldistro is "rhel" and self._version_number >= 7) or
|
||||
(self.urldistro is "fedora" and self._version_number >= 19))):
|
||||
((self.urldistro == "rhel" and self._version_number >= 7) or
|
||||
(self.urldistro == "fedora" and self._version_number >= 19))):
|
||||
return "inst.repo"
|
||||
return "method"
|
||||
|
||||
|
@ -1111,7 +1110,7 @@ class DebianDistro(Distro):
|
|||
for arch in ["i386", "amd64", "x86_64"]:
|
||||
if arch in self.uri:
|
||||
logging.debug("Found treearch=%s in uri", arch)
|
||||
if arch is "x86_64":
|
||||
if arch == "x86_64":
|
||||
arch = "amd64"
|
||||
return arch
|
||||
|
||||
|
|
Loading…
Reference in New Issue