diff options
author | David Robertson <davidr@element.io> | 2022-04-08 13:06:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-08 13:06:51 +0100 |
commit | 95a038c1069de6c0507eb2c2d9a783c5033a70ec (patch) | |
tree | 782b33d85db7ef0b54e9e49a9d629b7675a52334 /synapse/federation | |
parent | Update the server notices user profile in room if changed. (#12115) (diff) | |
download | synapse-95a038c1069de6c0507eb2c2d9a783c5033a70ec.tar.xz |
Unify HTTP query parameter type hints (#12415)
* Pull out query param types to `synapse.http.types` * Use QueryParams everywhere * Simplify `encode_query_args` * Add annotation which would have caught #12410
Diffstat (limited to 'synapse/federation')
-rw-r--r-- | synapse/federation/federation_client.py | 3 | ||||
-rw-r--r-- | synapse/federation/transport/client.py | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py index 467275b98c..6a59cb4b71 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py @@ -56,6 +56,7 @@ from synapse.api.room_versions import ( from synapse.events import EventBase, builder from synapse.federation.federation_base import FederationBase, event_from_pdu_json from synapse.federation.transport.client import SendJoinResponse +from synapse.http.types import QueryParams from synapse.types import JsonDict, UserID, get_domain_from_id from synapse.util.async_helpers import concurrently_execute from synapse.util.caches.expiringcache import ExpiringCache @@ -154,7 +155,7 @@ class FederationClient(FederationBase): self, destination: str, query_type: str, - args: dict, + args: QueryParams, retry_on_dns_fail: bool = False, ignore_backoff: bool = False, ) -> JsonDict: diff --git a/synapse/federation/transport/client.py b/synapse/federation/transport/client.py index 66a41e45fc..01dc5ca94f 100644 --- a/synapse/federation/transport/client.py +++ b/synapse/federation/transport/client.py @@ -44,6 +44,7 @@ from synapse.api.urls import ( from synapse.events import EventBase, make_event_from_dict from synapse.federation.units import Transaction from synapse.http.matrixfederationclient import ByteParser +from synapse.http.types import QueryParams from synapse.types import JsonDict logger = logging.getLogger(__name__) @@ -255,7 +256,7 @@ class TransportLayerClient: self, destination: str, query_type: str, - args: dict, + args: QueryParams, retry_on_dns_fail: bool, ignore_backoff: bool = False, prefix: str = FEDERATION_V1_PREFIX, @@ -503,7 +504,7 @@ class TransportLayerClient: else: path = _create_v1_path("/publicRooms") - args: Dict[str, Any] = { + args: Dict[str, Union[str, Iterable[str]]] = { "include_all_networks": "true" if include_all_networks else "false" } if third_party_instance_id: |