diff options
author | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2021-08-23 18:52:40 +0100 |
---|---|---|
committer | Olivier Wilkinson (reivilibre) <olivier@librepush.net> | 2021-08-24 10:43:09 +0100 |
commit | eda19443abdc52ada9e9c4437d69f9b3ef3a309a (patch) | |
tree | 1cceb274bb87eef5c5bae5687ec783c1ace689e8 | |
parent | antilint (diff) | |
download | synapse-eda19443abdc52ada9e9c4437d69f9b3ef3a309a.tar.xz |
Type annotations
-rw-r--r-- | synapse/storage/state.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/storage/state.py b/synapse/storage/state.py index 2e7f0bd087..8370005c8c 100644 --- a/synapse/storage/state.py +++ b/synapse/storage/state.py @@ -64,7 +64,7 @@ class StateFilter: # wildcards from the types dictionary if self.include_others: # REVIEW: yucky - self.types = frozendict( # type: ignore[misc] # read-only + self.types: "frozendict[str, Optional[FrozenSet[str]]]" = frozendict( # type: ignore[misc,no-redef] # read-only {k: v for k, v in self.types.items() if v is not None} ) @@ -259,14 +259,15 @@ class StateFilter: return len(self.concrete_types()) - def filter_state(self, state_dict: StateMap[T]) -> StateMap[T]: - """Returns the state filtered with by this StateFilter + def filter_state(self, state_dict: StateMap[T]) -> MutableStateMap[T]: + """Returns the state filtered with by this StateFilter. Args: state: The state map to filter Returns: - The filtered state map + The filtered state map. + This is a copy, so it's safe to mutate. """ if self.is_full(): return dict(state_dict) |