1
0

Appease mypy

This commit is contained in:
Brendan Abolivier
2021-09-02 11:06:45 +01:00
parent 394cbd80e2
commit 660837fb9e
4 changed files with 12 additions and 6 deletions

View File

@@ -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]

View File

@@ -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:

View File

@@ -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,

View File

@@ -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(