[virt-tools-list] [virt-manager PATCH] pycodestyle: fix all E125 warnings

Chen Hanxiao chen_han_xiao at 126.com
Wed Sep 20 08:06:49 UTC 2017


From: Chen Hanxiao <chenhanxiao at gmail.com>

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

   Also remove ignore options of E125

Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
---
 tests/pycodestyle.cfg       |  3 +--
 virt-xml                    |  2 +-
 virtManager/connection.py   |  6 +++---
 virtManager/details.py      | 16 ++++++++--------
 virtManager/domain.py       | 44 ++++++++++++++++++++++----------------------
 virtManager/engine.py       |  4 ++--
 virtManager/netlist.py      |  2 +-
 virtManager/viewers.py      |  4 ++--
 virtManager/vmmenu.py       |  2 +-
 virtinst/cli.py             |  4 ++--
 virtinst/devicegraphics.py  |  2 +-
 virtinst/domcapabilities.py |  2 +-
 virtinst/guest.py           |  4 ++--
 virtinst/osdict.py          |  2 +-
 virtinst/pollhelpers.py     | 12 ++++++------
 virtinst/storage.py         |  6 +++---
 virtinst/urlfetcher.py      |  2 +-
 17 files changed, 58 insertions(+), 59 deletions(-)

diff --git a/tests/pycodestyle.cfg b/tests/pycodestyle.cfg
index 38584d8..e3d052c 100644
--- a/tests/pycodestyle.cfg
+++ b/tests/pycodestyle.cfg
@@ -10,7 +10,6 @@ format = pylint
 # E122: Continuation line missing indentation or outdented
 # E123: Closing bracket does not match indentation of opening
 #       bracket's line
-# E125: Continuation line with same indent as next logical line
 # E126: Continuation line over-indented for hanging indent
 # E127: Continuation line over-indented for visual indent
 # E128: Continuation line under-indented for visual indent
@@ -27,4 +26,4 @@ format = pylint
 # 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
diff --git a/virt-xml b/virt-xml
index 59d6c4f..750498b 100755
--- a/virt-xml
+++ b/virt-xml
@@ -256,7 +256,7 @@ def setup_device(dev):
 def define_changes(conn, inactive_xmlobj, devs, action, confirm):
     if confirm:
         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
 
     if action == "hotplug":
diff --git a/virtManager/connection.py b/virtManager/connection.py
index 70da922..f89e9d3 100644
--- a/virtManager/connection.py
+++ b/virtManager/connection.py
@@ -539,13 +539,13 @@ class vmmConnection(vmmGObject):
             inact = 0
 
             if self.check_support(
-                self._backend.SUPPORT_DOMAIN_XML_INACTIVE, vm):
+                    self._backend.SUPPORT_DOMAIN_XML_INACTIVE, vm):
                 inact = libvirt.VIR_DOMAIN_XML_INACTIVE
             else:
                 logging.debug("Domain XML inactive flag not supported.")
 
             if self.check_support(
-                self._backend.SUPPORT_DOMAIN_XML_SECURE, vm):
+                    self._backend.SUPPORT_DOMAIN_XML_SECURE, vm):
                 inact |= libvirt.VIR_DOMAIN_XML_SECURE
                 act = libvirt.VIR_DOMAIN_XML_SECURE
             else:
@@ -563,7 +563,7 @@ class vmmConnection(vmmGObject):
             inact = 0
 
             if self.check_support(
-                self._backend.SUPPORT_INTERFACE_XML_INACTIVE, iface):
+                    self._backend.SUPPORT_INTERFACE_XML_INACTIVE, iface):
                 inact = libvirt.VIR_INTERFACE_XML_INACTIVE
             else:
                 logging.debug("Interface XML inactive flag not supported.")
diff --git a/virtManager/details.py b/virtManager/details.py
index e74ea5f..8e0bcb2 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -1129,12 +1129,12 @@ class vmmDetails(vmmGObjectUI):
             return False
 
         if not self.err.chkbox_helper(
-            self.config.get_confirm_unapplied,
-            self.config.set_confirm_unapplied,
-            text1=(_("There are unapplied changes. Would you like to apply "
-                     "them now?")),
-            chktext=_("Don't warn me again."),
-            default=False):
+                self.config.get_confirm_unapplied,
+                self.config.set_confirm_unapplied,
+                text1=(_("There are unapplied changes. Would you like to apply "
+                    "them now?")),
+                chktext=_("Don't warn me again."),
+                default=False):
             return False
 
         return not self.config_apply(row=row)
@@ -2275,8 +2275,8 @@ class vmmDetails(vmmGObjectUI):
         logging.debug("Removing device: %s", devobj)
 
         if not self.err.chkbox_helper(self.config.get_confirm_removedev,
-            self.config.set_confirm_removedev,
-            text1=(_("Are you sure you want to remove this device?"))):
+                self.config.set_confirm_removedev,
+                text1=(_("Are you sure you want to remove this device?"))):
             return
 
         # Define the change
diff --git a/virtManager/domain.py b/virtManager/domain.py
index 6fb54bc..cd9b3af 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -500,7 +500,7 @@ class vmmDomain(vmmLibvirtObject):
 
     def snapshots_supported(self):
         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.")
 
         if self.list_snapshots():
@@ -644,8 +644,8 @@ class vmmDomain(vmmLibvirtObject):
         self._redefine_xmlobj(xmlobj)
 
     def define_cpu(self, vcpus=_SENTINEL, maxvcpus=_SENTINEL,
-        model=_SENTINEL, sockets=_SENTINEL,
-        cores=_SENTINEL, threads=_SENTINEL):
+            model=_SENTINEL, sockets=_SENTINEL,
+            cores=_SENTINEL, threads=_SENTINEL):
         guest = self._make_xmlobj_to_define()
 
         if vcpus != _SENTINEL:
@@ -675,8 +675,8 @@ class vmmDomain(vmmLibvirtObject):
         self._redefine_xmlobj(guest)
 
     def define_overview(self, machine=_SENTINEL, description=_SENTINEL,
-        title=_SENTINEL, idmap_list=_SENTINEL, loader=_SENTINEL,
-        nvram=_SENTINEL):
+            title=_SENTINEL, idmap_list=_SENTINEL, loader=_SENTINEL,
+            nvram=_SENTINEL):
         guest = self._make_xmlobj_to_define()
         if machine != _SENTINEL:
             guest.os.machine = machine
@@ -720,8 +720,8 @@ class vmmDomain(vmmLibvirtObject):
         self._redefine_xmlobj(guest)
 
     def define_boot(self, boot_order=_SENTINEL, boot_menu=_SENTINEL,
-        kernel=_SENTINEL, initrd=_SENTINEL, dtb=_SENTINEL,
-        kernel_args=_SENTINEL, init=_SENTINEL, initargs=_SENTINEL):
+            kernel=_SENTINEL, initrd=_SENTINEL, dtb=_SENTINEL,
+            kernel_args=_SENTINEL, init=_SENTINEL, initargs=_SENTINEL):
 
         guest = self._make_xmlobj_to_define()
         def _change_boot_order():
@@ -776,10 +776,10 @@ class vmmDomain(vmmLibvirtObject):
     ######################
 
     def define_disk(self, devobj, do_hotplug,
-        path=_SENTINEL, readonly=_SENTINEL, serial=_SENTINEL,
-        shareable=_SENTINEL, removable=_SENTINEL, cache=_SENTINEL,
-        io=_SENTINEL, driver_type=_SENTINEL, bus=_SENTINEL, addrstr=_SENTINEL,
-        sgio=_SENTINEL):
+            path=_SENTINEL, readonly=_SENTINEL, serial=_SENTINEL,
+            shareable=_SENTINEL, removable=_SENTINEL, cache=_SENTINEL,
+            io=_SENTINEL, driver_type=_SENTINEL, bus=_SENTINEL, addrstr=_SENTINEL,
+            sgio=_SENTINEL):
         xmlobj = self._make_xmlobj_to_define()
         editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
         if not editdev:
@@ -844,11 +844,11 @@ class vmmDomain(vmmLibvirtObject):
             self._redefine_xmlobj(xmlobj)
 
     def define_network(self, devobj, do_hotplug,
-        ntype=_SENTINEL, source=_SENTINEL,
-        mode=_SENTINEL, model=_SENTINEL, addrstr=_SENTINEL,
-        vtype=_SENTINEL, managerid=_SENTINEL, typeid=_SENTINEL,
-        typeidversion=_SENTINEL, instanceid=_SENTINEL,
-        portgroup=_SENTINEL, macaddr=_SENTINEL):
+            ntype=_SENTINEL, source=_SENTINEL,
+            mode=_SENTINEL, model=_SENTINEL, addrstr=_SENTINEL,
+            vtype=_SENTINEL, managerid=_SENTINEL, typeid=_SENTINEL,
+            typeidversion=_SENTINEL, instanceid=_SENTINEL,
+            portgroup=_SENTINEL, macaddr=_SENTINEL):
         xmlobj = self._make_xmlobj_to_define()
         editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
         if not editdev:
@@ -884,9 +884,9 @@ class vmmDomain(vmmLibvirtObject):
             self._redefine_xmlobj(xmlobj)
 
     def define_graphics(self, devobj, do_hotplug,
-        listen=_SENTINEL, addr=_SENTINEL, port=_SENTINEL, tlsport=_SENTINEL,
-        passwd=_SENTINEL, keymap=_SENTINEL, gtype=_SENTINEL,
-        gl=_SENTINEL, rendernode=_SENTINEL):
+            listen=_SENTINEL, addr=_SENTINEL, port=_SENTINEL, tlsport=_SENTINEL,
+            passwd=_SENTINEL, keymap=_SENTINEL, gtype=_SENTINEL,
+            gl=_SENTINEL, rendernode=_SENTINEL):
         xmlobj = self._make_xmlobj_to_define()
         editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
         if not editdev:
@@ -964,7 +964,7 @@ class vmmDomain(vmmLibvirtObject):
             self._redefine_xmlobj(xmlobj)
 
     def define_watchdog(self, devobj, do_hotplug,
-        model=_SENTINEL, action=_SENTINEL):
+            model=_SENTINEL, action=_SENTINEL):
         xmlobj = self._make_xmlobj_to_define()
         editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug)
         if not editdev:
@@ -1109,7 +1109,7 @@ class vmmDomain(vmmLibvirtObject):
         self._backend.updateDeviceFlags(xml, flags)
 
     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():
             return
 
@@ -1570,7 +1570,7 @@ class vmmDomain(vmmLibvirtObject):
 
 
     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
 
         flags = 0
diff --git a/virtManager/engine.py b/virtManager/engine.py
index 262375e..5638131 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -1075,8 +1075,8 @@ class vmmEngine(vmmGObject):
         vm = conn.get_vm(connkey)
 
         if not src.err.chkbox_helper(self.config.get_confirm_poweroff,
-            self.config.set_confirm_poweroff,
-            text1=_("Are you sure you want to save '%s'?") % vm.get_name()):
+                self.config.set_confirm_poweroff,
+                text1=_("Are you sure you want to save '%s'?") % vm.get_name()):
             return
 
         _cancel_cb = None
diff --git a/virtManager/netlist.py b/virtManager/netlist.py
index 772e988..31717d8 100644
--- a/virtManager/netlist.py
+++ b/virtManager/netlist.py
@@ -129,7 +129,7 @@ class vmmNetworkList(vmmGObjectUI):
         return ret
 
     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,
                 is_sensitive, is_running, manual_bridge,
                 key]
diff --git a/virtManager/viewers.py b/virtManager/viewers.py
index 80bdb08..cc9791a 100644
--- a/virtManager/viewers.py
+++ b/virtManager/viewers.py
@@ -625,7 +625,7 @@ class SpiceViewer(Viewer):
             self._main_channel_hids.append(hid)
 
         elif (type(channel) == SpiceClientGLib.DisplayChannel and
-            not self._display):
+                not self._display):
             channel_id = channel.get_property("channel-id")
 
             if channel_id != 0:
@@ -640,7 +640,7 @@ class SpiceViewer(Viewer):
 
         elif (type(channel) in [SpiceClientGLib.PlaybackChannel,
                                 SpiceClientGLib.RecordChannel] and
-            not self._audio):
+                                not self._audio):
             self._audio = SpiceClientGLib.Audio.get(self._spice_session, None)
 
     def _agent_connected_cb(self, src, val):
diff --git a/virtManager/vmmenu.py b/virtManager/vmmenu.py
index bb23360..153c852 100644
--- a/virtManager/vmmenu.py
+++ b/virtManager/vmmenu.py
@@ -96,7 +96,7 @@ class VMShutdownMenu(_VMMenu):
             if name == "reset":
                 child.set_tooltip_text(None)
                 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 "
                         "domain reset."))
                     child.set_sensitive(False)
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 17a2e70..e4cedd4 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -486,8 +486,8 @@ def get_console_cb(guest):
 
     gtype = gdevs[0].type
     if gtype not in ["default",
-        VirtualGraphics.TYPE_VNC,
-        VirtualGraphics.TYPE_SPICE]:
+            VirtualGraphics.TYPE_VNC,
+            VirtualGraphics.TYPE_SPICE]:
         logging.debug("No viewer to launch for graphics type '%s'", gtype)
         return
 
diff --git a/virtinst/devicegraphics.py b/virtinst/devicegraphics.py
index dc6919e..ffba36d 100644
--- a/virtinst/devicegraphics.py
+++ b/virtinst/devicegraphics.py
@@ -242,7 +242,7 @@ class VirtualGraphics(VirtualDevice):
         self.socket = None
 
         if self.conn.check_support(
-            self.conn.SUPPORT_CONN_GRAPHICS_LISTEN_NONE):
+                self.conn.SUPPORT_CONN_GRAPHICS_LISTEN_NONE):
             obj = self.add_listen()
             obj.type = "none"
 
diff --git a/virtinst/domcapabilities.py b/virtinst/domcapabilities.py
index 3629afe..be2281a 100644
--- a/virtinst/domcapabilities.py
+++ b/virtinst/domcapabilities.py
@@ -81,7 +81,7 @@ class DomainCapabilities(XMLBuilder):
     def build_from_params(conn, emulator, arch, machine, hvtype):
         xml = None
         if conn.check_support(
-            conn.SUPPORT_CONN_DOMAIN_CAPABILITIES):
+                conn.SUPPORT_CONN_DOMAIN_CAPABILITIES):
             try:
                 xml = conn.getDomainCapabilities(emulator, arch,
                     machine, hvtype)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index 143a36f..eaf83ff 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -690,7 +690,7 @@ class Guest(XMLBuilder):
 
         if usb2:
             if not self.conn.check_support(
-                self.conn.SUPPORT_CONN_DEFAULT_USB2):
+                    self.conn.SUPPORT_CONN_DEFAULT_USB2):
                 return
             for dev in VirtualController.get_usb2_controllers(self.conn):
                 self.add_device(dev)
@@ -830,7 +830,7 @@ class Guest(XMLBuilder):
         if not self.os.is_x86():
             return
         if not self.conn.check_support(
-            self.conn.SUPPORT_CONN_ADVANCED_CLOCK):
+                self.conn.SUPPORT_CONN_ADVANCED_CLOCK):
             return
 
         # Set clock policy that maps to qemu options:
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
index 429f800..c173554 100644
--- a/virtinst/osdict.py
+++ b/virtinst/osdict.py
@@ -300,7 +300,7 @@ class _OsVariant(object):
     ########################
 
     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
         if not os:
             return False
diff --git a/virtinst/pollhelpers.py b/virtinst/pollhelpers.py
index fd156bb..64cdb32 100644
--- a/virtinst/pollhelpers.py
+++ b/virtinst/pollhelpers.py
@@ -115,7 +115,7 @@ def fetch_nets(backend, origmap, build_func):
     name = "network"
 
     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,
                                 backend.listAllNetworks, build_func)
     else:
@@ -132,7 +132,7 @@ def fetch_pools(backend, origmap, build_func):
     name = "pool"
 
     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,
                                 backend.listAllStoragePools, build_func)
     else:
@@ -149,7 +149,7 @@ def fetch_volumes(backend, pool, origmap, build_func):
     name = "volume"
 
     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,
                                 pool.listAllVolumes, build_func)
     else:
@@ -166,7 +166,7 @@ def fetch_interfaces(backend, origmap, build_func):
     name = "interface"
 
     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,
                                 backend.listAllInterfaces, build_func)
     else:
@@ -182,7 +182,7 @@ def fetch_interfaces(backend, origmap, build_func):
 def fetch_nodedevs(backend, origmap, build_func):
     name = "nodedev"
     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,
                                 backend.listAllDevices, build_func)
     else:
@@ -278,7 +278,7 @@ def _old_fetch_vms(backend, origmap, build_func):
 def fetch_vms(backend, origmap, build_func):
     name = "domain"
     if backend.check_support(
-        backend.SUPPORT_CONN_LISTALLDOMAINS):
+            backend.SUPPORT_CONN_LISTALLDOMAINS):
         return _new_poll_helper(origmap, name,
                                 backend.listAllDomains, build_func)
     else:
diff --git a/virtinst/storage.py b/virtinst/storage.py
index 3f1bd9f..254e7ff 100644
--- a/virtinst/storage.py
+++ b/virtinst/storage.py
@@ -375,8 +375,8 @@ class StoragePool(_StorageObject):
         elif self.type == StoragePool.TYPE_GLUSTER:
             srcname = "gv0"
         elif ("target_path" in self._propstore and
-            self.target_path and
-            self.target_path.startswith(_DEFAULT_LVM_TARGET_BASE)):
+                self.target_path and
+                self.target_path.startswith(_DEFAULT_LVM_TARGET_BASE)):
             # If there is a target path, parse it for an expected VG
             # location, and pull the name from there
             vg = self.target_path[len(_DEFAULT_LVM_TARGET_BASE):]
@@ -642,7 +642,7 @@ class StorageVolume(_StorageObject):
             raise ValueError(_("input_vol must be a virStorageVol"))
 
         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"
                                " not supported by this libvirt version."))
 
diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
index ef3e18e..a90398c 100644
--- a/virtinst/urlfetcher.py
+++ b/virtinst/urlfetcher.py
@@ -448,7 +448,7 @@ def _distroFromSUSEContent(fetcher, arch, vmtype=None):
     dclass = GenericDistro
     if distribution:
         if re.match(".*SUSE Linux Enterprise Server*", distribution[1]) or \
-            re.match(".*SUSE SLES*", distribution[1]):
+                re.match(".*SUSE SLES*", distribution[1]):
             dclass = SLESDistro
             if distro_version is None:
                 distro_version = _parse_sle_distribution(distribution)
-- 
2.7.5




More information about the virt-tools-list mailing list