pycodestyle: fix all E125 warnings

Fix all E125:
     Continuation line with same indent as next logical line

   Also remove ignore options of E125

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
This commit is contained in:
Chen Hanxiao 2017-09-20 15:36:27 +08:00 committed by Chen Hanxiao
parent 999dbb3665
commit 7f1b4cee82
17 changed files with 58 additions and 59 deletions

View File

@ -9,7 +9,6 @@ format = pylint
# E122: Continuation line missing indentation or outdented # E122: Continuation line missing indentation or outdented
# E123: Closing bracket does not match indentation of opening # E123: Closing bracket does not match indentation of opening
# bracket's line # bracket's line
# E125: Continuation line with same indent as next logical line
# E126: Continuation line over-indented for hanging indent # E126: Continuation line over-indented for hanging indent
# E127: Continuation line over-indented for visual indent # E127: Continuation line over-indented for visual indent
# E128: Continuation line under-indented for visual indent # E128: Continuation line under-indented for visual indent
@ -25,4 +24,4 @@ format = pylint
# E741: Do not use variables named l, O, or I # E741: Do not use variables named l, O, or I
ignore = E122, E123, E125, E126, E127, E128, E129, E221, E241, E301, E303, E305, E306, E402, E501, E741 ignore = E122, E123, E126, E127, E128, E129, E221, E241, E301, E303, E305, E306, E402, E501, E741

View File

@ -256,7 +256,7 @@ def setup_device(dev):
def define_changes(conn, inactive_xmlobj, devs, action, confirm): def define_changes(conn, inactive_xmlobj, devs, action, confirm):
if confirm: if confirm:
if not prompt_yes_or_no( if not prompt_yes_or_no(
_("Define '%s' with the changed XML?") % inactive_xmlobj.name): _("Define '%s' with the changed XML?") % inactive_xmlobj.name):
return False return False
if action == "hotplug": if action == "hotplug":

View File

@ -539,13 +539,13 @@ class vmmConnection(vmmGObject):
inact = 0 inact = 0
if self.check_support( if self.check_support(
self._backend.SUPPORT_DOMAIN_XML_INACTIVE, vm): self._backend.SUPPORT_DOMAIN_XML_INACTIVE, vm):
inact = libvirt.VIR_DOMAIN_XML_INACTIVE inact = libvirt.VIR_DOMAIN_XML_INACTIVE
else: else:
logging.debug("Domain XML inactive flag not supported.") logging.debug("Domain XML inactive flag not supported.")
if self.check_support( if self.check_support(
self._backend.SUPPORT_DOMAIN_XML_SECURE, vm): self._backend.SUPPORT_DOMAIN_XML_SECURE, vm):
inact |= libvirt.VIR_DOMAIN_XML_SECURE inact |= libvirt.VIR_DOMAIN_XML_SECURE
act = libvirt.VIR_DOMAIN_XML_SECURE act = libvirt.VIR_DOMAIN_XML_SECURE
else: else:
@ -563,7 +563,7 @@ class vmmConnection(vmmGObject):
inact = 0 inact = 0
if self.check_support( if self.check_support(
self._backend.SUPPORT_INTERFACE_XML_INACTIVE, iface): self._backend.SUPPORT_INTERFACE_XML_INACTIVE, iface):
inact = libvirt.VIR_INTERFACE_XML_INACTIVE inact = libvirt.VIR_INTERFACE_XML_INACTIVE
else: else:
logging.debug("Interface XML inactive flag not supported.") logging.debug("Interface XML inactive flag not supported.")

View File

@ -1129,12 +1129,12 @@ class vmmDetails(vmmGObjectUI):
return False return False
if not self.err.chkbox_helper( if not self.err.chkbox_helper(
self.config.get_confirm_unapplied, self.config.get_confirm_unapplied,
self.config.set_confirm_unapplied, self.config.set_confirm_unapplied,
text1=(_("There are unapplied changes. Would you like to apply " text1=(_("There are unapplied changes. Would you like to apply "
"them now?")), "them now?")),
chktext=_("Don't warn me again."), chktext=_("Don't warn me again."),
default=False): default=False):
return False return False
return not self.config_apply(row=row) return not self.config_apply(row=row)
@ -2275,8 +2275,8 @@ class vmmDetails(vmmGObjectUI):
logging.debug("Removing device: %s", devobj) logging.debug("Removing device: %s", devobj)
if not self.err.chkbox_helper(self.config.get_confirm_removedev, if not self.err.chkbox_helper(self.config.get_confirm_removedev,
self.config.set_confirm_removedev, self.config.set_confirm_removedev,
text1=(_("Are you sure you want to remove this device?"))): text1=(_("Are you sure you want to remove this device?"))):
return return
# Define the change # Define the change

View File

@ -500,7 +500,7 @@ class vmmDomain(vmmLibvirtObject):
def snapshots_supported(self): def snapshots_supported(self):
if not self.conn.check_support( if not self.conn.check_support(
self.conn.SUPPORT_DOMAIN_LIST_SNAPSHOTS, self._backend): self.conn.SUPPORT_DOMAIN_LIST_SNAPSHOTS, self._backend):
return _("Libvirt connection does not support snapshots.") return _("Libvirt connection does not support snapshots.")
if self.list_snapshots(): if self.list_snapshots():
@ -644,8 +644,8 @@ class vmmDomain(vmmLibvirtObject):
self._redefine_xmlobj(xmlobj) self._redefine_xmlobj(xmlobj)
def define_cpu(self, vcpus=_SENTINEL, maxvcpus=_SENTINEL, def define_cpu(self, vcpus=_SENTINEL, maxvcpus=_SENTINEL,
model=_SENTINEL, sockets=_SENTINEL, model=_SENTINEL, sockets=_SENTINEL,
cores=_SENTINEL, threads=_SENTINEL): cores=_SENTINEL, threads=_SENTINEL):
guest = self._make_xmlobj_to_define() guest = self._make_xmlobj_to_define()
if vcpus != _SENTINEL: if vcpus != _SENTINEL:
@ -675,8 +675,8 @@ class vmmDomain(vmmLibvirtObject):
self._redefine_xmlobj(guest) self._redefine_xmlobj(guest)
def define_overview(self, machine=_SENTINEL, description=_SENTINEL, def define_overview(self, machine=_SENTINEL, description=_SENTINEL,
title=_SENTINEL, idmap_list=_SENTINEL, loader=_SENTINEL, title=_SENTINEL, idmap_list=_SENTINEL, loader=_SENTINEL,
nvram=_SENTINEL): nvram=_SENTINEL):
guest = self._make_xmlobj_to_define() guest = self._make_xmlobj_to_define()
if machine != _SENTINEL: if machine != _SENTINEL:
guest.os.machine = machine guest.os.machine = machine
@ -720,8 +720,8 @@ class vmmDomain(vmmLibvirtObject):
self._redefine_xmlobj(guest) self._redefine_xmlobj(guest)
def define_boot(self, boot_order=_SENTINEL, boot_menu=_SENTINEL, def define_boot(self, boot_order=_SENTINEL, boot_menu=_SENTINEL,
kernel=_SENTINEL, initrd=_SENTINEL, dtb=_SENTINEL, kernel=_SENTINEL, initrd=_SENTINEL, dtb=_SENTINEL,
kernel_args=_SENTINEL, init=_SENTINEL, initargs=_SENTINEL): kernel_args=_SENTINEL, init=_SENTINEL, initargs=_SENTINEL):
guest = self._make_xmlobj_to_define() guest = self._make_xmlobj_to_define()
def _change_boot_order(): def _change_boot_order():
@ -776,10 +776,10 @@ class vmmDomain(vmmLibvirtObject):
###################### ######################
def define_disk(self, devobj, do_hotplug, def define_disk(self, devobj, do_hotplug,
path=_SENTINEL, readonly=_SENTINEL, serial=_SENTINEL, path=_SENTINEL, readonly=_SENTINEL, serial=_SENTINEL,
shareable=_SENTINEL, removable=_SENTINEL, cache=_SENTINEL, shareable=_SENTINEL, removable=_SENTINEL, cache=_SENTINEL,
io=_SENTINEL, driver_type=_SENTINEL, bus=_SENTINEL, addrstr=_SENTINEL, io=_SENTINEL, driver_type=_SENTINEL, bus=_SENTINEL, addrstr=_SENTINEL,
sgio=_SENTINEL): sgio=_SENTINEL):
xmlobj = self._make_xmlobj_to_define() xmlobj = self._make_xmlobj_to_define()
editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug) editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
if not editdev: if not editdev:
@ -844,11 +844,11 @@ class vmmDomain(vmmLibvirtObject):
self._redefine_xmlobj(xmlobj) self._redefine_xmlobj(xmlobj)
def define_network(self, devobj, do_hotplug, def define_network(self, devobj, do_hotplug,
ntype=_SENTINEL, source=_SENTINEL, ntype=_SENTINEL, source=_SENTINEL,
mode=_SENTINEL, model=_SENTINEL, addrstr=_SENTINEL, mode=_SENTINEL, model=_SENTINEL, addrstr=_SENTINEL,
vtype=_SENTINEL, managerid=_SENTINEL, typeid=_SENTINEL, vtype=_SENTINEL, managerid=_SENTINEL, typeid=_SENTINEL,
typeidversion=_SENTINEL, instanceid=_SENTINEL, typeidversion=_SENTINEL, instanceid=_SENTINEL,
portgroup=_SENTINEL, macaddr=_SENTINEL): portgroup=_SENTINEL, macaddr=_SENTINEL):
xmlobj = self._make_xmlobj_to_define() xmlobj = self._make_xmlobj_to_define()
editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug) editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
if not editdev: if not editdev:
@ -884,9 +884,9 @@ class vmmDomain(vmmLibvirtObject):
self._redefine_xmlobj(xmlobj) self._redefine_xmlobj(xmlobj)
def define_graphics(self, devobj, do_hotplug, def define_graphics(self, devobj, do_hotplug,
listen=_SENTINEL, addr=_SENTINEL, port=_SENTINEL, tlsport=_SENTINEL, listen=_SENTINEL, addr=_SENTINEL, port=_SENTINEL, tlsport=_SENTINEL,
passwd=_SENTINEL, keymap=_SENTINEL, gtype=_SENTINEL, passwd=_SENTINEL, keymap=_SENTINEL, gtype=_SENTINEL,
gl=_SENTINEL, rendernode=_SENTINEL): gl=_SENTINEL, rendernode=_SENTINEL):
xmlobj = self._make_xmlobj_to_define() xmlobj = self._make_xmlobj_to_define()
editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug) editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
if not editdev: if not editdev:
@ -964,7 +964,7 @@ class vmmDomain(vmmLibvirtObject):
self._redefine_xmlobj(xmlobj) self._redefine_xmlobj(xmlobj)
def define_watchdog(self, devobj, do_hotplug, def define_watchdog(self, devobj, do_hotplug,
model=_SENTINEL, action=_SENTINEL): model=_SENTINEL, action=_SENTINEL):
xmlobj = self._make_xmlobj_to_define() xmlobj = self._make_xmlobj_to_define()
editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug) editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
if not editdev: if not editdev:
@ -1109,7 +1109,7 @@ class vmmDomain(vmmLibvirtObject):
self._backend.updateDeviceFlags(xml, flags) self._backend.updateDeviceFlags(xml, flags)
def hotplug(self, vcpus=_SENTINEL, memory=_SENTINEL, maxmem=_SENTINEL, def hotplug(self, vcpus=_SENTINEL, memory=_SENTINEL, maxmem=_SENTINEL,
description=_SENTINEL, title=_SENTINEL, device=_SENTINEL): description=_SENTINEL, title=_SENTINEL, device=_SENTINEL):
if not self.is_active(): if not self.is_active():
return return
@ -1570,7 +1570,7 @@ class vmmDomain(vmmLibvirtObject):
def migrate(self, destconn, dest_uri=None, def migrate(self, destconn, dest_uri=None,
tunnel=False, unsafe=False, temporary=False, meter=None): tunnel=False, unsafe=False, temporary=False, meter=None):
self._install_abort = True self._install_abort = True
flags = 0 flags = 0

View File

@ -1075,8 +1075,8 @@ class vmmEngine(vmmGObject):
vm = conn.get_vm(connkey) vm = conn.get_vm(connkey)
if not src.err.chkbox_helper(self.config.get_confirm_poweroff, if not src.err.chkbox_helper(self.config.get_confirm_poweroff,
self.config.set_confirm_poweroff, self.config.set_confirm_poweroff,
text1=_("Are you sure you want to save '%s'?") % vm.get_name()): text1=_("Are you sure you want to save '%s'?") % vm.get_name()):
return return
_cancel_cb = None _cancel_cb = None

View File

@ -129,7 +129,7 @@ class vmmNetworkList(vmmGObjectUI):
return ret return ret
def _build_source_row(self, nettype, source_name, def _build_source_row(self, nettype, source_name,
label, is_sensitive, is_running, manual_bridge=False, key=None): label, is_sensitive, is_running, manual_bridge=False, key=None):
return [nettype, source_name, label, return [nettype, source_name, label,
is_sensitive, is_running, manual_bridge, is_sensitive, is_running, manual_bridge,
key] key]

View File

@ -625,7 +625,7 @@ class SpiceViewer(Viewer):
self._main_channel_hids.append(hid) self._main_channel_hids.append(hid)
elif (type(channel) == SpiceClientGLib.DisplayChannel and elif (type(channel) == SpiceClientGLib.DisplayChannel and
not self._display): not self._display):
channel_id = channel.get_property("channel-id") channel_id = channel.get_property("channel-id")
if channel_id != 0: if channel_id != 0:
@ -640,7 +640,7 @@ class SpiceViewer(Viewer):
elif (type(channel) in [SpiceClientGLib.PlaybackChannel, elif (type(channel) in [SpiceClientGLib.PlaybackChannel,
SpiceClientGLib.RecordChannel] and SpiceClientGLib.RecordChannel] and
not self._audio): not self._audio):
self._audio = SpiceClientGLib.Audio.get(self._spice_session, None) self._audio = SpiceClientGLib.Audio.get(self._spice_session, None)
def _agent_connected_cb(self, src, val): def _agent_connected_cb(self, src, val):

View File

@ -96,7 +96,7 @@ class VMShutdownMenu(_VMMenu):
if name == "reset": if name == "reset":
child.set_tooltip_text(None) child.set_tooltip_text(None)
if vm and not vm.conn.check_support( if vm and not vm.conn.check_support(
vm.conn.SUPPORT_CONN_DOMAIN_RESET): vm.conn.SUPPORT_CONN_DOMAIN_RESET):
child.set_tooltip_text(_("Hypervisor does not support " child.set_tooltip_text(_("Hypervisor does not support "
"domain reset.")) "domain reset."))
child.set_sensitive(False) child.set_sensitive(False)

View File

@ -486,8 +486,8 @@ def get_console_cb(guest):
gtype = gdevs[0].type gtype = gdevs[0].type
if gtype not in ["default", if gtype not in ["default",
VirtualGraphics.TYPE_VNC, VirtualGraphics.TYPE_VNC,
VirtualGraphics.TYPE_SPICE]: VirtualGraphics.TYPE_SPICE]:
logging.debug("No viewer to launch for graphics type '%s'", gtype) logging.debug("No viewer to launch for graphics type '%s'", gtype)
return return

View File

@ -242,7 +242,7 @@ class VirtualGraphics(VirtualDevice):
self.socket = None self.socket = None
if self.conn.check_support( if self.conn.check_support(
self.conn.SUPPORT_CONN_GRAPHICS_LISTEN_NONE): self.conn.SUPPORT_CONN_GRAPHICS_LISTEN_NONE):
obj = self.add_listen() obj = self.add_listen()
obj.type = "none" obj.type = "none"

View File

@ -81,7 +81,7 @@ class DomainCapabilities(XMLBuilder):
def build_from_params(conn, emulator, arch, machine, hvtype): def build_from_params(conn, emulator, arch, machine, hvtype):
xml = None xml = None
if conn.check_support( if conn.check_support(
conn.SUPPORT_CONN_DOMAIN_CAPABILITIES): conn.SUPPORT_CONN_DOMAIN_CAPABILITIES):
try: try:
xml = conn.getDomainCapabilities(emulator, arch, xml = conn.getDomainCapabilities(emulator, arch,
machine, hvtype) machine, hvtype)

View File

@ -690,7 +690,7 @@ class Guest(XMLBuilder):
if usb2: if usb2:
if not self.conn.check_support( if not self.conn.check_support(
self.conn.SUPPORT_CONN_DEFAULT_USB2): self.conn.SUPPORT_CONN_DEFAULT_USB2):
return return
for dev in VirtualController.get_usb2_controllers(self.conn): for dev in VirtualController.get_usb2_controllers(self.conn):
self.add_device(dev) self.add_device(dev)
@ -830,7 +830,7 @@ class Guest(XMLBuilder):
if not self.os.is_x86(): if not self.os.is_x86():
return return
if not self.conn.check_support( if not self.conn.check_support(
self.conn.SUPPORT_CONN_ADVANCED_CLOCK): self.conn.SUPPORT_CONN_ADVANCED_CLOCK):
return return
# Set clock policy that maps to qemu options: # Set clock policy that maps to qemu options:

View File

@ -300,7 +300,7 @@ class _OsVariant(object):
######################## ########################
def _is_related_to(self, related_os_list, os=None, def _is_related_to(self, related_os_list, os=None,
check_derives=True, check_upgrades=True, check_clones=True): check_derives=True, check_upgrades=True, check_clones=True):
os = os or self._os os = os or self._os
if not os: if not os:
return False return False

View File

@ -115,7 +115,7 @@ def fetch_nets(backend, origmap, build_func):
name = "network" name = "network"
if backend.check_support( if backend.check_support(
backend.SUPPORT_CONN_LISTALLNETWORKS) and not FORCE_OLD_POLL: backend.SUPPORT_CONN_LISTALLNETWORKS) and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name, return _new_poll_helper(origmap, name,
backend.listAllNetworks, build_func) backend.listAllNetworks, build_func)
else: else:
@ -132,7 +132,7 @@ def fetch_pools(backend, origmap, build_func):
name = "pool" name = "pool"
if backend.check_support( if backend.check_support(
backend.SUPPORT_CONN_LISTALLSTORAGEPOOLS) and not FORCE_OLD_POLL: backend.SUPPORT_CONN_LISTALLSTORAGEPOOLS) and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name, return _new_poll_helper(origmap, name,
backend.listAllStoragePools, build_func) backend.listAllStoragePools, build_func)
else: else:
@ -149,7 +149,7 @@ def fetch_volumes(backend, pool, origmap, build_func):
name = "volume" name = "volume"
if backend.check_support( if backend.check_support(
backend.SUPPORT_POOL_LISTALLVOLUMES, pool) and not FORCE_OLD_POLL: backend.SUPPORT_POOL_LISTALLVOLUMES, pool) and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name, return _new_poll_helper(origmap, name,
pool.listAllVolumes, build_func) pool.listAllVolumes, build_func)
else: else:
@ -166,7 +166,7 @@ def fetch_interfaces(backend, origmap, build_func):
name = "interface" name = "interface"
if backend.check_support( if backend.check_support(
backend.SUPPORT_CONN_LISTALLINTERFACES) and not FORCE_OLD_POLL: backend.SUPPORT_CONN_LISTALLINTERFACES) and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name, return _new_poll_helper(origmap, name,
backend.listAllInterfaces, build_func) backend.listAllInterfaces, build_func)
else: else:
@ -182,7 +182,7 @@ def fetch_interfaces(backend, origmap, build_func):
def fetch_nodedevs(backend, origmap, build_func): def fetch_nodedevs(backend, origmap, build_func):
name = "nodedev" name = "nodedev"
if backend.check_support( if backend.check_support(
backend.SUPPORT_CONN_LISTALLDEVICES) and not FORCE_OLD_POLL: backend.SUPPORT_CONN_LISTALLDEVICES) and not FORCE_OLD_POLL:
return _new_poll_helper(origmap, name, return _new_poll_helper(origmap, name,
backend.listAllDevices, build_func) backend.listAllDevices, build_func)
else: else:
@ -278,7 +278,7 @@ def _old_fetch_vms(backend, origmap, build_func):
def fetch_vms(backend, origmap, build_func): def fetch_vms(backend, origmap, build_func):
name = "domain" name = "domain"
if backend.check_support( if backend.check_support(
backend.SUPPORT_CONN_LISTALLDOMAINS): backend.SUPPORT_CONN_LISTALLDOMAINS):
return _new_poll_helper(origmap, name, return _new_poll_helper(origmap, name,
backend.listAllDomains, build_func) backend.listAllDomains, build_func)
else: else:

View File

@ -375,8 +375,8 @@ class StoragePool(_StorageObject):
elif self.type == StoragePool.TYPE_GLUSTER: elif self.type == StoragePool.TYPE_GLUSTER:
srcname = "gv0" srcname = "gv0"
elif ("target_path" in self._propstore and elif ("target_path" in self._propstore and
self.target_path and self.target_path and
self.target_path.startswith(_DEFAULT_LVM_TARGET_BASE)): self.target_path.startswith(_DEFAULT_LVM_TARGET_BASE)):
# If there is a target path, parse it for an expected VG # If there is a target path, parse it for an expected VG
# location, and pull the name from there # location, and pull the name from there
vg = self.target_path[len(_DEFAULT_LVM_TARGET_BASE):] vg = self.target_path[len(_DEFAULT_LVM_TARGET_BASE):]
@ -642,7 +642,7 @@ class StorageVolume(_StorageObject):
raise ValueError(_("input_vol must be a virStorageVol")) raise ValueError(_("input_vol must be a virStorageVol"))
if not self.conn.check_support( if not self.conn.check_support(
self.conn.SUPPORT_POOL_CREATEVOLFROM, self.pool): self.conn.SUPPORT_POOL_CREATEVOLFROM, self.pool):
raise ValueError(_("Creating storage from an existing volume is" raise ValueError(_("Creating storage from an existing volume is"
" not supported by this libvirt version.")) " not supported by this libvirt version."))

View File

@ -448,7 +448,7 @@ def _distroFromSUSEContent(fetcher, arch, vmtype=None):
dclass = GenericDistro dclass = GenericDistro
if distribution: if distribution:
if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \ if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \
re.match(".*SUSE SLES*", distribution[1]): re.match(".*SUSE SLES*", distribution[1]):
dclass = SLESDistro dclass = SLESDistro
if distro_version is None: if distro_version is None:
distro_version = _parse_sle_distribution(distribution) distro_version = _parse_sle_distribution(distribution)