diff options
author | Cole Robinson <crobinso@redhat.com> | 2014-03-22 11:21:19 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2014-03-22 11:21:19 -0400 |
commit | 8562c3258e83cef5fe8f24386be58e73c8eda813 (patch) | |
tree | f537870da28756ac826517bb985a20a2afd36b27 | |
parent | d7631268628da1ae102414644add7979ded08bd7 (diff) | |
download | virt-manager-8562c3258e83cef5fe8f24386be58e73c8eda813.tar.gz |
More pylint fixes
-rw-r--r-- | tests/image.py | 1 | ||||
-rw-r--r-- | virtManager/asyncjob.py | 1 | ||||
-rw-r--r-- | virtManager/autodrawer.py | 3 | ||||
-rw-r--r-- | virtManager/baseclass.py | 3 | ||||
-rw-r--r-- | virtManager/connection.py | 6 | ||||
-rw-r--r-- | virtManager/console.py | 1 | ||||
-rw-r--r-- | virtManager/error.py | 1 | ||||
-rw-r--r-- | virtManager/graphwidgets.py | 3 | ||||
-rw-r--r-- | virtManager/systray.py | 10 | ||||
-rw-r--r-- | virtinst/nodedev.py | 14 |
10 files changed, 29 insertions, 14 deletions
diff --git a/tests/image.py b/tests/image.py index 6c2fadbe..f1d1e7c0 100644 --- a/tests/image.py +++ b/tests/image.py @@ -89,6 +89,7 @@ class TestImageParser(unittest.TestCase): g.os.arch = capsguest.arch g.installer = inst + # pylint: disable=unpacking-non-sequence ignore, actual_out = g.start_install(return_xml=True, dry=True) actual_out = g.get_install_xml(install=False) diff --git a/virtManager/asyncjob.py b/virtManager/asyncjob.py index 64a070ac..e3d14513 100644 --- a/virtManager/asyncjob.py +++ b/virtManager/asyncjob.py @@ -293,6 +293,7 @@ class vmmAsyncJob(vmmGObjectUI): error = None details = None if self._error_info: + # pylint: disable=unpacking-non-sequence error, details = self._error_info self._finish_cb(error, details, *self._finish_args) diff --git a/virtManager/autodrawer.py b/virtManager/autodrawer.py index 5ac76c97..1b586db1 100644 --- a/virtManager/autodrawer.py +++ b/virtManager/autodrawer.py @@ -34,6 +34,9 @@ from virtManager import uiutil # pylint can't detect functions we inheirit from Gtk, ex: # OverBox.set_over: Instance of 'OverBox' has no 'remove' member +# pylint: disable=arguments-differ +# Newer pylint can detect, but warns that overridden arguments are wrong + def rect_print(name, rect): # For debugging diff --git a/virtManager/baseclass.py b/virtManager/baseclass.py index a4285a7b..aed0c46c 100644 --- a/virtManager/baseclass.py +++ b/virtManager/baseclass.py @@ -85,6 +85,9 @@ class vmmGObject(GObject.GObject): def _cleanup(self): raise NotImplementedError("_cleanup must be implemented in subclass") + # pylint: disable=arguments-differ + # Newer pylint can detect, but warns that overridden arguments are wrong + def connect(self, name, callback, *args): ret = GObject.GObject.connect(self, name, callback, *args) self._gobject_handles.append(ret) diff --git a/virtManager/connection.py b/virtManager/connection.py index 4c034b83..07326cde 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -865,7 +865,7 @@ class vmmConnection(vmmGObject): if obj: self.idle_add(obj.force_update_status, True) - if event == libvirt.VIR_NETWORK_EVENT_DEFINED: + if event == getattr(libvirt, "VIR_NETWORK_EVENT_DEFINED", 0): self.idle_add(obj.refresh_xml) else: self.schedule_priority_tick(pollnet=True, force=True) @@ -882,9 +882,9 @@ class vmmConnection(vmmGObject): logging.debug("Error registering domain events: %s", e) try: + eventid = getattr(libvirt, "VIR_NETWORK_EVENT_ID_LIFECYCLE", 0) self._network_cb_id = self.get_backend().networkEventRegisterAny( - None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE, - self._network_lifecycle_event, None) + None, eventid, self._network_lifecycle_event, None) self.using_network_events = True logging.debug("Using network events") except Exception, e: diff --git a/virtManager/console.py b/virtManager/console.py index ee12390f..b9f98de5 100644 --- a/virtManager/console.py +++ b/virtManager/console.py @@ -1534,6 +1534,7 @@ class vmmConsolePages(vmmGObjectUI): dy = 0 align_ratio = float(req.width) / float(req.height) + # pylint: disable=unpacking-non-sequence desktop_w, desktop_h = self.viewer.get_desktop_resolution() if desktop_h == 0: return diff --git a/virtManager/error.py b/virtManager/error.py index c1186a2d..8a788ce2 100644 --- a/virtManager/error.py +++ b/virtManager/error.py @@ -194,6 +194,7 @@ class vmmErrorDialog(vmmGObject): if not do_prompt: return default + # pylint: disable=unpacking-non-sequence res = self.warn_chkbox(text1=text1, text2=text2, chktext=chktext, buttons=Gtk.ButtonsType.YES_NO) diff --git a/virtManager/graphwidgets.py b/virtManager/graphwidgets.py index 9742c205..5748dba2 100644 --- a/virtManager/graphwidgets.py +++ b/virtManager/graphwidgets.py @@ -25,6 +25,9 @@ from gi.repository import Gtk # pylint can't detect functions we inheirit from Gtk, ex: # Instance of 'Sparkline' has no 'get_style_context' member +# pylint: disable=arguments-differ +# Newer pylint can detect, but warns that overridden arguments are wrong + def rect_print(name, rect): # For debugging diff --git a/virtManager/systray.py b/virtManager/systray.py index b02142f1..c1c4bf40 100644 --- a/virtManager/systray.py +++ b/virtManager/systray.py @@ -132,6 +132,7 @@ class vmmSystray(vmmGObject): return if self.systray_indicator: + # pylint: disable=maybe-no-member self.systray_icon = AppIndicator3.Indicator.new("virt-manager", "virt-manager-icon", AppIndicator3.IndicatorCategory.OTHER) @@ -155,12 +156,11 @@ class vmmSystray(vmmGObject): self.init_systray() else: if self.systray_indicator: + # pylint: disable=maybe-no-member + status = AppIndicator3.IndicatorStatus.PASSIVE if do_show: - self.systray_icon.set_status( - AppIndicator3.IndicatorStatus.ACTIVE) - else: - self.systray_icon.set_status( - AppIndicator3.IndicatorStatus.PASSIVE) + status = AppIndicator3.IndicatorStatus.ACTIVE + self.systray_icon.set_status(status) else: self.systray_icon.set_visible(do_show) diff --git a/virtinst/nodedev.py b/virtinst/nodedev.py index 43c7f35a..af6dbf79 100644 --- a/virtinst/nodedev.py +++ b/virtinst/nodedev.py @@ -83,8 +83,9 @@ class NodeDevice(XMLBuilder): try: return _lookupNodeName(conn, name) except libvirt.libvirtError, e: - ret = _isAddressStr(name) - if not ret: + try: + _isAddressStr(name) + except: raise e return _devAddressToNodedev(conn, name) @@ -315,10 +316,10 @@ def _isAddressStr(addrstr): cmp_func = usbaddr_cmp addr_type = NodeDevice.HOSTDEV_ADDR_TYPE_USB_BUSADDR else: - return None + raise RuntimeError("Unknown address type") except: logging.exception("Error parsing node device string.") - return None + raise return cmp_func, devtype, addr_type @@ -335,8 +336,9 @@ def _devAddressToNodedev(conn, addrstr): - (domain:)bus:slot.func (ex. 00:10.0 for a pci device) @param addrstr: C{str} """ - ret = _isAddressStr(addrstr) - if not ret: + try: + ret = _isAddressStr(addrstr) + except: raise ValueError(_("Could not determine format of '%s'") % addrstr) cmp_func, devtype, addr_type = ret |