Use list comprehensions instead of filter() for easier moto/swf python 3.x compatibility

This commit is contained in:
Jean-Baptiste Barth 2015-11-03 10:45:11 +01:00
commit b386495520
2 changed files with 7 additions and 11 deletions

View file

@ -193,7 +193,7 @@ class SWFBackend(BaseBackend):
candidates = []
for _task_list, tasks in domain.decision_task_lists.items():
if _task_list == task_list:
candidates += filter(lambda t: t.state == "SCHEDULED", tasks)
candidates += [t for t in tasks if t.state == "SCHEDULED"]
if any(candidates):
# TODO: handle task priorities (but not supported by boto for now)
task = min(candidates, key=lambda d: d.scheduled_at)
@ -293,7 +293,7 @@ class SWFBackend(BaseBackend):
candidates = []
for _task_list, tasks in domain.activity_task_lists.items():
if _task_list == task_list:
candidates += filter(lambda t: t.state == "SCHEDULED", tasks)
candidates += [t for t in tasks if t.state == "SCHEDULED"]
if any(candidates):
# TODO: handle task priorities (but not supported by boto for now)
task = min(candidates, key=lambda d: d.scheduled_at)