Appease mypy
This commit is contained in:
@@ -45,7 +45,10 @@ CHECK_EVENT_FOR_SPAM_CALLBACK = Callable[
|
||||
Awaitable[Union[bool, str]],
|
||||
]
|
||||
# FIXME: Callback signature differs from mainline
|
||||
USER_MAY_INVITE_CALLBACK = Callable[[str, str, str, str, bool, bool], Awaitable[bool]]
|
||||
USER_MAY_INVITE_CALLBACK = Callable[
|
||||
[str, Optional[str], Optional[dict], str, bool, bool],
|
||||
Awaitable[bool]
|
||||
]
|
||||
# FIXME: Callback signature differs from mainline
|
||||
USER_MAY_CREATE_ROOM_CALLBACK = Callable[
|
||||
[str, List[str], List[dict], bool], Awaitable[bool]
|
||||
|
||||
@@ -22,7 +22,7 @@ from typing import (
|
||||
Optional,
|
||||
Sequence,
|
||||
Tuple,
|
||||
overload,
|
||||
overload, Union,
|
||||
)
|
||||
|
||||
from typing_extensions import Literal
|
||||
@@ -630,7 +630,7 @@ def parse_json_object_from_request(
|
||||
return content
|
||||
|
||||
|
||||
def assert_params_in_dict(body: JsonDict, required: Iterable[str]) -> None:
|
||||
def assert_params_in_dict(body: JsonDict, required: Iterable[Union[str, bytes]]) -> None:
|
||||
absent = []
|
||||
for k in required:
|
||||
if k not in body:
|
||||
|
||||
@@ -17,7 +17,7 @@ import logging
|
||||
import random
|
||||
import re
|
||||
from http import HTTPStatus
|
||||
from typing import TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
from urllib.parse import urlparse
|
||||
|
||||
from synapse.api.constants import LoginType
|
||||
@@ -692,7 +692,10 @@ class ThreepidRestServlet(RestServlet):
|
||||
# This makes the API entirely change shape when we have an AS token;
|
||||
# it really should be an entirely separate API - perhaps
|
||||
# /account/3pid/replicate or something.
|
||||
threepid = body.get("threepid")
|
||||
threepid: Optional[dict] = body.get("threepid")
|
||||
|
||||
if not threepid:
|
||||
raise SynapseError(400, "Missing param 'threepid'")
|
||||
|
||||
await self.auth_handler.add_threepid(
|
||||
user_id,
|
||||
|
||||
@@ -41,7 +41,7 @@ class ProfileStoreTestCase(unittest.HomeserverTestCase):
|
||||
|
||||
# test set to None
|
||||
self.get_success(
|
||||
self.store.set_profile_displayname(self.u_frank.localpart, None)
|
||||
self.store.set_profile_displayname(self.u_frank.localpart, None, 1)
|
||||
)
|
||||
|
||||
self.assertIsNone(
|
||||
|
||||
Reference in New Issue
Block a user