mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-10 00:07:32 -05:00
Replace returnValue with return (#5736)
This commit is contained in:
parent
18a466b84e
commit
4806651744
177 changed files with 1359 additions and 1513 deletions
|
|
@ -185,7 +185,7 @@ class ReplicationEndpoint(object):
|
|||
except RequestSendFailed as e:
|
||||
raise_from(SynapseError(502, "Failed to talk to master"), e)
|
||||
|
||||
defer.returnValue(result)
|
||||
return result
|
||||
|
||||
return send_request
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class ReplicationFederationSendEventsRestServlet(ReplicationEndpoint):
|
|||
|
||||
payload = {"events": event_payloads, "backfilled": backfilled}
|
||||
|
||||
defer.returnValue(payload)
|
||||
return payload
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _handle_request(self, request):
|
||||
|
|
@ -113,7 +113,7 @@ class ReplicationFederationSendEventsRestServlet(ReplicationEndpoint):
|
|||
event_and_contexts, backfilled
|
||||
)
|
||||
|
||||
defer.returnValue((200, {}))
|
||||
return (200, {})
|
||||
|
||||
|
||||
class ReplicationFederationSendEduRestServlet(ReplicationEndpoint):
|
||||
|
|
@ -156,7 +156,7 @@ class ReplicationFederationSendEduRestServlet(ReplicationEndpoint):
|
|||
|
||||
result = yield self.registry.on_edu(edu_type, origin, edu_content)
|
||||
|
||||
defer.returnValue((200, result))
|
||||
return (200, result)
|
||||
|
||||
|
||||
class ReplicationGetQueryRestServlet(ReplicationEndpoint):
|
||||
|
|
@ -204,7 +204,7 @@ class ReplicationGetQueryRestServlet(ReplicationEndpoint):
|
|||
|
||||
result = yield self.registry.on_query(query_type, args)
|
||||
|
||||
defer.returnValue((200, result))
|
||||
return (200, result)
|
||||
|
||||
|
||||
class ReplicationCleanRoomRestServlet(ReplicationEndpoint):
|
||||
|
|
@ -238,7 +238,7 @@ class ReplicationCleanRoomRestServlet(ReplicationEndpoint):
|
|||
def _handle_request(self, request, room_id):
|
||||
yield self.store.clean_room_for_join(room_id)
|
||||
|
||||
defer.returnValue((200, {}))
|
||||
return (200, {})
|
||||
|
||||
|
||||
def register_servlets(hs, http_server):
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class RegisterDeviceReplicationServlet(ReplicationEndpoint):
|
|||
user_id, device_id, initial_display_name, is_guest
|
||||
)
|
||||
|
||||
defer.returnValue((200, {"device_id": device_id, "access_token": access_token}))
|
||||
return (200, {"device_id": device_id, "access_token": access_token})
|
||||
|
||||
|
||||
def register_servlets(hs, http_server):
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class ReplicationRemoteJoinRestServlet(ReplicationEndpoint):
|
|||
remote_room_hosts, room_id, user_id, event_content
|
||||
)
|
||||
|
||||
defer.returnValue((200, {}))
|
||||
return (200, {})
|
||||
|
||||
|
||||
class ReplicationRemoteRejectInviteRestServlet(ReplicationEndpoint):
|
||||
|
|
@ -153,7 +153,7 @@ class ReplicationRemoteRejectInviteRestServlet(ReplicationEndpoint):
|
|||
yield self.store.locally_reject_invite(user_id, room_id)
|
||||
ret = {}
|
||||
|
||||
defer.returnValue((200, ret))
|
||||
return (200, ret)
|
||||
|
||||
|
||||
class ReplicationUserJoinedLeftRoomRestServlet(ReplicationEndpoint):
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class ReplicationRegisterServlet(ReplicationEndpoint):
|
|||
address=content["address"],
|
||||
)
|
||||
|
||||
defer.returnValue((200, {}))
|
||||
return (200, {})
|
||||
|
||||
|
||||
class ReplicationPostRegisterActionsServlet(ReplicationEndpoint):
|
||||
|
|
@ -143,7 +143,7 @@ class ReplicationPostRegisterActionsServlet(ReplicationEndpoint):
|
|||
bind_msisdn=bind_msisdn,
|
||||
)
|
||||
|
||||
defer.returnValue((200, {}))
|
||||
return (200, {})
|
||||
|
||||
|
||||
def register_servlets(hs, http_server):
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class ReplicationSendEventRestServlet(ReplicationEndpoint):
|
|||
"extra_users": [u.to_string() for u in extra_users],
|
||||
}
|
||||
|
||||
defer.returnValue(payload)
|
||||
return payload
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _handle_request(self, request, event_id):
|
||||
|
|
@ -117,7 +117,7 @@ class ReplicationSendEventRestServlet(ReplicationEndpoint):
|
|||
requester, event, context, ratelimit=ratelimit, extra_users=extra_users
|
||||
)
|
||||
|
||||
defer.returnValue((200, {}))
|
||||
return (200, {})
|
||||
|
||||
|
||||
def register_servlets(hs, http_server):
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ class Stream(object):
|
|||
updates, current_token = yield self.get_updates_since(self.last_token)
|
||||
self.last_token = current_token
|
||||
|
||||
defer.returnValue((updates, current_token))
|
||||
return (updates, current_token)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_updates_since(self, from_token):
|
||||
|
|
@ -172,14 +172,14 @@ class Stream(object):
|
|||
sent over the replication steam.
|
||||
"""
|
||||
if from_token in ("NOW", "now"):
|
||||
defer.returnValue(([], self.upto_token))
|
||||
return ([], self.upto_token)
|
||||
|
||||
current_token = self.upto_token
|
||||
|
||||
from_token = int(from_token)
|
||||
|
||||
if from_token == current_token:
|
||||
defer.returnValue(([], current_token))
|
||||
return ([], current_token)
|
||||
|
||||
if self._LIMITED:
|
||||
rows = yield self.update_function(
|
||||
|
|
@ -198,7 +198,7 @@ class Stream(object):
|
|||
if self._LIMITED and len(updates) >= MAX_EVENTS_BEHIND:
|
||||
raise Exception("stream %s has fallen behind" % (self.NAME))
|
||||
|
||||
defer.returnValue((updates, current_token))
|
||||
return (updates, current_token)
|
||||
|
||||
def current_token(self):
|
||||
"""Gets the current token of the underlying streams. Should be provided
|
||||
|
|
@ -297,7 +297,7 @@ class PushRulesStream(Stream):
|
|||
@defer.inlineCallbacks
|
||||
def update_function(self, from_token, to_token, limit):
|
||||
rows = yield self.store.get_all_push_rule_updates(from_token, to_token, limit)
|
||||
defer.returnValue([(row[0], row[2]) for row in rows])
|
||||
return [(row[0], row[2]) for row in rows]
|
||||
|
||||
|
||||
class PushersStream(Stream):
|
||||
|
|
@ -424,7 +424,7 @@ class AccountDataStream(Stream):
|
|||
for stream_id, user_id, account_data_type, content in global_results
|
||||
)
|
||||
|
||||
defer.returnValue(results)
|
||||
return results
|
||||
|
||||
|
||||
class GroupServerStream(Stream):
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class EventsStream(Stream):
|
|||
|
||||
all_updates = heapq.merge(event_updates, state_updates)
|
||||
|
||||
defer.returnValue(all_updates)
|
||||
return all_updates
|
||||
|
||||
@classmethod
|
||||
def parse_row(cls, row):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue