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

Commit

Permalink
Use cast isntead of ignore.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Aug 26, 2020
1 parent 8bc1bc3 commit a7f2152
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions synapse/state/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
Sequence,
Set,
Union,
cast,
overload,
)

Expand Down Expand Up @@ -554,16 +555,20 @@ async def resolve_state_groups(
if conflicted_state:
logger.info("Resolving conflicted state for %r", room_id)
with Measure(self.clock, "state._resolve_events"):
# mypy doesn't like that new_state was previously mutable,
# and now isn't. We don't mutate past this point though, so
# tell it to go away.
new_state = await resolve_events_with_store( # type: ignore
self.clock,
room_id,
room_version,
list(state_groups_ids.values()),
event_map=event_map,
state_res_store=state_res_store,
# resolve_eevnts_with_store returns a StateMap, but we can
# treat it as a MutableStateMap as it is above. It isn't
# actually mutated anymore (and is frozen in
# _make_state_cache_entry below).
new_state = cast(
MutableStateMap,
await resolve_events_with_store(
self.clock,
room_id,
room_version,
list(state_groups_ids.values()),
event_map=event_map,
state_res_store=state_res_store,
),
)

# if the new state matches any of the input state groups, we can
Expand Down

0 comments on commit a7f2152

Please sign in to comment.