Download app/platform/storage/contract.py from LifeVta/Grok3API: direct link, hf CLI and curl.
- Browser
- Download file 601 Bytes
-
https://huggingface.co/spaces/LifeVta/Grok3API/resolve/main/app/platform/storage/contract.py
- Command line
-
hf download hf://spaces/LifeVta/Grok3API/app/platform/storage/contract.py
-
curl -L -o contract.py https://huggingface.co/spaces/LifeVta/Grok3API/resolve/main/app/platform/storage/contract.py
601 Bytes
| """Abstract storage contract used by all persistence backends.""" | |
| from typing import Any, Protocol, runtime_checkable | |
| class LockHandle(Protocol): | |
| """Async context manager representing a distributed lock.""" | |
| async def __aenter__(self) -> "LockHandle": ... | |
| async def __aexit__(self, *_: Any) -> None: ... | |
| class StorageError(Exception): | |
| """Base class for all storage-layer errors.""" | |
| class LockAcquisitionError(StorageError): | |
| """Raised when a lock cannot be acquired within the timeout.""" | |
| __all__ = ["LockHandle", "StorageError", "LockAcquisitionError"] | |