Python3 common patterns
Modify some codes in order to make them meet the Python3 common pattern. In this patch,I replace filter(lambda obj: test(obj),data) with[obj for obj in data if test(obj)] Change-Id: I68e76f91dc31aa0e00124c1eb76a0a1f0178cc44
This commit is contained in:
parent
1d483ae0c7
commit
6805390a1d
|
@ -41,7 +41,7 @@ def find_items(items, **props):
|
|||
|
||||
return True
|
||||
|
||||
filtered = list(filter(lambda item: _matches(item, **props), items))
|
||||
filtered = list([item for item in items if _matches(item, **props)])
|
||||
|
||||
if len(filtered) == 1:
|
||||
return filtered[0]
|
||||
|
|
|
@ -79,7 +79,7 @@ class SSHActionsTestsV2(base.TestCaseAdvanced):
|
|||
'floating_ips'
|
||||
)
|
||||
free_ips = list(
|
||||
filter(lambda fl_ip: fl_ip['instance_id'] is None, all_ips)
|
||||
[fl_ip for fl_ip in all_ips if fl_ip['instance_id'] is None]
|
||||
)
|
||||
|
||||
if free_ips:
|
||||
|
|
Loading…
Reference in New Issue