INNER CODE UNIT · Python

style_name_conflicts

ChenShuo2004/cs-board · webapp/server.py:339

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"]
        if item.get("builtin") and definition
        else f"/api/styles/{item.get('id')}/image" if image_filename and image_path.is_file() else "/styles/minimal-whiteboard.webp"
    )
    return {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…