0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-14 06:53:47 +01:00

clean up coding style a bit

This commit is contained in:
Mark Haines 2014-12-16 15:24:03 +00:00
parent 8b8beba194
commit 3c7857e49b
8 changed files with 26 additions and 26 deletions

View file

@ -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):

View file

@ -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,

View file

@ -156,4 +156,3 @@ class DirectoryHandler(BaseHandler):
"sender": user_id,
"content": {"aliases": aliases},
})

View file

@ -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,

View file

@ -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 = {}

View file

@ -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]

View file

@ -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):

View file

@ -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):