INNER CODE UNIT · Python

_safe_export_segment

wzn1118/AsteriaAnalyst · backend/app/main.py:179

def _safe_export_segment(value: str, fallback: str = "default") -> str:
    segment = re.sub(r"[^A-Za-z0-9._-]+", "-", str(value or "").strip()).strip(".-")
    return segment[:80] or fallback


def _auto_analysis_export_paths(payload: AutoAnalysisRequest, *, surface: str) -> tuple[Path, str]:
    stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
    dataset = _safe_export_segment(payload.dataset_id, "dataset")
    sheet = _safe_export_segment(payload.active_sheet or "sheet", "sheet")
    part = _safe_export_segment(payload.report_part or "auto", "auto")
    relative = Path("auto-analysis") / dataset / f"{stamp}-{surface}-{sheet}-{part}"
    return PUBLIC_ARTIFACTS_DIR / relative, f"/storage/{relative.as_posix()}"


INTEGRATIONS = [
    {
        "name": "Next.js",
        "repo": "https://github.com/vercel/next.js",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…