diff --git a/tests/pylint.cfg b/tests/pylint.cfg index 3b29ec6a7..749fd278e 100644 --- a/tests/pylint.cfg +++ b/tests/pylint.cfg @@ -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=_ diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py index bc9b6e488..91706986b 100644 --- a/tests/xmlconfig.py +++ b/tests/xmlconfig.py @@ -126,11 +126,9 @@ class TestXMLMisc(unittest.TestCase): def testDefaultBridge(self): # Test our handling of the default bridge routines - origfunc = None + from virtinst import deviceinterface + origfunc = getattr(deviceinterface, "_default_bridge") try: - from virtinst import deviceinterface - origfunc = getattr(deviceinterface, "_default_bridge") - def newbridge(ignore_conn): return "bzz0" setattr(deviceinterface, "_default_bridge", newbridge) @@ -164,9 +162,7 @@ class TestXMLMisc(unittest.TestCase): " \n" "\n") finally: - if origfunc: - from virtinst import deviceinterface - setattr(deviceinterface, "_default_bridge", origfunc) + setattr(deviceinterface, "_default_bridge", origfunc) def testCpustrToTuple(self): # Various testing our cpustr handling diff --git a/virt-install b/virt-install index 4b0eec7ca..b4b8ee9a4 100755 --- a/virt-install +++ b/virt-install @@ -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 diff --git a/virt-xml b/virt-xml index 4c6ade4e1..59d6c4fe7 100755 --- a/virt-xml +++ b/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 diff --git a/virtManager/addstorage.py b/virtManager/addstorage.py index 1f827ddc3..81827c147 100644 --- a/virtManager/addstorage.py +++ b/virtManager/addstorage.py @@ -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) diff --git a/virtManager/connection.py b/virtManager/connection.py index 7e57a856b..55a111e44 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -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): diff --git a/virtManager/domain.py b/virtManager/domain.py index db64b2010..aedf3b26c 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -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): diff --git a/virtManager/uiutil.py b/virtManager/uiutil.py index ccab662b0..8b67fea56 100644 --- a/virtManager/uiutil.py +++ b/virtManager/uiutil.py @@ -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): diff --git a/virtManager/viewers.py b/virtManager/viewers.py index 322da3198..74c453912 100644 --- a/virtManager/viewers.py +++ b/virtManager/viewers.py @@ -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() diff --git a/virtinst/cli.py b/virtinst/cli.py index 6faef2b0c..176aedf43 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -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( diff --git a/virtinst/storage.py b/virtinst/storage.py index e958b1546..8733d87d4 100644 --- a/virtinst/storage.py +++ b/virtinst/storage.py @@ -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 diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py index 4abc83a34..5e10bb52b 100644 --- a/virtinst/urlfetcher.py +++ b/virtinst/urlfetcher.py @@ -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