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

Commit 8dc666f

Browse files
David Robertsonclokep
David Robertson
andauthored
Correct type hint for room_batch.py (#11310)
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
1 parent 48278a0 commit 8dc666f

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

changelog.d/11310.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add type hints to storage classes.

mypy.ini

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ exclude = (?x)
4646
|synapse/storage/databases/main/push_rule.py
4747
|synapse/storage/databases/main/receipts.py
4848
|synapse/storage/databases/main/room.py
49-
|synapse/storage/databases/main/room_batch.py
5049
|synapse/storage/databases/main/roommember.py
5150
|synapse/storage/databases/main/search.py
5251
|synapse/storage/databases/main/signatures.py
@@ -183,6 +182,9 @@ disallow_untyped_defs = True
183182
[mypy-synapse.storage.databases.main.client_ips]
184183
disallow_untyped_defs = True
185184

185+
[mypy-synapse.storage.databases.main.room_batch]
186+
disallow_untyped_defs = True
187+
186188
[mypy-synapse.storage.util.*]
187189
disallow_untyped_defs = True
188190

synapse/storage/databases/main/room_batch.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,11 @@ async def get_insertion_event_id_by_batch_id(
3939

4040
async def store_state_group_id_for_event_id(
4141
self, event_id: str, state_group_id: int
42-
) -> Optional[str]:
43-
{
44-
await self.db_pool.simple_upsert(
45-
table="event_to_state_groups",
46-
keyvalues={"event_id": event_id},
47-
values={"state_group": state_group_id, "event_id": event_id},
48-
# Unique constraint on event_id so we don't have to lock
49-
lock=False,
50-
)
51-
}
42+
) -> None:
43+
await self.db_pool.simple_upsert(
44+
table="event_to_state_groups",
45+
keyvalues={"event_id": event_id},
46+
values={"state_group": state_group_id, "event_id": event_id},
47+
# Unique constraint on event_id so we don't have to lock
48+
lock=False,
49+
)

0 commit comments

Comments
 (0)