Use list comprehension instead of filter

This commit is contained in:
Erik Johnston 2015-08-12 16:01:10 +01:00
parent d46208c12c
commit f7e2f981ea
2 changed files with 6 additions and 20 deletions

View File

@ -177,17 +177,10 @@ class MessageHandler(BaseHandler):
return True
event_and_state = filter(
allowed,
[
(e, event_id_to_state[e.event_id])
for e in events
]
)
defer.returnValue([
ev
for ev, _ in event_and_state
event
for event in events
if allowed(event, event_id_to_state[event.event_id])
])
@defer.inlineCallbacks

View File

@ -334,17 +334,10 @@ class SyncHandler(BaseHandler):
return True
event_and_state = filter(
allowed,
[
(e, event_id_to_state[e.event_id])
for e in events
]
)
defer.returnValue([
ev
for ev, _ in event_and_state
event
for event in events
if allowed(event, event_id_to_state[event.event_id])
])
@defer.inlineCallbacks