Function bodies 4 total
guides function · python · L54-L76 (23 LOC)src/facil/data.py
def guides(*, lang: str | None = None, category: str | None = None) -> list[dict]:
"""Get tech guides for seniors.
Args:
lang: Filter by language code (en, es, fr, pt, it).
category: Filter by category slug.
Returns:
List of guide dicts.
Examples:
>>> import facil
>>> spanish = facil.guides(lang="es")
>>> security = facil.guides(category="security")
Browse all: https://facil.guide
"""
result = GUIDES
if lang:
result = [g for g in result if lang in g["languages"]]
if category:
result = [g for g in result if g["category"] == category]
return resultcategories function · python · L79-L85 (7 LOC)src/facil/data.py
def categories() -> list[dict]:
"""Get all guide categories.
Returns:
List of category dicts with slug, name, and description.
"""
return list(CATEGORIES)languages function · python · L88-L94 (7 LOC)src/facil/data.py
def languages() -> list[dict]:
"""Get all available languages.
Returns:
List of language dicts with code, name, and URL.
"""
return list(LANGUAGES)search function · python · L97-L113 (17 LOC)src/facil/data.py
def search(query: str, *, lang: str | None = None) -> list[dict]:
"""Search guides by title.
Args:
query: Search term (case-insensitive).
lang: Filter by language.
Returns:
List of matching guides.
Examples:
>>> facil.search("whatsapp")
[{'title': 'How to Set Up WhatsApp', ...}]
"""
q = query.lower()
results = guides(lang=lang)
return [g for g in results if q in g["title"].lower()]