borderless / ui /intake /choices.py
spagestic's picture
data expanded
43b2c38
Raw
History Blame Contribute Delete
890 Bytes
# ui/intake/choices.py
from __future__ import annotations
from functools import lru_cache
from ui.intake.loader import load_intake_choices
_choices = load_intake_choices()
FALLBACK_COUNTRIES = _choices["fallback_countries"]
EDUCATION_CHOICES = _choices["education"]
OCCUPATION_CHOICES = _choices["occupation"]
EXPERIENCE_CHOICES = _choices["experience"]
LANGUAGE_CHOICES = _choices["languages"]
BUDGET_CHOICES = _choices["budget"]
FAMILY_CHOICES = _choices["family"]
TIMELINE_CHOICES = _choices["timeline"]
RESIDENCE_STATUS_CHOICES = _choices["residence_status"]
@lru_cache(maxsize=1)
def country_choices() -> list[str]:
try:
from apis.rest_countries import _country_index
return sorted(
entry["name"] for entry in _country_index()["iso2"].values()
)
except Exception:
return list(FALLBACK_COUNTRIES)