Skip to content

helakit.postal

helakit.postal

Sri Lankan postal-code validation.

PostalError

Bases: HelakitError

Raised for unrecoverable postal-code-related programmer errors.

is_valid_postal

is_valid_postal(value: str) -> bool

Return True if value is a valid Sri Lankan postal code.

Raises:

Type Description
NotImplementedError

Postal-code validation has not been implemented yet.

validate_postal

validate_postal(value: str) -> ValidationResult

Validate a Sri Lankan postal code.

Parameters:

Name Type Description Default
value str

A five-digit postal code.

required

Returns:

Name Type Description
A ValidationResult

class:ValidationResult with the matching district and

ValidationResult

province populated when valid.

Raises:

Type Description
NotImplementedError

Postal-code validation has not been implemented yet.