Add type hints to get_domain_from_id and get_localpart_from_id. (#10385)

This commit is contained in:
Patrick Cloke 2021-07-13 12:08:47 -04:00 committed by GitHub
parent 2d16e69b4b
commit 30b56f6925
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 26 deletions

View file

@ -182,14 +182,14 @@ def create_requester(
)
def get_domain_from_id(string):
def get_domain_from_id(string: str) -> str:
idx = string.find(":")
if idx == -1:
raise SynapseError(400, "Invalid ID: %r" % (string,))
return string[idx + 1 :]
def get_localpart_from_id(string):
def get_localpart_from_id(string: str) -> str:
idx = string.find(":")
if idx == -1:
raise SynapseError(400, "Invalid ID: %r" % (string,))