From 8246719f0a70df5ae3d21c6cbda9d797d9d5aea5 Mon Sep 17 00:00:00 2001 From: Brendan Abolivier Date: Tue, 11 Aug 2020 15:21:47 +0100 Subject: [PATCH] Lint --- synapse/handlers/sync.py | 4 ++-- synapse/storage/databases/main/event_push_actions.py | 8 ++++---- tests/rest/client/v2_alpha/test_sync.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index ab7577a0b02e..ad3b790b0696 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -936,7 +936,7 @@ async def compute_state_delta( async def unread_notifs_for_room_id( self, room_id: str, sync_config: SyncConfig - ) -> Optional[Dict[str, str]]: + ) -> Optional[Dict[str, int]]: with Measure(self.clock, "unread_notifs_for_room_id"): last_unread_event_id = await self.store.get_last_receipt_event_id_for_user( user_id=sync_config.user.to_string(), @@ -1886,7 +1886,7 @@ async def _generate_room_entry( ) if room_builder.rtype == "joined": - unread_notifications = {} # type: Dict[str, str] + unread_notifications = {} # type: Dict[str, int] room_sync = JoinedSyncResult( room_id=room_id, timeline=batch, diff --git a/synapse/storage/databases/main/event_push_actions.py b/synapse/storage/databases/main/event_push_actions.py index b9142e3edc2e..5d6a83e60745 100644 --- a/synapse/storage/databases/main/event_push_actions.py +++ b/synapse/storage/databases/main/event_push_actions.py @@ -228,8 +228,7 @@ def _get_count_from_push_actions_txn( ) txn.execute( - sql % push_actions_column, - (user_id, room_id, stream_ordering), + sql % push_actions_column, (user_id, room_id, stream_ordering), ) row = txn.fetchone() count = row[0] if row else 0 @@ -239,7 +238,8 @@ def _get_count_from_push_actions_txn( """ SELECT %s FROM event_push_summary WHERE room_id = ? AND user_id = ? AND stream_ordering > ? - """ % push_summary_column, + """ + % push_summary_column, (room_id, user_id, stream_ordering), ) rows = txn.fetchall() @@ -980,7 +980,7 @@ def _rotate_notifs_before_txn(self, txn, rotate_to_stream_ordering): txn.executemany( """ UPDATE event_push_summary - SET notif_count = ?, unread_count = ?, stream_ordering = ? + SET notif_count = ?, unread_count = ?, stream_ordering = ? WHERE user_id = ? AND room_id = ? """, ( diff --git a/tests/rest/client/v2_alpha/test_sync.py b/tests/rest/client/v2_alpha/test_sync.py index 0cb0ce8f76b4..5ad2cbca5dc2 100644 --- a/tests/rest/client/v2_alpha/test_sync.py +++ b/tests/rest/client/v2_alpha/test_sync.py @@ -477,4 +477,4 @@ def _check_unread_count(self, expected_count: True): ) # Store the next batch for the next request. - self.next_batch = channel.json_body["next_batch"] \ No newline at end of file + self.next_batch = channel.json_body["next_batch"]