From 2466128b9228ded2a3dee48c894b3a248cc3c683 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Sep 2020 17:03:24 +0100 Subject: [PATCH 1/3] Fix mypy error on develop --- synapse/handlers/pagination.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/synapse/handlers/pagination.py b/synapse/handlers/pagination.py index 195a1fd77e3e..bf03338acd82 100644 --- a/synapse/handlers/pagination.py +++ b/synapse/handlers/pagination.py @@ -373,12 +373,15 @@ async def get_messages( # case "JOIN" would have been returned. assert member_event_id - leave_token = await self.store.get_topological_token_for_event( + leave_token_str = await self.store.get_topological_token_for_event( member_event_id ) - if RoomStreamToken.parse(leave_token).topological < max_topo: + leave_token = RoomStreamToken.parse(leave_token_str) + assert leave_token.topological + + if leave_token.topological < max_topo: from_token = from_token.copy_and_replace( - "room_key", leave_token + "room_key", leave_token_str ) await self.hs.get_handlers().federation_handler.maybe_backfill( From a0c09dd3548d698f846f6f6dc619b28cd41ace6f Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Sep 2020 17:04:34 +0100 Subject: [PATCH 2/3] Newsfile --- changelog.d/8282.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/8282.misc diff --git a/changelog.d/8282.misc b/changelog.d/8282.misc new file mode 100644 index 000000000000..b6896a9300d5 --- /dev/null +++ b/changelog.d/8282.misc @@ -0,0 +1 @@ +Clean up type hints for `PaginationConfig`. From fec74f8e2cb30a9bb2a46da5f7bde226baa07070 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 8 Sep 2020 17:23:40 +0100 Subject: [PATCH 3/3] Use 'is not None' --- synapse/handlers/pagination.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/synapse/handlers/pagination.py b/synapse/handlers/pagination.py index bf03338acd82..ec17d3d8884a 100644 --- a/synapse/handlers/pagination.py +++ b/synapse/handlers/pagination.py @@ -377,7 +377,7 @@ async def get_messages( member_event_id ) leave_token = RoomStreamToken.parse(leave_token_str) - assert leave_token.topological + assert leave_token.topological is not None if leave_token.topological < max_topo: from_token = from_token.copy_and_replace(