"""Requires the phonenumbers_ package which can be installed with:.. _phonenumbers: https://pypi.org/project/phonenumbers/.. code-block:: bash $ python3 -m pip install phantom-types[phonenumbers]"""from__future__importannotationsfromtypingimportFinalfromtypingimportcastimportphonenumbersfromtyping_extensionsimportTypeGuardfromphantomimportPhantomfromphantom.boundsimportparse_strfromphantom.fnimportexceptsfromphantom.schemaimportSchema__all__=("InvalidPhoneNumber","normalize_phone_number","is_phone_number","is_formatted_phone_number","PhoneNumber","FormattedPhoneNumber",)
[docs]@classmethoddefparse(cls,instance:object)->FormattedPhoneNumber:""" Normalize number using :py:const:`phonenumbers.PhoneNumberFormat.E164`. :raises InvalidPhoneNumber: """returnnormalize_phone_number(parse_str(instance))