mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 00:24:54 -04:00
Add missing type hints to synapse.util (#9982)
This commit is contained in:
parent
22a8838f62
commit
7adcb20fc0
9 changed files with 39 additions and 25 deletions
|
@ -17,19 +17,19 @@ import phonenumbers
|
|||
from synapse.api.errors import SynapseError
|
||||
|
||||
|
||||
def phone_number_to_msisdn(country, number):
|
||||
def phone_number_to_msisdn(country: str, number: str) -> str:
|
||||
"""
|
||||
Takes an ISO-3166-1 2 letter country code and phone number and
|
||||
returns an msisdn representing the canonical version of that
|
||||
phone number.
|
||||
Args:
|
||||
country (str): ISO-3166-1 2 letter country code
|
||||
number (str): Phone number in a national or international format
|
||||
country: ISO-3166-1 2 letter country code
|
||||
number: Phone number in a national or international format
|
||||
|
||||
Returns:
|
||||
(str) The canonical form of the phone number, as an msisdn
|
||||
The canonical form of the phone number, as an msisdn
|
||||
Raises:
|
||||
SynapseError if the number could not be parsed.
|
||||
SynapseError if the number could not be parsed.
|
||||
"""
|
||||
try:
|
||||
phoneNumber = phonenumbers.parse(number, country)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue