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

Fix type of event_ids parameters in StateGroupStorage and StateHandler #12156

Merged
merged 1 commit into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/12156.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix some type annotations.
6 changes: 3 additions & 3 deletions synapse/state/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async def get_current_state(
}

async def get_current_state_ids(
self, room_id: str, latest_event_ids: Optional[Iterable[str]] = None
self, room_id: str, latest_event_ids: Optional[Collection[str]] = None
) -> StateMap[str]:
"""Get the current state, or the state at a set of events, for a room

Expand Down Expand Up @@ -243,7 +243,7 @@ async def get_current_hosts_in_room(self, room_id: str) -> Set[str]:
return await self.get_hosts_in_room_at_events(room_id, event_ids)

async def get_hosts_in_room_at_events(
self, room_id: str, event_ids: Iterable[str]
self, room_id: str, event_ids: Collection[str]
) -> Set[str]:
"""Get the hosts that were in a room at the given event ids

Expand Down Expand Up @@ -404,7 +404,7 @@ async def compute_event_context(

@measure_func()
async def resolve_state_groups_for_events(
self, room_id: str, event_ids: Iterable[str]
self, room_id: str, event_ids: Collection[str]
) -> _StateCacheEntry:
"""Given a list of event_ids this method fetches the state at each
event, resolves conflicts between them and returns them.
Expand Down
8 changes: 4 additions & 4 deletions synapse/storage/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ async def get_state_group_delta(
return state_group_delta.prev_group, state_group_delta.delta_ids

async def get_state_groups_ids(
self, _room_id: str, event_ids: Iterable[str]
self, _room_id: str, event_ids: Collection[str]
) -> Dict[int, MutableStateMap[str]]:
"""Get the event IDs of all the state for the state groups for the given events

Expand Down Expand Up @@ -596,7 +596,7 @@ async def get_state_ids_for_group(self, state_group: int) -> StateMap[str]:
return group_to_state[state_group]

async def get_state_groups(
self, room_id: str, event_ids: Iterable[str]
self, room_id: str, event_ids: Collection[str]
) -> Dict[int, List[EventBase]]:
"""Get the state groups for the given list of event_ids

Expand Down Expand Up @@ -648,7 +648,7 @@ def _get_state_groups_from_groups(
return self.stores.state._get_state_groups_from_groups(groups, state_filter)

async def get_state_for_events(
self, event_ids: Iterable[str], state_filter: Optional[StateFilter] = None
self, event_ids: Collection[str], state_filter: Optional[StateFilter] = None
) -> Dict[str, StateMap[EventBase]]:
"""Given a list of event_ids and type tuples, return a list of state
dicts for each event.
Expand Down Expand Up @@ -684,7 +684,7 @@ async def get_state_for_events(
return {event: event_to_state[event] for event in event_ids}

async def get_state_ids_for_events(
self, event_ids: Iterable[str], state_filter: Optional[StateFilter] = None
self, event_ids: Collection[str], state_filter: Optional[StateFilter] = None
) -> Dict[str, StateMap[str]]:
"""
Get the state dicts corresponding to a list of events, containing the event_ids
Expand Down