Additional type hints for client REST servlets (part 4) (#10728)

This commit is contained in:
Patrick Cloke 2021-09-01 11:59:32 -04:00 committed by GitHub
parent dc75fb7f05
commit d1f1b46c2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 145 additions and 100 deletions

View file

@ -375,11 +375,7 @@ class RegistrationTokenValidityRestServlet(RestServlet):
unstable=True,
)
def __init__(self, hs):
"""
Args:
hs (synapse.server.HomeServer): server
"""
def __init__(self, hs: "HomeServer"):
super().__init__()
self.hs = hs
self.store = hs.get_datastore()
@ -390,7 +386,7 @@ class RegistrationTokenValidityRestServlet(RestServlet):
burst_count=hs.config.ratelimiting.rc_registration_token_validity.burst_count,
)
async def on_GET(self, request):
async def on_GET(self, request: Request) -> Tuple[int, JsonDict]:
await self.ratelimiter.ratelimit(None, (request.getClientIP(),))
if not self.hs.config.enable_registration:
@ -730,7 +726,11 @@ class RegisterRestServlet(RestServlet):
return 200, return_dict
async def _do_appservice_registration(
self, username, as_token, body, should_issue_refresh_token: bool = False
self,
username: str,
as_token: str,
body: JsonDict,
should_issue_refresh_token: bool = False,
) -> JsonDict:
user_id = await self.registration_handler.appservice_register(
username, as_token