summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-12-16 15:24:03 +0000
committerMark Haines <mark.haines@matrix.org>2014-12-16 15:24:03 +0000
commit3c7857e49b8dcad723d52174aba77c47453c0298 (patch)
tree96091f56e7fe5c91540a3390baa0eeb0d1e171c6 /synapse/handlers
parentRemove annotate_event_with_state as nothing was using it. Update state tests ... (diff)
downloadsynapse-3c7857e49b8dcad723d52174aba77c47453c0298.tar.xz
clean up coding style a bit
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/_base.py4
-rw-r--r--synapse/handlers/directory.py1
-rw-r--r--synapse/handlers/federation.py11
-rw-r--r--synapse/handlers/typing.py4
4 files changed, 8 insertions, 12 deletions
diff --git a/synapse/handlers/_base.py b/synapse/handlers/_base.py
index af8eb5f0f5..567769253e 100644
--- a/synapse/handlers/_base.py
+++ b/synapse/handlers/_base.py
@@ -61,8 +61,6 @@ class BaseHandler(object):
     def _create_new_client_event(self, builder):
         yield run_on_reactor()
 
-        context = EventContext()
-
         latest_ret = yield self.store.get_latest_events_in_room(
             builder.room_id,
         )
@@ -78,6 +76,8 @@ class BaseHandler(object):
         builder.depth = depth
 
         state_handler = self.state_handler
+
+        context = EventContext()
         ret = yield state_handler.annotate_context_with_state(
             builder,
             context,
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py
index 404baea796..66d3b533d9 100644
--- a/synapse/handlers/directory.py
+++ b/synapse/handlers/directory.py
@@ -156,4 +156,3 @@ class DirectoryHandler(BaseHandler):
             "sender": user_id,
             "content": {"aliases": aliases},
         })
-
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 16a104c0e2..d80a54bdea 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -202,7 +202,7 @@ class FederationHandler(BaseHandler):
                 e.msg,
                 affected=event.event_id,
             )
-            
+
         # if we're receiving valid events from an origin,
         # it's probably a good idea to mark it as not in retry-state
         # for sending (although this is a bit of a leap)
@@ -263,9 +263,7 @@ class FederationHandler(BaseHandler):
             context = EventContext()
             yield self.state_handler.annotate_context_with_state(event, context)
 
-            events.append(
-                (event, context)
-            )
+            events.append((event, context))
 
             yield self.store.persist_event(
                 event,
@@ -547,8 +545,6 @@ class FederationHandler(BaseHandler):
         """
         event = pdu
 
-        context = EventContext()
-
         event.internal_metadata.outlier = True
 
         event.signatures.update(
@@ -559,6 +555,7 @@ class FederationHandler(BaseHandler):
             )
         )
 
+        context = EventContext()
         yield self.state_handler.annotate_context_with_state(event, context)
 
         yield self.store.persist_event(
@@ -685,13 +682,13 @@ class FederationHandler(BaseHandler):
     @defer.inlineCallbacks
     def _handle_new_event(self, event, state=None, backfilled=False,
                           current_state=None, fetch_missing=True):
-        context = EventContext()
 
         logger.debug(
             "_handle_new_event: Before annotate: %s, sigs: %s",
             event.event_id, event.signatures,
         )
 
+        context = EventContext()
         yield self.state_handler.annotate_context_with_state(
             event,
             context,
diff --git a/synapse/handlers/typing.py b/synapse/handlers/typing.py
index 77d66f66ff..7626b07280 100644
--- a/synapse/handlers/typing.py
+++ b/synapse/handlers/typing.py
@@ -45,8 +45,8 @@ class TypingNotificationHandler(BaseHandler):
 
         hs.get_distributor().observe("user_left_room", self.user_left_room)
 
-        self._member_typing_until = {} # clock time we expect to stop
-        self._member_typing_timer = {} # deferreds to manage theabove
+        self._member_typing_until = {}  # clock time we expect to stop
+        self._member_typing_timer = {}  # deferreds to manage theabove
 
         # map room IDs to serial numbers
         self._room_serials = {}