mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 17:57:34 +03:00
More pylint fixes
This commit is contained in:
parent
d763126862
commit
8562c3258e
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user