mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-06 14:34:59 -04:00
Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)
Ensure good comprehension hygiene using flake8-comprehensions.
This commit is contained in:
parent
272eee1ae1
commit
509e381afa
73 changed files with 251 additions and 276 deletions
|
@ -321,7 +321,7 @@ class StateGroupWorkerStore(EventsWorkerStore, SQLBaseStore):
|
|||
desc="get_referenced_state_groups",
|
||||
)
|
||||
|
||||
return set(row["state_group"] for row in rows)
|
||||
return {row["state_group"] for row in rows}
|
||||
|
||||
|
||||
class MainStateBackgroundUpdateStore(RoomMemberWorkerStore):
|
||||
|
@ -367,7 +367,7 @@ class MainStateBackgroundUpdateStore(RoomMemberWorkerStore):
|
|||
"""
|
||||
|
||||
txn.execute(sql, (last_room_id, batch_size))
|
||||
room_ids = list(row[0] for row in txn)
|
||||
room_ids = [row[0] for row in txn]
|
||||
if not room_ids:
|
||||
return True, set()
|
||||
|
||||
|
@ -384,7 +384,7 @@ class MainStateBackgroundUpdateStore(RoomMemberWorkerStore):
|
|||
|
||||
txn.execute(sql, (last_room_id, room_ids[-1], "%:" + self.server_name))
|
||||
|
||||
joined_room_ids = set(row[0] for row in txn)
|
||||
joined_room_ids = {row[0] for row in txn}
|
||||
|
||||
left_rooms = set(room_ids) - joined_room_ids
|
||||
|
||||
|
@ -404,7 +404,7 @@ class MainStateBackgroundUpdateStore(RoomMemberWorkerStore):
|
|||
retcols=("state_key",),
|
||||
)
|
||||
|
||||
potentially_left_users = set(row["state_key"] for row in rows)
|
||||
potentially_left_users = {row["state_key"] for row in rows}
|
||||
|
||||
# Now lets actually delete the rooms from the DB.
|
||||
self.db.simple_delete_many_txn(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue