diff options
author | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2021-08-05 15:35:25 +0100 |
---|---|---|
committer | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2021-08-24 10:42:00 +0100 |
commit | 38a7fd2f8215cea88438e82ce73f9f1f45cb763a (patch) | |
tree | 907fcf9900eb5c2691b452599831533a5cea720d | |
parent | Make StateFilter frozen (diff) | |
download | synapse-38a7fd2f8215cea88438e82ce73f9f1f45cb763a.tar.xz |
Predicate it on TYPE_CHECKING (not that it improves things)
-rw-r--r-- | synapse/storage/state.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py index f23082f1df..eb9fbb8109 100644 --- a/synapse/storage/state.py +++ b/synapse/storage/state.py @@ -32,6 +32,8 @@ from synapse.events import EventBase from synapse.types import MutableStateMap, StateMap if TYPE_CHECKING: + from typing import FrozenSet # noqa: used within quoted type hint; flake8 sad + from synapse.server import HomeServer from synapse.storage.databases import Databases @@ -106,7 +108,9 @@ class StateFilter: type_dict.setdefault(typ, set()).add(s) # type: ignore - return StateFilter(types=frozendict(type_dict)) + return StateFilter( + types=frozendict((k, frozenset(v)) for k, v in type_dict.items()) + ) @staticmethod def from_lazy_load_member_list(members: Iterable[str]) -> "StateFilter": @@ -120,7 +124,8 @@ class StateFilter: The new state filter """ return StateFilter( - types=frozendict({EventTypes.Member: set(members)}), include_others=True + types=frozendict({EventTypes.Member: frozenset(members)}), + include_others=True, ) def return_expanded(self) -> "StateFilter": |