Download app/platform/runtime/ids.py from LifeVta/Grok3API: direct link, hf CLI and curl.
- Browser
- Download file 469 Bytes
-
https://huggingface.co/spaces/LifeVta/Grok3API/resolve/main/app/platform/runtime/ids.py
- Command line
-
hf download hf://spaces/LifeVta/Grok3API/app/platform/runtime/ids.py
-
curl -L -o ids.py https://huggingface.co/spaces/LifeVta/Grok3API/resolve/main/app/platform/runtime/ids.py
469 Bytes
| """Compact, monotonic lease-id generation without UUID overhead.""" | |
| import threading | |
| _lock = threading.Lock() | |
| _counter: int = 0 | |
| def next_id() -> int: | |
| """Return a process-local monotonically increasing integer id.""" | |
| global _counter | |
| with _lock: | |
| _counter += 1 | |
| return _counter | |
| def next_hex(length: int = 12) -> str: | |
| """Return a zero-padded hex string derived from the monotonic counter.""" | |
| return format(next_id(), f"0{length}x") | |