diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-08-23 08:14:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-23 08:14:17 -0400 |
commit | 2af6d31b78109a989e27128ac655990c35b29d62 (patch) | |
tree | de461f67cf18f7bce536407e07b1eab15deee56a /synapse/rest/client/user_directory.py | |
parent | Do not include stack traces for known exceptions when trying multiple federat... (diff) | |
download | synapse-2af6d31b78109a989e27128ac655990c35b29d62.tar.xz |
Addtional type hints for the REST servlets. (#10665)
Diffstat (limited to 'synapse/rest/client/user_directory.py')
-rw-r--r-- | synapse/rest/client/user_directory.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/synapse/rest/client/user_directory.py b/synapse/rest/client/user_directory.py index 7e8912f0b9..8852811114 100644 --- a/synapse/rest/client/user_directory.py +++ b/synapse/rest/client/user_directory.py @@ -13,29 +13,32 @@ # limitations under the License. import logging +from typing import TYPE_CHECKING, Tuple from synapse.api.errors import SynapseError +from synapse.http.server import HttpServer from synapse.http.servlet import RestServlet, parse_json_object_from_request +from synapse.http.site import SynapseRequest +from synapse.types import JsonDict from ._base import client_patterns +if TYPE_CHECKING: + from synapse.server import HomeServer + logger = logging.getLogger(__name__) class UserDirectorySearchRestServlet(RestServlet): PATTERNS = client_patterns("/user_directory/search$") - def __init__(self, hs): - """ - Args: - hs (synapse.server.HomeServer): server - """ + def __init__(self, hs: "HomeServer"): super().__init__() self.hs = hs self.auth = hs.get_auth() self.user_directory_handler = hs.get_user_directory_handler() - async def on_POST(self, request): + async def on_POST(self, request: SynapseRequest) -> Tuple[int, JsonDict]: """Searches for users in directory Returns: @@ -75,5 +78,5 @@ class UserDirectorySearchRestServlet(RestServlet): return 200, results -def register_servlets(hs, http_server): +def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None: UserDirectorySearchRestServlet(hs).register(http_server) |