INNER CODE UNIT · Python

normalized_style_name

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

def normalized_style_name(value: Any) -> str:
    return re.sub(r"\s+", " ", str(value or "")).strip()[:40]


def normalized_style_description(value: Any) -> str:
    return re.sub(r"\s+", " ", str(value or "")).strip()[:100]


def normalized_style_recipe(value: Any) -> str:
    return re.sub(r"\s+", " ", str(value or "")).strip()[:2000]


def load_custom_styles() -> list[dict[str, Any]]:
    if not STYLES_PATH.exists():
        return []
    try:
        data = json.loads(STYLES_PATH.read_text(encoding="utf-8"))
    except (OSError, json.JSONDecodeError):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…