From 215019cd667b4844fe02cf13c0071a842b0d0861 Mon Sep 17 00:00:00 2001 From: "Olivier Wilkinson (reivilibre)" <olivier@librepush.net> Date: Thu, 5 Aug 2021 15:29:31 +0100 Subject: Fix-ups --- synapse/storage/state.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/synapse/storage/state.py b/synapse/storage/state.py index f23082f1df..e1de433384 100644 --- a/synapse/storage/state.py +++ b/synapse/storage/state.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import logging +from typing import FrozenSet # noqa: used within quoted type hint; flake8 sad from typing import ( TYPE_CHECKING, Awaitable, @@ -54,15 +55,19 @@ class StateFilter: appear in `types`. """ - types = attr.ib(type=frozendict[str, Optional[Set[str]]]) + types = attr.ib(type="frozendict[str, Optional[FrozenSet[str]]]") include_others = attr.ib(default=False, type=bool) def __attrs_post_init__(self): # If `include_others` is set we canonicalise the filter by removing # wildcards from the types dictionary if self.include_others: - self.types = frozendict( - {k: v for k, v in self.types.items() if v is not None} + # REVIEW: yucky. any better way? + # Work around this class being frozen. + object.__setattr__( + self, + "types", + frozendict({k: v for k, v in self.types.items() if v is not None}), ) @staticmethod -- cgit 1.4.1