Skip to content

helakit.phone

helakit.phone

Sri Lankan phone-number validation.

PhoneError

Bases: HelakitError

Raised for unrecoverable phone-related programmer errors.

is_valid_phone

is_valid_phone(value: str) -> bool

Return True if value is a valid Sri Lankan phone number.

Raises:

Type Description
NotImplementedError

Phone validation has not been implemented yet.

validate_phone

validate_phone(value: str) -> ValidationResult

Validate a Sri Lankan phone number.

Parameters:

Name Type Description Default
value str

The phone number, either local ("0712345678") or international ("+94712345678") form.

required

Returns:

Name Type Description
A ValidationResult

class:ValidationResult with the carrier and number type

ValidationResult

populated when valid.

Raises:

Type Description
NotImplementedError

Phone validation has not been implemented yet.