Initial commit

This commit is contained in:
2026-08-19 19:34:30 +08:00
commit beba8744b4
285 changed files with 74293 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
from __future__ import annotations
import json
from collections.abc import AsyncIterator
from typing import Any
def event(name: str, data: dict[str, Any]) -> bytes:
return f"event: {name}\ndata: {json.dumps(data, ensure_ascii=False)}\n\n".encode("utf-8")
async def one_event(name: str, data: dict[str, Any]) -> AsyncIterator[bytes]:
yield event(name, data)