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.os.arch = capsguest.arch
|
||||||
|
|
||||||
g.installer = inst
|
g.installer = inst
|
||||||
|
# pylint: disable=unpacking-non-sequence
|
||||||
ignore, actual_out = g.start_install(return_xml=True, dry=True)
|
ignore, actual_out = g.start_install(return_xml=True, dry=True)
|
||||||
|
|
||||||
actual_out = g.get_install_xml(install=False)
|
actual_out = g.get_install_xml(install=False)
|
||||||
|
@ -293,6 +293,7 @@ class vmmAsyncJob(vmmGObjectUI):
|
|||||||
error = None
|
error = None
|
||||||
details = None
|
details = None
|
||||||
if self._error_info:
|
if self._error_info:
|
||||||
|
# pylint: disable=unpacking-non-sequence
|
||||||
error, details = self._error_info
|
error, details = self._error_info
|
||||||
self._finish_cb(error, details, *self._finish_args)
|
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:
|
# pylint can't detect functions we inheirit from Gtk, ex:
|
||||||
# OverBox.set_over: Instance of 'OverBox' has no 'remove' member
|
# 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):
|
def rect_print(name, rect):
|
||||||
# For debugging
|
# For debugging
|
||||||
|
@ -85,6 +85,9 @@ class vmmGObject(GObject.GObject):
|
|||||||
def _cleanup(self):
|
def _cleanup(self):
|
||||||
raise NotImplementedError("_cleanup must be implemented in subclass")
|
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):
|
def connect(self, name, callback, *args):
|
||||||
ret = GObject.GObject.connect(self, name, callback, *args)
|
ret = GObject.GObject.connect(self, name, callback, *args)
|
||||||
self._gobject_handles.append(ret)
|
self._gobject_handles.append(ret)
|
||||||
|
@ -865,7 +865,7 @@ class vmmConnection(vmmGObject):
|
|||||||
if obj:
|
if obj:
|
||||||
self.idle_add(obj.force_update_status, True)
|
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)
|
self.idle_add(obj.refresh_xml)
|
||||||
else:
|
else:
|
||||||
self.schedule_priority_tick(pollnet=True, force=True)
|
self.schedule_priority_tick(pollnet=True, force=True)
|
||||||
@ -882,9 +882,9 @@ class vmmConnection(vmmGObject):
|
|||||||
logging.debug("Error registering domain events: %s", e)
|
logging.debug("Error registering domain events: %s", e)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
eventid = getattr(libvirt, "VIR_NETWORK_EVENT_ID_LIFECYCLE", 0)
|
||||||
self._network_cb_id = self.get_backend().networkEventRegisterAny(
|
self._network_cb_id = self.get_backend().networkEventRegisterAny(
|
||||||
None, libvirt.VIR_NETWORK_EVENT_ID_LIFECYCLE,
|
None, eventid, self._network_lifecycle_event, None)
|
||||||
self._network_lifecycle_event, None)
|
|
||||||
self.using_network_events = True
|
self.using_network_events = True
|
||||||
logging.debug("Using network events")
|
logging.debug("Using network events")
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
@ -1534,6 +1534,7 @@ class vmmConsolePages(vmmGObjectUI):
|
|||||||
dy = 0
|
dy = 0
|
||||||
align_ratio = float(req.width) / float(req.height)
|
align_ratio = float(req.width) / float(req.height)
|
||||||
|
|
||||||
|
# pylint: disable=unpacking-non-sequence
|
||||||
desktop_w, desktop_h = self.viewer.get_desktop_resolution()
|
desktop_w, desktop_h = self.viewer.get_desktop_resolution()
|
||||||
if desktop_h == 0:
|
if desktop_h == 0:
|
||||||
return
|
return
|
||||||
|
@ -194,6 +194,7 @@ class vmmErrorDialog(vmmGObject):
|
|||||||
if not do_prompt:
|
if not do_prompt:
|
||||||
return default
|
return default
|
||||||
|
|
||||||
|
# pylint: disable=unpacking-non-sequence
|
||||||
res = self.warn_chkbox(text1=text1, text2=text2,
|
res = self.warn_chkbox(text1=text1, text2=text2,
|
||||||
chktext=chktext,
|
chktext=chktext,
|
||||||
buttons=Gtk.ButtonsType.YES_NO)
|
buttons=Gtk.ButtonsType.YES_NO)
|
||||||
|
@ -25,6 +25,9 @@ from gi.repository import Gtk
|
|||||||
# pylint can't detect functions we inheirit from Gtk, ex:
|
# pylint can't detect functions we inheirit from Gtk, ex:
|
||||||
# Instance of 'Sparkline' has no 'get_style_context' member
|
# 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):
|
def rect_print(name, rect):
|
||||||
# For debugging
|
# For debugging
|
||||||
|
@ -132,6 +132,7 @@ class vmmSystray(vmmGObject):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if self.systray_indicator:
|
if self.systray_indicator:
|
||||||
|
# pylint: disable=maybe-no-member
|
||||||
self.systray_icon = AppIndicator3.Indicator.new("virt-manager",
|
self.systray_icon = AppIndicator3.Indicator.new("virt-manager",
|
||||||
"virt-manager-icon",
|
"virt-manager-icon",
|
||||||
AppIndicator3.IndicatorCategory.OTHER)
|
AppIndicator3.IndicatorCategory.OTHER)
|
||||||
@ -155,12 +156,11 @@ class vmmSystray(vmmGObject):
|
|||||||
self.init_systray()
|
self.init_systray()
|
||||||
else:
|
else:
|
||||||
if self.systray_indicator:
|
if self.systray_indicator:
|
||||||
|
# pylint: disable=maybe-no-member
|
||||||
|
status = AppIndicator3.IndicatorStatus.PASSIVE
|
||||||
if do_show:
|
if do_show:
|
||||||
self.systray_icon.set_status(
|
status = AppIndicator3.IndicatorStatus.ACTIVE
|
||||||
AppIndicator3.IndicatorStatus.ACTIVE)
|
self.systray_icon.set_status(status)
|
||||||
else:
|
|
||||||
self.systray_icon.set_status(
|
|
||||||
AppIndicator3.IndicatorStatus.PASSIVE)
|
|
||||||
else:
|
else:
|
||||||
self.systray_icon.set_visible(do_show)
|
self.systray_icon.set_visible(do_show)
|
||||||
|
|
||||||
|
@ -83,8 +83,9 @@ class NodeDevice(XMLBuilder):
|
|||||||
try:
|
try:
|
||||||
return _lookupNodeName(conn, name)
|
return _lookupNodeName(conn, name)
|
||||||
except libvirt.libvirtError, e:
|
except libvirt.libvirtError, e:
|
||||||
ret = _isAddressStr(name)
|
try:
|
||||||
if not ret:
|
_isAddressStr(name)
|
||||||
|
except:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
return _devAddressToNodedev(conn, name)
|
return _devAddressToNodedev(conn, name)
|
||||||
@ -315,10 +316,10 @@ def _isAddressStr(addrstr):
|
|||||||
cmp_func = usbaddr_cmp
|
cmp_func = usbaddr_cmp
|
||||||
addr_type = NodeDevice.HOSTDEV_ADDR_TYPE_USB_BUSADDR
|
addr_type = NodeDevice.HOSTDEV_ADDR_TYPE_USB_BUSADDR
|
||||||
else:
|
else:
|
||||||
return None
|
raise RuntimeError("Unknown address type")
|
||||||
except:
|
except:
|
||||||
logging.exception("Error parsing node device string.")
|
logging.exception("Error parsing node device string.")
|
||||||
return None
|
raise
|
||||||
|
|
||||||
return cmp_func, devtype, addr_type
|
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)
|
- (domain:)bus:slot.func (ex. 00:10.0 for a pci device)
|
||||||
@param addrstr: C{str}
|
@param addrstr: C{str}
|
||||||
"""
|
"""
|
||||||
ret = _isAddressStr(addrstr)
|
try:
|
||||||
if not ret:
|
ret = _isAddressStr(addrstr)
|
||||||
|
except:
|
||||||
raise ValueError(_("Could not determine format of '%s'") % addrstr)
|
raise ValueError(_("Could not determine format of '%s'") % addrstr)
|
||||||
|
|
||||||
cmp_func, devtype, addr_type = ret
|
cmp_func, devtype, addr_type = ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user