mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-25 19:15:51 +03:00
Remove double return statements (#5962)
Remove all the "double return" statements which were a result of us removing all the instances of ``` defer.returnValue(...) return ``` statements when we switched to python3 fully.
This commit is contained in:
parent
a90d16dabc
commit
2a44782666
15 changed files with 1 additions and 20 deletions
1
changelog.d/5962.misc
Normal file
1
changelog.d/5962.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Remove unnecessary return statements in the codebase which were the result of a regex run.
|
|
@ -704,7 +704,6 @@ class Auth(object):
|
|||
and visibility.content["history_visibility"] == "world_readable"
|
||||
):
|
||||
return Membership.JOIN, None
|
||||
return
|
||||
raise AuthError(
|
||||
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
||||
)
|
||||
|
|
|
@ -107,7 +107,6 @@ class ApplicationServiceApi(SimpleHttpClient):
|
|||
except CodeMessageException as e:
|
||||
if e.code == 404:
|
||||
return False
|
||||
return
|
||||
logger.warning("query_user to %s received %s", uri, e.code)
|
||||
except Exception as ex:
|
||||
logger.warning("query_user to %s threw exception %s", uri, ex)
|
||||
|
@ -127,7 +126,6 @@ class ApplicationServiceApi(SimpleHttpClient):
|
|||
logger.warning("query_alias to %s received %s", uri, e.code)
|
||||
if e.code == 404:
|
||||
return False
|
||||
return
|
||||
except Exception as ex:
|
||||
logger.warning("query_alias to %s threw exception %s", uri, ex)
|
||||
return False
|
||||
|
@ -230,7 +228,6 @@ class ApplicationServiceApi(SimpleHttpClient):
|
|||
sent_transactions_counter.labels(service.id).inc()
|
||||
sent_events_counter.labels(service.id).inc(len(events))
|
||||
return True
|
||||
return
|
||||
except CodeMessageException as e:
|
||||
logger.warning("push_bulk to %s received %s", uri, e.code)
|
||||
except Exception as ex:
|
||||
|
|
|
@ -294,12 +294,10 @@ class ApplicationServicesHandler(object):
|
|||
# we don't know if they are unknown or not since it isn't one of our
|
||||
# users. We can't poke ASes.
|
||||
return False
|
||||
return
|
||||
|
||||
user_info = yield self.store.get_user_by_id(user_id)
|
||||
if user_info:
|
||||
return False
|
||||
return
|
||||
|
||||
# user not found; could be the AS though, so check.
|
||||
services = self.store.get_app_services()
|
||||
|
|
|
@ -167,7 +167,6 @@ class EventHandler(BaseHandler):
|
|||
|
||||
if not event:
|
||||
return None
|
||||
return
|
||||
|
||||
users = yield self.store.get_users_in_room(event.room_id)
|
||||
is_peeking = user.to_string() not in users
|
||||
|
|
|
@ -450,7 +450,6 @@ class InitialSyncHandler(BaseHandler):
|
|||
# else it will throw.
|
||||
member_event = yield self.auth.check_user_was_in_room(room_id, user_id)
|
||||
return member_event.membership, member_event.event_id
|
||||
return
|
||||
except AuthError:
|
||||
visibility = yield self.state_handler.get_current_state(
|
||||
room_id, EventTypes.RoomHistoryVisibility, ""
|
||||
|
@ -460,7 +459,6 @@ class InitialSyncHandler(BaseHandler):
|
|||
and visibility.content["history_visibility"] == "world_readable"
|
||||
):
|
||||
return Membership.JOIN, None
|
||||
return
|
||||
raise AuthError(
|
||||
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
||||
)
|
||||
|
|
|
@ -852,7 +852,6 @@ class RoomContextHandler(object):
|
|||
)
|
||||
if not event:
|
||||
return None
|
||||
return
|
||||
|
||||
filtered = yield (filter_evts([event]))
|
||||
if not filtered:
|
||||
|
|
|
@ -578,7 +578,6 @@ class SyncHandler(object):
|
|||
|
||||
if not last_events:
|
||||
return None
|
||||
return
|
||||
|
||||
last_event = last_events[-1]
|
||||
state_ids = yield self.store.get_state_ids_for_event(
|
||||
|
|
|
@ -703,7 +703,6 @@ class RoomMembershipRestServlet(TransactionRestServlet):
|
|||
txn_id,
|
||||
)
|
||||
return 200, {}
|
||||
return
|
||||
|
||||
target = requester.user
|
||||
if membership_action in ["invite", "ban", "unban", "kick"]:
|
||||
|
|
|
@ -230,7 +230,6 @@ class RegisterRestServlet(RestServlet):
|
|||
if kind == b"guest":
|
||||
ret = yield self._do_guest_registration(body, address=client_addr)
|
||||
return ret
|
||||
return
|
||||
elif kind != b"user":
|
||||
raise UnrecognizedRequestError(
|
||||
"Do not understand membership kind: %s" % (kind,)
|
||||
|
@ -280,7 +279,6 @@ class RegisterRestServlet(RestServlet):
|
|||
desired_username, access_token, body
|
||||
)
|
||||
return 200, result # we throw for non 200 responses
|
||||
return
|
||||
|
||||
# for regular registration, downcase the provided username before
|
||||
# attempting to register it. This should mean
|
||||
|
|
|
@ -183,7 +183,6 @@ class PreviewUrlResource(DirectServeResource):
|
|||
if isinstance(og, six.text_type):
|
||||
og = og.encode("utf8")
|
||||
return og
|
||||
return
|
||||
|
||||
media_info = yield self._download_url(url, user)
|
||||
|
||||
|
|
|
@ -136,7 +136,6 @@ class StateHandler(object):
|
|||
if event_id:
|
||||
event = yield self.store.get_event(event_id, allow_none=True)
|
||||
return event
|
||||
return
|
||||
|
||||
state_map = yield self.store.get_events(
|
||||
list(state.values()), get_prev_content=False
|
||||
|
|
|
@ -165,7 +165,6 @@ class ApplicationServiceTransactionWorkerStore(
|
|||
)
|
||||
if result:
|
||||
return result.get("state")
|
||||
return
|
||||
return None
|
||||
|
||||
def set_appservice_state(self, service, state):
|
||||
|
|
|
@ -47,7 +47,6 @@ class DirectoryWorkerStore(SQLBaseStore):
|
|||
|
||||
if not room_id:
|
||||
return None
|
||||
return
|
||||
|
||||
servers = yield self._simple_select_onecol(
|
||||
"room_alias_servers",
|
||||
|
@ -58,7 +57,6 @@ class DirectoryWorkerStore(SQLBaseStore):
|
|||
|
||||
if not servers:
|
||||
return None
|
||||
return
|
||||
|
||||
return RoomAliasMapping(room_id, room_alias.to_string(), servers)
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ class ProfileWorkerStore(SQLBaseStore):
|
|||
if e.code == 404:
|
||||
# no match
|
||||
return ProfileInfo(None, None)
|
||||
return
|
||||
else:
|
||||
raise
|
||||
|
||||
|
|
Loading…
Reference in a new issue