External wrappers#
A collection of phantom types that wraps functionality of well maintained
implementations of third-party validation libraries. Importing from phantom.ext.*
should be a hint that more dependencies need to be installed.
Phone numbers#
Requires the phonenumbers package which can be installed with:
$ python3 -m pip install phantom-types[phonenumbers]
Types#
- class phantom.ext.phonenumbers.FormattedPhoneNumber(instance)[source]#
Bases:
PhoneNumber
Functions#
- phantom.ext.phonenumbers.is_phone_number(phone_number, country_code=None)#
- Parameters:
phone_number (
str
) –country_code (
typing.Optional
[str
]) –
- Return type:
phonenumbers.phonenumber.PhoneNumber
- phantom.ext.phonenumbers.is_formatted_phone_number(number)[source]#
- Parameters:
number (
str
) –- Return type:
bool