diff options
author | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2021-08-05 15:29:31 +0100 |
---|---|---|
committer | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2021-08-05 15:29:31 +0100 |
commit | 215019cd667b4844fe02cf13c0071a842b0d0861 (patch) | |
tree | 568ec2da83d4fa7386605aec6386eb4a11241471 /synapse/storage/state.py | |
parent | antilint (diff) | |
download | synapse-215019cd667b4844fe02cf13c0071a842b0d0861.tar.xz |
Fix-ups
Diffstat (limited to '')
-rw-r--r-- | synapse/storage/state.py | 11 |
1 files 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 |