Fix some pylint, exclude some new warnings

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2021-10-04 15:38:24 -04:00
parent cb97f6001b
commit 79da19ad07
13 changed files with 16 additions and 17 deletions

View File

@ -3,7 +3,7 @@
# 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,consider-using-ternary,no-else-return,len-as-condition,inconsistent-return-statements,useless-object-inheritance,consider-using-in,useless-return,assignment-from-none,chained-comparison,import-outside-toplevel,use-a-generator,consider-using-with
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,inconsistent-return-statements,useless-object-inheritance,consider-using-in,useless-return,assignment-from-none,chained-comparison,import-outside-toplevel,use-a-generator,consider-using-with,consider-using-f-string,unspecified-encoding,use-maxsplit-arg
enable=fixme

View File

@ -154,8 +154,8 @@ def _testGuest(testdata, guest):
# to fetch files for that part
treemedia = installer._treemedia # pylint: disable=protected-access
fetcher = treemedia._cached_fetcher # pylint: disable=protected-access
def fakeAcquireFile(filename):
log.debug("Fake acquiring %s", filename)
def fakeAcquireFile(filename, fullurl=None):
log.debug("Fake acquiring filename=%s fullurl=%s", filename, fullurl)
return filename
fetcher.acquireFile = fakeAcquireFile

View File

@ -633,8 +633,8 @@ class vmmCreateVM(vmmGObjectUI):
"install-oscontainer-source": vb_enabled,
"install-oscontainer-rootpw-box": vb_enabled
}
for w in oscontainer_widget_conf:
self.widget(w).set_visible(oscontainer_widget_conf[w])
for wname, val in oscontainer_widget_conf.items():
self.widget(wname).set_visible(val)
# Memory
memory = int(self.conn.host_memory_size())

View File

@ -129,7 +129,7 @@ class vmmKeyring(vmmGObject):
label = iface.get_cached_property("Label").unpack().strip("'")
dbusattrs = iface.get_cached_property("Attributes").unpack()
secret = u"".join([chr(c) for c in secretbytes])
secret = "".join([chr(c) for c in secretbytes])
attrs = {}
for key, val in dbusattrs.items():

View File

@ -97,10 +97,9 @@ class vmmLibvirtObject(vmmGObject):
return self.class_name() == "nodedev"
def get_autostart(self): # pragma: no cover
pass
return False
def set_autostart(self, val): # pragma: no cover
ignore = val
pass
def change_name_backend(self, newbackend):
# Used for changing the backing object after a rename

View File

@ -85,8 +85,8 @@ class vmmNetwork(vmmLibvirtObject):
def get_autostart(self):
return self._backend.autostart()
def set_autostart(self, value):
self._backend.setAutostart(value)
def set_autostart(self, val):
self._backend.setAutostart(val)
def _refresh_dhcp_leases(self):
ret = []

View File

@ -270,8 +270,8 @@ class vmmStoragePool(vmmLibvirtObject):
# XML/config operations #
#########################
def set_autostart(self, value):
self._backend.setAutostart(value)
def set_autostart(self, val):
self._backend.setAutostart(val)
def get_autostart(self):
return self._backend.autostart()

View File

@ -966,7 +966,7 @@ def _on_off_convert(key, val):
val = _raw_on_off_convert(val)
if val is not None:
return val
raise fail(_("%(key)s must be 'yes' or 'no'") % {"key": key})
fail(_("%(key)s must be 'yes' or 'no'") % {"key": key})
class _SuboptCheckerClass:

View File

@ -222,7 +222,7 @@ class VirtinstConnection(object):
# TOCTOU race: a volume may go away in between enumeration and inspection
try:
pool = self._libvirtconn.storagePoolLookupByName(poolxmlobj.name)
except libvirt.libvirtError as e: # pragma: no cover
except libvirt.libvirtError: # pragma: no cover
return ret
if pool.info()[0] != libvirt.VIR_STORAGE_POOL_RUNNING:

View File

@ -141,6 +141,7 @@ class _DistroCache(object):
update = 0
version = _safeint(verstr)
if verstr.count(".") >= 1:
# pylint: disable=no-member
version = _safeint(verstr.split(".")[0])
update = _safeint(verstr.split(".")[1])

View File

@ -179,7 +179,6 @@ class _URLFetcher(object):
Grab the passed filename from self.location and save it to
a temporary file, returning the temp filename
"""
# pylint: disable=redefined-variable-type
fn = None
try:
fileobj = tempfile.NamedTemporaryFile(

View File

@ -52,7 +52,7 @@ def _check_function(function, flag, run_args, data):
return False
if bool(flag_tuple): # pragma: no cover
return False
except Exception as e: # pragma: no cover
except Exception: # pragma: no cover
# Other python exceptions likely mean the bindings are horked
return False
return True

View File

@ -73,7 +73,7 @@ def convert_old_printxml(options):
def convert_old_sound(options):
if not options.sound:
return
for idx in range(len(options.sound)):
for idx, dummy in enumerate(options.sound):
if options.sound[idx] is None:
options.sound[idx] = "default"