mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:16:07 -04:00
Create a SynapseReactor type which incorporates the necessary reactor interfaces. (#9528)
This helps fix some type hints when running with Twisted 21.2.0.
This commit is contained in:
parent
0fc4eb103a
commit
58114f8a17
8 changed files with 32 additions and 12 deletions
|
@ -35,6 +35,14 @@ from typing import (
|
|||
import attr
|
||||
from signedjson.key import decode_verify_key_bytes
|
||||
from unpaddedbase64 import decode_base64
|
||||
from zope.interface import Interface
|
||||
|
||||
from twisted.internet.interfaces import (
|
||||
IReactorCore,
|
||||
IReactorPluggableNameResolver,
|
||||
IReactorTCP,
|
||||
IReactorTime,
|
||||
)
|
||||
|
||||
from synapse.api.errors import Codes, SynapseError
|
||||
from synapse.util.stringutils import parse_and_validate_server_name
|
||||
|
@ -67,6 +75,14 @@ MutableStateMap = MutableMapping[StateKey, T]
|
|||
JsonDict = Dict[str, Any]
|
||||
|
||||
|
||||
# Note that this seems to require inheriting *directly* from Interface in order
|
||||
# for mypy-zope to realize it is an interface.
|
||||
class ISynapseReactor(
|
||||
IReactorTCP, IReactorPluggableNameResolver, IReactorTime, IReactorCore, Interface
|
||||
):
|
||||
"""The interfaces necessary for Synapse to function."""
|
||||
|
||||
|
||||
class Requester(
|
||||
namedtuple(
|
||||
"Requester",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue