summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-08-12 16:01:10 +0100
committerErik Johnston <erik@matrix.org>2015-08-12 16:01:10 +0100
commitf7e2f981ea1feb8461a5bddd9378bd5084833fc0 (patch)
tree8606a67fc77464f71bebcbe4669ee54c1939633a
parentMerge branch 'develop' of github.com:matrix-org/synapse into erikj/dictionary... (diff)
downloadsynapse-f7e2f981ea1feb8461a5bddd9378bd5084833fc0.tar.xz
Use list comprehension instead of filter
Diffstat (limited to '')
-rw-r--r--synapse/handlers/message.py13
-rw-r--r--synapse/handlers/sync.py13
2 files changed, 6 insertions, 20 deletions
diff --git a/synapse/handlers/message.py b/synapse/handlers/message.py
index b941312eff..2c4af8dc97 100644
--- a/synapse/handlers/message.py
+++ b/synapse/handlers/message.py
@@ -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
diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py
index d960078e7a..ec8d78ba8c 100644
--- a/synapse/handlers/sync.py
+++ b/synapse/handlers/sync.py
@@ -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