mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 23:23:50 +01: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"
|
and visibility.content["history_visibility"] == "world_readable"
|
||||||
):
|
):
|
||||||
return Membership.JOIN, None
|
return Membership.JOIN, None
|
||||||
return
|
|
||||||
raise AuthError(
|
raise AuthError(
|
||||||
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
||||||
)
|
)
|
||||||
|
|
|
@ -107,7 +107,6 @@ class ApplicationServiceApi(SimpleHttpClient):
|
||||||
except CodeMessageException as e:
|
except CodeMessageException as e:
|
||||||
if e.code == 404:
|
if e.code == 404:
|
||||||
return False
|
return False
|
||||||
return
|
|
||||||
logger.warning("query_user to %s received %s", uri, e.code)
|
logger.warning("query_user to %s received %s", uri, e.code)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logger.warning("query_user to %s threw exception %s", uri, 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)
|
logger.warning("query_alias to %s received %s", uri, e.code)
|
||||||
if e.code == 404:
|
if e.code == 404:
|
||||||
return False
|
return False
|
||||||
return
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logger.warning("query_alias to %s threw exception %s", uri, ex)
|
logger.warning("query_alias to %s threw exception %s", uri, ex)
|
||||||
return False
|
return False
|
||||||
|
@ -230,7 +228,6 @@ class ApplicationServiceApi(SimpleHttpClient):
|
||||||
sent_transactions_counter.labels(service.id).inc()
|
sent_transactions_counter.labels(service.id).inc()
|
||||||
sent_events_counter.labels(service.id).inc(len(events))
|
sent_events_counter.labels(service.id).inc(len(events))
|
||||||
return True
|
return True
|
||||||
return
|
|
||||||
except CodeMessageException as e:
|
except CodeMessageException as e:
|
||||||
logger.warning("push_bulk to %s received %s", uri, e.code)
|
logger.warning("push_bulk to %s received %s", uri, e.code)
|
||||||
except Exception as ex:
|
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
|
# we don't know if they are unknown or not since it isn't one of our
|
||||||
# users. We can't poke ASes.
|
# users. We can't poke ASes.
|
||||||
return False
|
return False
|
||||||
return
|
|
||||||
|
|
||||||
user_info = yield self.store.get_user_by_id(user_id)
|
user_info = yield self.store.get_user_by_id(user_id)
|
||||||
if user_info:
|
if user_info:
|
||||||
return False
|
return False
|
||||||
return
|
|
||||||
|
|
||||||
# user not found; could be the AS though, so check.
|
# user not found; could be the AS though, so check.
|
||||||
services = self.store.get_app_services()
|
services = self.store.get_app_services()
|
||||||
|
|
|
@ -167,7 +167,6 @@ class EventHandler(BaseHandler):
|
||||||
|
|
||||||
if not event:
|
if not event:
|
||||||
return None
|
return None
|
||||||
return
|
|
||||||
|
|
||||||
users = yield self.store.get_users_in_room(event.room_id)
|
users = yield self.store.get_users_in_room(event.room_id)
|
||||||
is_peeking = user.to_string() not in users
|
is_peeking = user.to_string() not in users
|
||||||
|
|
|
@ -450,7 +450,6 @@ class InitialSyncHandler(BaseHandler):
|
||||||
# else it will throw.
|
# else it will throw.
|
||||||
member_event = yield self.auth.check_user_was_in_room(room_id, user_id)
|
member_event = yield self.auth.check_user_was_in_room(room_id, user_id)
|
||||||
return member_event.membership, member_event.event_id
|
return member_event.membership, member_event.event_id
|
||||||
return
|
|
||||||
except AuthError:
|
except AuthError:
|
||||||
visibility = yield self.state_handler.get_current_state(
|
visibility = yield self.state_handler.get_current_state(
|
||||||
room_id, EventTypes.RoomHistoryVisibility, ""
|
room_id, EventTypes.RoomHistoryVisibility, ""
|
||||||
|
@ -460,7 +459,6 @@ class InitialSyncHandler(BaseHandler):
|
||||||
and visibility.content["history_visibility"] == "world_readable"
|
and visibility.content["history_visibility"] == "world_readable"
|
||||||
):
|
):
|
||||||
return Membership.JOIN, None
|
return Membership.JOIN, None
|
||||||
return
|
|
||||||
raise AuthError(
|
raise AuthError(
|
||||||
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
|
||||||
)
|
)
|
||||||
|
|
|
@ -852,7 +852,6 @@ class RoomContextHandler(object):
|
||||||
)
|
)
|
||||||
if not event:
|
if not event:
|
||||||
return None
|
return None
|
||||||
return
|
|
||||||
|
|
||||||
filtered = yield (filter_evts([event]))
|
filtered = yield (filter_evts([event]))
|
||||||
if not filtered:
|
if not filtered:
|
||||||
|
|
|
@ -578,7 +578,6 @@ class SyncHandler(object):
|
||||||
|
|
||||||
if not last_events:
|
if not last_events:
|
||||||
return None
|
return None
|
||||||
return
|
|
||||||
|
|
||||||
last_event = last_events[-1]
|
last_event = last_events[-1]
|
||||||
state_ids = yield self.store.get_state_ids_for_event(
|
state_ids = yield self.store.get_state_ids_for_event(
|
||||||
|
|
|
@ -703,7 +703,6 @@ class RoomMembershipRestServlet(TransactionRestServlet):
|
||||||
txn_id,
|
txn_id,
|
||||||
)
|
)
|
||||||
return 200, {}
|
return 200, {}
|
||||||
return
|
|
||||||
|
|
||||||
target = requester.user
|
target = requester.user
|
||||||
if membership_action in ["invite", "ban", "unban", "kick"]:
|
if membership_action in ["invite", "ban", "unban", "kick"]:
|
||||||
|
|
|
@ -230,7 +230,6 @@ class RegisterRestServlet(RestServlet):
|
||||||
if kind == b"guest":
|
if kind == b"guest":
|
||||||
ret = yield self._do_guest_registration(body, address=client_addr)
|
ret = yield self._do_guest_registration(body, address=client_addr)
|
||||||
return ret
|
return ret
|
||||||
return
|
|
||||||
elif kind != b"user":
|
elif kind != b"user":
|
||||||
raise UnrecognizedRequestError(
|
raise UnrecognizedRequestError(
|
||||||
"Do not understand membership kind: %s" % (kind,)
|
"Do not understand membership kind: %s" % (kind,)
|
||||||
|
@ -280,7 +279,6 @@ class RegisterRestServlet(RestServlet):
|
||||||
desired_username, access_token, body
|
desired_username, access_token, body
|
||||||
)
|
)
|
||||||
return 200, result # we throw for non 200 responses
|
return 200, result # we throw for non 200 responses
|
||||||
return
|
|
||||||
|
|
||||||
# for regular registration, downcase the provided username before
|
# for regular registration, downcase the provided username before
|
||||||
# attempting to register it. This should mean
|
# attempting to register it. This should mean
|
||||||
|
|
|
@ -183,7 +183,6 @@ class PreviewUrlResource(DirectServeResource):
|
||||||
if isinstance(og, six.text_type):
|
if isinstance(og, six.text_type):
|
||||||
og = og.encode("utf8")
|
og = og.encode("utf8")
|
||||||
return og
|
return og
|
||||||
return
|
|
||||||
|
|
||||||
media_info = yield self._download_url(url, user)
|
media_info = yield self._download_url(url, user)
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,6 @@ class StateHandler(object):
|
||||||
if event_id:
|
if event_id:
|
||||||
event = yield self.store.get_event(event_id, allow_none=True)
|
event = yield self.store.get_event(event_id, allow_none=True)
|
||||||
return event
|
return event
|
||||||
return
|
|
||||||
|
|
||||||
state_map = yield self.store.get_events(
|
state_map = yield self.store.get_events(
|
||||||
list(state.values()), get_prev_content=False
|
list(state.values()), get_prev_content=False
|
||||||
|
|
|
@ -165,7 +165,6 @@ class ApplicationServiceTransactionWorkerStore(
|
||||||
)
|
)
|
||||||
if result:
|
if result:
|
||||||
return result.get("state")
|
return result.get("state")
|
||||||
return
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def set_appservice_state(self, service, state):
|
def set_appservice_state(self, service, state):
|
||||||
|
|
|
@ -47,7 +47,6 @@ class DirectoryWorkerStore(SQLBaseStore):
|
||||||
|
|
||||||
if not room_id:
|
if not room_id:
|
||||||
return None
|
return None
|
||||||
return
|
|
||||||
|
|
||||||
servers = yield self._simple_select_onecol(
|
servers = yield self._simple_select_onecol(
|
||||||
"room_alias_servers",
|
"room_alias_servers",
|
||||||
|
@ -58,7 +57,6 @@ class DirectoryWorkerStore(SQLBaseStore):
|
||||||
|
|
||||||
if not servers:
|
if not servers:
|
||||||
return None
|
return None
|
||||||
return
|
|
||||||
|
|
||||||
return RoomAliasMapping(room_id, room_alias.to_string(), servers)
|
return RoomAliasMapping(room_id, room_alias.to_string(), servers)
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ class ProfileWorkerStore(SQLBaseStore):
|
||||||
if e.code == 404:
|
if e.code == 404:
|
||||||
# no match
|
# no match
|
||||||
return ProfileInfo(None, None)
|
return ProfileInfo(None, None)
|
||||||
return
|
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue