mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-06 19:24:12 -04:00
Add types to synapse.util. (#10601)
This commit is contained in:
parent
ceab5a4bfa
commit
524b8ead77
41 changed files with 400 additions and 253 deletions
|
@ -14,6 +14,10 @@
|
|||
|
||||
import logging
|
||||
import re
|
||||
import typing
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
from synapse.server import HomeServer
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -28,13 +32,13 @@ logger = logging.getLogger(__name__)
|
|||
MAX_EMAIL_ADDRESS_LENGTH = 500
|
||||
|
||||
|
||||
def check_3pid_allowed(hs, medium, address):
|
||||
def check_3pid_allowed(hs: "HomeServer", medium: str, address: str) -> bool:
|
||||
"""Checks whether a given format of 3PID is allowed to be used on this HS
|
||||
|
||||
Args:
|
||||
hs (synapse.server.HomeServer): server
|
||||
medium (str): 3pid medium - e.g. email, msisdn
|
||||
address (str): address within that medium (e.g. "wotan@matrix.org")
|
||||
hs: server
|
||||
medium: 3pid medium - e.g. email, msisdn
|
||||
address: address within that medium (e.g. "wotan@matrix.org")
|
||||
msisdns need to first have been canonicalised
|
||||
Returns:
|
||||
bool: whether the 3PID medium/address is allowed to be added to this HS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue