From 29f06704b8871a44926f7c99e73cf4a978fb8e81 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Tue, 10 May 2022 14:10:22 -0400 Subject: [PATCH] Fix incorrect type hint in filtering code. (#12695) --- changelog.d/12695.misc | 1 + synapse/api/filtering.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelog.d/12695.misc diff --git a/changelog.d/12695.misc b/changelog.d/12695.misc new file mode 100644 index 000000000..1b39d969a --- /dev/null +++ b/changelog.d/12695.misc @@ -0,0 +1 @@ +Fixes an incorrect type hint for `Filter._check_event_relations`. diff --git a/synapse/api/filtering.py b/synapse/api/filtering.py index 4a808e33f..b91ce06de 100644 --- a/synapse/api/filtering.py +++ b/synapse/api/filtering.py @@ -19,6 +19,7 @@ from typing import ( TYPE_CHECKING, Awaitable, Callable, + Collection, Dict, Iterable, List, @@ -444,9 +445,9 @@ class Filter: return room_ids async def _check_event_relations( - self, events: Iterable[FilterEvent] + self, events: Collection[FilterEvent] ) -> List[FilterEvent]: - # The event IDs to check, mypy doesn't understand the ifinstance check. + # The event IDs to check, mypy doesn't understand the isinstance check. event_ids = [event.event_id for event in events if isinstance(event, EventBase)] # type: ignore[attr-defined] event_ids_to_keep = set( await self._store.events_have_relations(