mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:06:05 -04:00
Define StateMap as immutable and add a MutableStateMap type. (#8183)
This commit is contained in:
parent
2c2e649be2
commit
d5e73cb6aa
8 changed files with 52 additions and 32 deletions
|
@ -18,7 +18,7 @@ import re
|
|||
import string
|
||||
import sys
|
||||
from collections import namedtuple
|
||||
from typing import Any, Dict, Tuple, Type, TypeVar
|
||||
from typing import Any, Dict, Mapping, MutableMapping, Tuple, Type, TypeVar
|
||||
|
||||
import attr
|
||||
from signedjson.key import decode_verify_key_bytes
|
||||
|
@ -41,8 +41,9 @@ else:
|
|||
# Define a state map type from type/state_key to T (usually an event ID or
|
||||
# event)
|
||||
T = TypeVar("T")
|
||||
StateMap = Dict[Tuple[str, str], T]
|
||||
|
||||
StateKey = Tuple[str, str]
|
||||
StateMap = Mapping[StateKey, T]
|
||||
MutableStateMap = MutableMapping[StateKey, T]
|
||||
|
||||
# the type of a JSON-serialisable dict. This could be made stronger, but it will
|
||||
# do for now.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue