Download app/platform/config/backends/base.py from LifeVta/Grok3API: direct link, hf CLI and curl.
- Browser
- Download file 962 Bytes
-
https://huggingface.co/spaces/LifeVta/Grok3API/resolve/main/app/platform/config/backends/base.py
- Command line
-
hf download hf://spaces/LifeVta/Grok3API/app/platform/config/backends/base.py
-
curl -L -o base.py https://huggingface.co/spaces/LifeVta/Grok3API/resolve/main/app/platform/config/backends/base.py
962 Bytes
| """Abstract config backend interface.""" | |
| from abc import ABC, abstractmethod | |
| from typing import Any | |
| class ConfigBackend(ABC): | |
| """Persist and reload user config overrides. | |
| Storage model: flat key-value pairs (dotted keys → JSON-serialised values). | |
| ``load()`` rebuilds the full nested dict from all stored pairs. | |
| ``apply_patch()`` writes *only* the changed keys, leaving the rest untouched. | |
| """ | |
| async def load(self) -> dict[str, Any]: | |
| """Return the full stored user-overrides as a nested dict.""" | |
| async def apply_patch(self, patch: dict[str, Any]) -> None: | |
| """Persist only the keys present in *patch* (nested dict).""" | |
| async def version(self) -> object: | |
| """Return an opaque version token (cheap — called on every request).""" | |
| async def close(self) -> None: | |
| """Release any resources held by the backend (optional).""" | |