mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 08:24:55 -04:00
Add type annotations to trace
decorator. (#13328)
Functions that are decorated with `trace` are now properly typed and the type hints for them are fixed.
This commit is contained in:
parent
47822fd2e8
commit
a6895dd576
12 changed files with 102 additions and 55 deletions
|
@ -13,7 +13,7 @@
|
|||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, Optional, Tuple
|
||||
from typing import TYPE_CHECKING, Optional, Tuple, cast
|
||||
|
||||
from synapse.api.errors import Codes, NotFoundError, SynapseError
|
||||
from synapse.http.server import HttpServer
|
||||
|
@ -127,7 +127,7 @@ class RoomKeysServlet(RestServlet):
|
|||
requester = await self.auth.get_user_by_req(request, allow_guest=False)
|
||||
user_id = requester.user.to_string()
|
||||
body = parse_json_object_from_request(request)
|
||||
version = parse_string(request, "version")
|
||||
version = parse_string(request, "version", required=True)
|
||||
|
||||
if session_id:
|
||||
body = {"sessions": {session_id: body}}
|
||||
|
@ -196,8 +196,11 @@ class RoomKeysServlet(RestServlet):
|
|||
user_id = requester.user.to_string()
|
||||
version = parse_string(request, "version", required=True)
|
||||
|
||||
room_keys = await self.e2e_room_keys_handler.get_room_keys(
|
||||
user_id, version, room_id, session_id
|
||||
room_keys = cast(
|
||||
JsonDict,
|
||||
await self.e2e_room_keys_handler.get_room_keys(
|
||||
user_id, version, room_id, session_id
|
||||
),
|
||||
)
|
||||
|
||||
# Convert room_keys to the right format to return.
|
||||
|
@ -240,7 +243,7 @@ class RoomKeysServlet(RestServlet):
|
|||
|
||||
requester = await self.auth.get_user_by_req(request, allow_guest=False)
|
||||
user_id = requester.user.to_string()
|
||||
version = parse_string(request, "version")
|
||||
version = parse_string(request, "version", required=True)
|
||||
|
||||
ret = await self.e2e_room_keys_handler.delete_room_keys(
|
||||
user_id, version, room_id, session_id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue