mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:06:05 -04:00
Add StateMap type alias (#6715)
This commit is contained in:
parent
7b14c4a018
commit
d386f2f339
14 changed files with 115 additions and 93 deletions
|
@ -17,6 +17,7 @@ import re
|
|||
import string
|
||||
import sys
|
||||
from collections import namedtuple
|
||||
from typing import Dict, Tuple, TypeVar
|
||||
|
||||
import attr
|
||||
from signedjson.key import decode_verify_key_bytes
|
||||
|
@ -28,7 +29,7 @@ from synapse.api.errors import SynapseError
|
|||
if sys.version_info[:3] >= (3, 6, 0):
|
||||
from typing import Collection
|
||||
else:
|
||||
from typing import Sized, Iterable, Container, TypeVar
|
||||
from typing import Sized, Iterable, Container
|
||||
|
||||
T_co = TypeVar("T_co", covariant=True)
|
||||
|
||||
|
@ -36,6 +37,12 @@ else:
|
|||
__slots__ = ()
|
||||
|
||||
|
||||
# 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]
|
||||
|
||||
|
||||
class Requester(
|
||||
namedtuple(
|
||||
"Requester", ["user", "access_token_id", "is_guest", "device_id", "app_service"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue