eidos.utils
Core utility functions for EidosUI.
Get a dictionary mapping URL paths to static file directories.
This provides a safe way to mount only specific static assets without exposing Python source files.
Args:
markdown: Whether to include markdown plugin CSS (default: False)
Returns:
Dict mapping mount paths to directory paths
Example:
>>> from fastapi.staticfiles import StaticFiles >>> from eidos.utils import get_eidos_static_files >>> # Basic usage - just core CSS and JS >>> for mount_path, directory in get_eidos_static_files().items(): ... app.mount(mount_path, StaticFiles(directory=directory), name=mount_path.strip('/')) >>> >>> # Include markdown CSS >>> for mount_path, directory in get_eidos_static_files(markdown=True).items(): ... app.mount(mount_path, StaticFiles(directory=directory), name=mount_path.strip('/'))
Parameters:
markdown: <class 'bool'> = False
Returns: dict[str, str]
Concatenate CSS classes, filtering out None values and flattening lists.
Args:
*classes: Variable number of class strings, lists of strings, or None values
Returns:
A single space-separated string of CSS classes
Examples:
>>> stringify("btn", "btn-primary")
"btn btn-primary">>> stringify("btn", None, "btn-lg")
"btn btn-lg">>> stringify(["btn", "btn-primary"], "mt-4")
"btn btn-primary mt-4"Parameters:
classes: str | list[str] | None
Returns: <class 'str'>