INNER CODE UNIT · Python

_json_sse

Nour833/StegoForge · web/app.py:26

def _json_sse(payload: dict) -> str:
    return f"data: {json.dumps(payload)}\n\n"


def _artifact_allowed(path: Path) -> bool:
    if not path.exists() or not path.is_file():
        return False
    if path.name.startswith(ARTIFACT_PREFIX):
        return True
    if path.name.endswith("_fingerprint_heatmap.png") and path.parent.resolve() == Path.cwd().resolve():
        return True
    return False


def _persist_artifact(data: bytes, suffix: str = ".bin") -> str:
    suffix = suffix if suffix.startswith(".") else f".{suffix}"
    with tempfile.NamedTemporaryFile(prefix=ARTIFACT_PREFIX, suffix=suffix, delete=False) as tmp:
        tmp.write(data)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…