INNER CODE UNIT · Python
all_style_records
ChenShuo2004/cs-board · webapp/server.py:335
def all_style_records(items: list[dict[str, Any]]) -> list[dict[str, Any]]:
return builtin_style_records(items) + [item for item in items if not item.get("builtin")]
def style_name_conflicts(name: str, items: list[dict[str, Any]], exclude_id: str = "") -> bool:
return any(
candidate.get("id") != exclude_id
and (candidate.get("name") == name or name in candidate.get("aliases", []))
for candidate in all_style_records(items)
)
def style_snapshot(item: dict[str, Any]) -> dict[str, Any]:
image_filename = str(item.get("image_filename") or "")
image_path = STYLES_DIR / str(item.get("id")) / image_filename
definition = BUILTIN_STYLE_BY_ID.get(str(item.get("id")))
image_url = (
definition["image_url"]