diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-09-03 09:22:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-03 09:22:22 -0400 |
commit | ecbfa4fe4fa7625dec14ef8f9bd06cc4ad141de0 (patch) | |
tree | 732bb7811ccffe2c68fb59fbb8351486ff786d77 /synapse/rest/client/groups.py | |
parent | Fix bug with reusing 'txn' when persisting event. (#10743) (diff) | |
download | synapse-ecbfa4fe4fa7625dec14ef8f9bd06cc4ad141de0.tar.xz |
Additional type hints for client REST servlets (part 5) (#10736)
Additionally this enforce type hints on all function signatures inside of the synapse.rest.client package.
Diffstat (limited to 'synapse/rest/client/groups.py')
-rw-r--r-- | synapse/rest/client/groups.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/synapse/rest/client/groups.py b/synapse/rest/client/groups.py index 0950f43f2f..a7e9aa3e9b 100644 --- a/synapse/rest/client/groups.py +++ b/synapse/rest/client/groups.py @@ -15,7 +15,7 @@ import logging from functools import wraps -from typing import TYPE_CHECKING, Optional, Tuple +from typing import TYPE_CHECKING, Any, Awaitable, Callable, Optional, Tuple from twisted.web.server import Request @@ -43,14 +43,18 @@ if TYPE_CHECKING: logger = logging.getLogger(__name__) -def _validate_group_id(f): +def _validate_group_id( + f: Callable[..., Awaitable[Tuple[int, JsonDict]]] +) -> Callable[..., Awaitable[Tuple[int, JsonDict]]]: """Wrapper to validate the form of the group ID. Can be applied to any on_FOO methods that accepts a group ID as a URL parameter. """ @wraps(f) - def wrapper(self, request: Request, group_id: str, *args, **kwargs): + def wrapper( + self: RestServlet, request: Request, group_id: str, *args: Any, **kwargs: Any + ) -> Awaitable[Tuple[int, JsonDict]]: if not GroupID.is_valid(group_id): raise SynapseError(400, "%s is not a legal group ID" % (group_id,)) |