Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 2a44782

Browse files
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.
1 parent a90d16d commit 2a44782

File tree

15 files changed

+1
-20
lines changed

15 files changed

+1
-20
lines changed

changelog.d/5962.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove unnecessary return statements in the codebase which were the result of a regex run.

synapse/api/auth.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,6 @@ def check_in_room_or_world_readable(self, room_id, user_id):
704704
and visibility.content["history_visibility"] == "world_readable"
705705
):
706706
return Membership.JOIN, None
707-
return
708707
raise AuthError(
709708
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
710709
)

synapse/appservice/api.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def query_user(self, service, user_id):
107107
except CodeMessageException as e:
108108
if e.code == 404:
109109
return False
110-
return
111110
logger.warning("query_user to %s received %s", uri, e.code)
112111
except Exception as ex:
113112
logger.warning("query_user to %s threw exception %s", uri, ex)
@@ -127,7 +126,6 @@ def query_alias(self, service, alias):
127126
logger.warning("query_alias to %s received %s", uri, e.code)
128127
if e.code == 404:
129128
return False
130-
return
131129
except Exception as ex:
132130
logger.warning("query_alias to %s threw exception %s", uri, ex)
133131
return False
@@ -230,7 +228,6 @@ def push_bulk(self, service, events, txn_id=None):
230228
sent_transactions_counter.labels(service.id).inc()
231229
sent_events_counter.labels(service.id).inc(len(events))
232230
return True
233-
return
234231
except CodeMessageException as e:
235232
logger.warning("push_bulk to %s received %s", uri, e.code)
236233
except Exception as ex:

synapse/handlers/appservice.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,10 @@ def _is_unknown_user(self, user_id):
294294
# we don't know if they are unknown or not since it isn't one of our
295295
# users. We can't poke ASes.
296296
return False
297-
return
298297

299298
user_info = yield self.store.get_user_by_id(user_id)
300299
if user_info:
301300
return False
302-
return
303301

304302
# user not found; could be the AS though, so check.
305303
services = self.store.get_app_services()

synapse/handlers/events.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ def get_event(self, user, room_id, event_id):
167167

168168
if not event:
169169
return None
170-
return
171170

172171
users = yield self.store.get_users_in_room(event.room_id)
173172
is_peeking = user.to_string() not in users

synapse/handlers/initial_sync.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ def _check_in_room_or_world_readable(self, room_id, user_id):
450450
# else it will throw.
451451
member_event = yield self.auth.check_user_was_in_room(room_id, user_id)
452452
return member_event.membership, member_event.event_id
453-
return
454453
except AuthError:
455454
visibility = yield self.state_handler.get_current_state(
456455
room_id, EventTypes.RoomHistoryVisibility, ""
@@ -460,7 +459,6 @@ def _check_in_room_or_world_readable(self, room_id, user_id):
460459
and visibility.content["history_visibility"] == "world_readable"
461460
):
462461
return Membership.JOIN, None
463-
return
464462
raise AuthError(
465463
403, "Guest access not allowed", errcode=Codes.GUEST_ACCESS_FORBIDDEN
466464
)

synapse/handlers/room.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,6 @@ def filter_evts(events):
852852
)
853853
if not event:
854854
return None
855-
return
856855

857856
filtered = yield (filter_evts([event]))
858857
if not filtered:

synapse/handlers/sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,6 @@ def compute_summary(self, room_id, sync_config, batch, state, now_token):
578578

579579
if not last_events:
580580
return None
581-
return
582581

583582
last_event = last_events[-1]
584583
state_ids = yield self.store.get_state_ids_for_event(

synapse/rest/client/v1/room.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,6 @@ def on_POST(self, request, room_id, membership_action, txn_id=None):
703703
txn_id,
704704
)
705705
return 200, {}
706-
return
707706

708707
target = requester.user
709708
if membership_action in ["invite", "ban", "unban", "kick"]:

synapse/rest/client/v2_alpha/register.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ def on_POST(self, request):
230230
if kind == b"guest":
231231
ret = yield self._do_guest_registration(body, address=client_addr)
232232
return ret
233-
return
234233
elif kind != b"user":
235234
raise UnrecognizedRequestError(
236235
"Do not understand membership kind: %s" % (kind,)
@@ -280,7 +279,6 @@ def on_POST(self, request):
280279
desired_username, access_token, body
281280
)
282281
return 200, result # we throw for non 200 responses
283-
return
284282

285283
# for regular registration, downcase the provided username before
286284
# attempting to register it. This should mean

0 commit comments

Comments
 (0)