[virt-tools-list] [virt-manager PATCH 4/4] pep8 E731: do not assign a lambda expression, use a def

Pavel Hrdina phrdina at redhat.com
Fri Jul 10 12:07:03 UTC 2015


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 virtManager/domain.py   | 3 ++-
 virtinst/pollhelpers.py | 9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/virtManager/domain.py b/virtManager/domain.py
index bb8c511..f3f21e8 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -257,7 +257,8 @@ class vmmDomain(vmmLibvirtObject):
 
     @staticmethod
     def pretty_status_reason(status, reason):
-        key = lambda x, y: getattr(libvirt, "VIR_DOMAIN_" + x, y)
+        def key(x, y):
+            return getattr(libvirt, "VIR_DOMAIN_" + x, y)
         reasons = {
             libvirt.VIR_DOMAIN_RUNNING : {
                 key("RUNNING_BOOTED", 1) : _("Booted"),
diff --git a/virtinst/pollhelpers.py b/virtinst/pollhelpers.py
index dafd079..d4acc30 100644
--- a/virtinst/pollhelpers.py
+++ b/virtinst/pollhelpers.py
@@ -153,7 +153,8 @@ def fetch_volumes(backend, pool, origmap, build_func):
                                 pool.listAllVolumes, build_func)
     else:
         active_list = pool.listVolumes
-        inactive_list = lambda: []
+        def inactive_list():
+            return []
         lookup_func = pool.storageVolLookupByName
         return _old_poll_helper(origmap, name,
                                 active_list, inactive_list,
@@ -184,8 +185,10 @@ def fetch_nodedevs(backend, origmap, build_func):
         return _new_poll_helper(origmap, name,
                                 backend.listAllDevices, build_func)
     else:
-        active_list = lambda: backend.listDevices(None, 0)
-        inactive_list = lambda: []
+        def active_list():
+            return backend.listDevices(None, 0)
+        def inactive_list():
+            return []
         lookup_func = backend.nodeDeviceLookupByName
         return _old_poll_helper(origmap, name,
                                 active_list, inactive_list,
-- 
2.4.5




More information about the virt-tools-list mailing list