diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-02-08 07:44:39 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 07:44:39 -0500 |
commit | 63d90f10eccf804a6ca5bfa51cdb1b0d0233fe95 (patch) | |
tree | 5e592b9184bd562cd5c46135f341b6fff5c3ea56 /synapse/replication/http/streams.py | |
parent | Fetch edits for multiple events in a single query. (#11660) (diff) | |
download | synapse-63d90f10eccf804a6ca5bfa51cdb1b0d0233fe95.tar.xz |
Add missing type hints to synapse.replication.http. (#11856)
Diffstat (limited to 'synapse/replication/http/streams.py')
-rw-r--r-- | synapse/replication/http/streams.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/synapse/replication/http/streams.py b/synapse/replication/http/streams.py index 3223bc2432..c065225362 100644 --- a/synapse/replication/http/streams.py +++ b/synapse/replication/http/streams.py @@ -13,11 +13,15 @@ # limitations under the License. import logging -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Tuple + +from twisted.web.server import Request from synapse.api.errors import SynapseError +from synapse.http.server import HttpServer from synapse.http.servlet import parse_integer from synapse.replication.http._base import ReplicationEndpoint +from synapse.types import JsonDict if TYPE_CHECKING: from synapse.server import HomeServer @@ -57,10 +61,14 @@ class ReplicationGetStreamUpdates(ReplicationEndpoint): self.streams = hs.get_replication_streams() @staticmethod - async def _serialize_payload(stream_name, from_token, upto_token): + async def _serialize_payload( # type: ignore[override] + stream_name: str, from_token: int, upto_token: int + ) -> JsonDict: return {"from_token": from_token, "upto_token": upto_token} - async def _handle_request(self, request, stream_name): + async def _handle_request( # type: ignore[override] + self, request: Request, stream_name: str + ) -> Tuple[int, JsonDict]: stream = self.streams.get(stream_name) if stream is None: raise SynapseError(400, "Unknown stream") @@ -78,5 +86,5 @@ class ReplicationGetStreamUpdates(ReplicationEndpoint): ) -def register_servlets(hs: "HomeServer", http_server): +def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None: ReplicationGetStreamUpdates(hs).register(http_server) |