diff --git a/.pylintrc b/.pylintrc index 4482f5d3..fe817833 100644 --- a/.pylintrc +++ b/.pylintrc @@ -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 diff --git a/tests/test_urls.py b/tests/test_urls.py index f1023fd5..e4d165db 100644 --- a/tests/test_urls.py +++ b/tests/test_urls.py @@ -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 diff --git a/virtManager/createvm.py b/virtManager/createvm.py index d3705508..a184f422 100644 --- a/virtManager/createvm.py +++ b/virtManager/createvm.py @@ -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()) diff --git a/virtManager/lib/keyring.py b/virtManager/lib/keyring.py index 1249c0cf..8c78b0e9 100644 --- a/virtManager/lib/keyring.py +++ b/virtManager/lib/keyring.py @@ -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(): diff --git a/virtManager/object/libvirtobject.py b/virtManager/object/libvirtobject.py index 70038980..bb22f8ae 100644 --- a/virtManager/object/libvirtobject.py +++ b/virtManager/object/libvirtobject.py @@ -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 diff --git a/virtManager/object/network.py b/virtManager/object/network.py index ce8c8286..da31c00a 100644 --- a/virtManager/object/network.py +++ b/virtManager/object/network.py @@ -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 = [] diff --git a/virtManager/object/storagepool.py b/virtManager/object/storagepool.py index 1d4bad61..4e1ac603 100644 --- a/virtManager/object/storagepool.py +++ b/virtManager/object/storagepool.py @@ -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() diff --git a/virtinst/cli.py b/virtinst/cli.py index d9dfe0bd..a03d680d 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -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: diff --git a/virtinst/connection.py b/virtinst/connection.py index 669cf715..68aef641 100644 --- a/virtinst/connection.py +++ b/virtinst/connection.py @@ -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: diff --git a/virtinst/install/urldetect.py b/virtinst/install/urldetect.py index f5ed0270..2fe2972f 100644 --- a/virtinst/install/urldetect.py +++ b/virtinst/install/urldetect.py @@ -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]) diff --git a/virtinst/install/urlfetcher.py b/virtinst/install/urlfetcher.py index cd1d8ca3..4bd89c50 100644 --- a/virtinst/install/urlfetcher.py +++ b/virtinst/install/urlfetcher.py @@ -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( diff --git a/virtinst/support.py b/virtinst/support.py index de73629e..5511bb7a 100644 --- a/virtinst/support.py +++ b/virtinst/support.py @@ -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 diff --git a/virtinst/virtinstall.py b/virtinst/virtinstall.py index 4fe40898..2bb52d78 100644 --- a/virtinst/virtinstall.py +++ b/virtinst/virtinstall.py @@ -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"