mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-06 11:08:48 -04:00
Add most of the missing type hints to synapse.federation
. (#11483)
This skips a few methods which are difficult to type.
This commit is contained in:
parent
b50e39df57
commit
d2279f471b
10 changed files with 84 additions and 49 deletions
|
@ -21,6 +21,7 @@ from typing import (
|
|||
Callable,
|
||||
Collection,
|
||||
Dict,
|
||||
Generator,
|
||||
Iterable,
|
||||
List,
|
||||
Mapping,
|
||||
|
@ -235,11 +236,16 @@ class TransportLayerClient:
|
|||
|
||||
@log_function
|
||||
async def make_query(
|
||||
self, destination, query_type, args, retry_on_dns_fail, ignore_backoff=False
|
||||
):
|
||||
self,
|
||||
destination: str,
|
||||
query_type: str,
|
||||
args: dict,
|
||||
retry_on_dns_fail: bool,
|
||||
ignore_backoff: bool = False,
|
||||
) -> JsonDict:
|
||||
path = _create_v1_path("/query/%s", query_type)
|
||||
|
||||
content = await self.client.get_json(
|
||||
return await self.client.get_json(
|
||||
destination=destination,
|
||||
path=path,
|
||||
args=args,
|
||||
|
@ -248,8 +254,6 @@ class TransportLayerClient:
|
|||
ignore_backoff=ignore_backoff,
|
||||
)
|
||||
|
||||
return content
|
||||
|
||||
@log_function
|
||||
async def make_membership_event(
|
||||
self,
|
||||
|
@ -1317,7 +1321,7 @@ class SendJoinResponse:
|
|||
|
||||
|
||||
@ijson.coroutine
|
||||
def _event_parser(event_dict: JsonDict):
|
||||
def _event_parser(event_dict: JsonDict) -> Generator[None, Tuple[str, Any], None]:
|
||||
"""Helper function for use with `ijson.kvitems_coro` to parse key-value pairs
|
||||
to add them to a given dictionary.
|
||||
"""
|
||||
|
@ -1328,7 +1332,9 @@ def _event_parser(event_dict: JsonDict):
|
|||
|
||||
|
||||
@ijson.coroutine
|
||||
def _event_list_parser(room_version: RoomVersion, events: List[EventBase]):
|
||||
def _event_list_parser(
|
||||
room_version: RoomVersion, events: List[EventBase]
|
||||
) -> Generator[None, JsonDict, None]:
|
||||
"""Helper function for use with `ijson.items_coro` to parse an array of
|
||||
events and add them to the given list.
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue