pep8 E731: do not assign a lambda expression, use a def

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2015-07-10 14:07:03 +02:00 committed by Cole Robinson
parent c7049eb120
commit a2505def2c
2 changed files with 8 additions and 4 deletions

View File

@ -257,7 +257,8 @@ class vmmDomain(vmmLibvirtObject):
@staticmethod @staticmethod
def pretty_status_reason(status, reason): 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 = { reasons = {
libvirt.VIR_DOMAIN_RUNNING : { libvirt.VIR_DOMAIN_RUNNING : {
key("RUNNING_BOOTED", 1) : _("Booted"), key("RUNNING_BOOTED", 1) : _("Booted"),

View File

@ -153,7 +153,8 @@ def fetch_volumes(backend, pool, origmap, build_func):
pool.listAllVolumes, build_func) pool.listAllVolumes, build_func)
else: else:
active_list = pool.listVolumes active_list = pool.listVolumes
inactive_list = lambda: [] def inactive_list():
return []
lookup_func = pool.storageVolLookupByName lookup_func = pool.storageVolLookupByName
return _old_poll_helper(origmap, name, return _old_poll_helper(origmap, name,
active_list, inactive_list, active_list, inactive_list,
@ -184,8 +185,10 @@ def fetch_nodedevs(backend, origmap, build_func):
return _new_poll_helper(origmap, name, return _new_poll_helper(origmap, name,
backend.listAllDevices, build_func) backend.listAllDevices, build_func)
else: else:
active_list = lambda: backend.listDevices(None, 0) def active_list():
inactive_list = lambda: [] return backend.listDevices(None, 0)
def inactive_list():
return []
lookup_func = backend.nodeDeviceLookupByName lookup_func = backend.nodeDeviceLookupByName
return _old_poll_helper(origmap, name, return _old_poll_helper(origmap, name,
active_list, inactive_list, active_list, inactive_list,