From 54dc2bed3deceb62caaad5a700772f29bdc4d562 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Wed, 25 Mar 2026 18:09:57 -0500 Subject: [PATCH] Use less restrictive `Sequence` --- synapse/handlers/pagination.py | 8 ++++---- synapse/storage/databases/main/events_worker.py | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/synapse/handlers/pagination.py b/synapse/handlers/pagination.py index 90ee4bc466..a55dcc78b0 100644 --- a/synapse/handlers/pagination.py +++ b/synapse/handlers/pagination.py @@ -19,7 +19,7 @@ # # import logging -from typing import TYPE_CHECKING, cast +from typing import TYPE_CHECKING, Sequence, cast import attr @@ -80,7 +80,7 @@ class GetMessagesResult: Everything needed to serialize a `/messages` response. """ - messages_chunk: list[EventBase] + messages_chunk: Sequence[EventBase] """ A list of room events. @@ -93,7 +93,7 @@ class GetMessagesResult: available. Clients should continue to paginate until no `end_token` property is returned. """ - gaps: list[EventGapEntry] + gaps: Sequence[EventGapEntry] """ A list of gaps in the `messages_chunk` """ @@ -105,7 +105,7 @@ class GetMessagesResult: If an event doesn't have any bundled aggregations, it may not appear in the map. """ - state: list[EventBase] | None + state: Sequence[EventBase] | None """ A list of state events relevant to showing the chunk. For example, if lazy_load_members is enabled in the filter then this may contain the membership diff --git a/synapse/storage/databases/main/events_worker.py b/synapse/storage/databases/main/events_worker.py index 05374cb2c6..53ed54dc24 100644 --- a/synapse/storage/databases/main/events_worker.py +++ b/synapse/storage/databases/main/events_worker.py @@ -31,6 +31,7 @@ from typing import ( Literal, Mapping, MutableMapping, + Sequence, cast, overload, ) @@ -2494,8 +2495,8 @@ class EventsWorkerStore(SQLBaseStore): ) async def get_events_next_to_gaps( - self, events: list[EventBase], direction: Direction - ) -> list[EventGapEntry]: + self, events: Sequence[EventBase], direction: Direction + ) -> Sequence[EventGapEntry]: """ Find all of the events that have gaps next to them.