Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add type hints to the federation server transport. (#10080)
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep authored Jun 8, 2021
1 parent e0ddd82 commit c7f3fb2
Show file tree
Hide file tree
Showing 5 changed files with 194 additions and 75 deletions.
1 change: 1 addition & 0 deletions changelog.d/10080.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add type hints to the federation servlets.
6 changes: 3 additions & 3 deletions synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def __init__(self, hs: "HomeServer"):
# come in waves.
self._state_resp_cache = ResponseCache(
hs.get_clock(), "state_resp", timeout_ms=30000
) # type: ResponseCache[Tuple[str, str]]
) # type: ResponseCache[Tuple[str, Optional[str]]]
self._state_ids_resp_cache = ResponseCache(
hs.get_clock(), "state_ids_resp", timeout_ms=30000
) # type: ResponseCache[Tuple[str, str]]
Expand Down Expand Up @@ -406,7 +406,7 @@ async def _process_edu(edu_dict):
)

async def on_room_state_request(
self, origin: str, room_id: str, event_id: str
self, origin: str, room_id: str, event_id: Optional[str]
) -> Tuple[int, Dict[str, Any]]:
origin_host, _ = parse_server_name(origin)
await self.check_server_matches_acl(origin_host, room_id)
Expand Down Expand Up @@ -463,7 +463,7 @@ async def _on_state_ids_request_compute(self, room_id, event_id):
return {"pdu_ids": state_ids, "auth_chain_ids": auth_chain_ids}

async def _on_context_state_request_compute(
self, room_id: str, event_id: str
self, room_id: str, event_id: Optional[str]
) -> Dict[str, list]:
if event_id:
pdus = await self.handler.get_state_for_pdu(
Expand Down
Loading

0 comments on commit c7f3fb2

Please sign in to comment.