summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--synapse/events/__init__.py22
-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
-rw-r--r--synapse/media/v1/base_resource.py1
-rw-r--r--synapse/rest/room.py8
-rw-r--r--synapse/rest/transactions.py1
8 files changed, 26 insertions, 26 deletions
diff --git a/synapse/events/__init__.py b/synapse/events/__init__.py
index 984f14fce4..34b1b944ab 100644
--- a/synapse/events/__init__.py
+++ b/synapse/events/__init__.py
@@ -30,20 +30,20 @@ class _EventInternalMetadata(object):
 
 
 def _event_dict_property(key):
-        def getter(self):
-            return self._event_dict[key]
+    def getter(self):
+        return self._event_dict[key]
 
-        def setter(self, v):
-            self._event_dict[key] = v
+    def setter(self, v):
+        self._event_dict[key] = v
 
-        def delete(self):
-            del self._event_dict[key]
+    def delete(self):
+        del self._event_dict[key]
 
-        return property(
-            getter,
-            setter,
-            delete,
-        )
+    return property(
+        getter,
+        setter,
+        delete,
+    )
 
 
 class EventBase(object):
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 = {}
diff --git a/synapse/media/v1/base_resource.py b/synapse/media/v1/base_resource.py
index 14735ff375..2f5440ab64 100644
--- a/synapse/media/v1/base_resource.py
+++ b/synapse/media/v1/base_resource.py
@@ -135,6 +135,7 @@ class BaseMediaResource(Resource):
         if download is None:
             download = self._get_remote_media_impl(server_name, media_id)
             self.downloads[key] = download
+
             @download.addBoth
             def callback(media_info):
                 del self.downloads[key]
diff --git a/synapse/rest/room.py b/synapse/rest/room.py
index 0e2d5fbaae..005a9f6f44 100644
--- a/synapse/rest/room.py
+++ b/synapse/rest/room.py
@@ -310,8 +310,8 @@ class RoomMessageListRestServlet(RestServlet):
     @defer.inlineCallbacks
     def on_GET(self, request, room_id):
         user = yield self.auth.get_user_by_req(request)
-        pagination_config = PaginationConfig.from_request(request,
-            default_limit=10,
+        pagination_config = PaginationConfig.from_request(
+            request, default_limit=10,
         )
         with_feedback = "feedback" in request.args
         handler = self.handlers.message_handler
@@ -466,7 +466,9 @@ class RoomRedactEventRestServlet(RestServlet):
 
 
 class RoomTypingRestServlet(RestServlet):
-    PATTERN = client_path_pattern("/rooms/(?P<room_id>[^/]*)/typing/(?P<user_id>[^/]*)$")
+    PATTERN = client_path_pattern(
+        "/rooms/(?P<room_id>[^/]*)/typing/(?P<user_id>[^/]*)$"
+    )
 
     @defer.inlineCallbacks
     def on_PUT(self, request, room_id, user_id):
diff --git a/synapse/rest/transactions.py b/synapse/rest/transactions.py
index 8c41ab4edb..31377bd41d 100644
--- a/synapse/rest/transactions.py
+++ b/synapse/rest/transactions.py
@@ -19,6 +19,7 @@ import logging
 
 logger = logging.getLogger(__name__)
 
+
 # FIXME: elsewhere we use FooStore to indicate something in the storage layer...
 class HttpTransactionStore(object):