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.PhoneNumber(instance)[source]¶
Bases:
str
,phantom.base.Phantom
- class phantom.ext.phonenumbers.FormattedPhoneNumber(instance)[source]¶
Functions¶
- phantom.ext.phonenumbers.is_phone_number(phone_number, country_code=None)¶
- Parameters
phone_number (str) –
country_code (str | None) –
- Return type
- phantom.ext.phonenumbers.is_formatted_phone_number(number)[source]¶
- Parameters
number (
str
) –- Return type
bool