mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-11 19:14:00 +01:00
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
file length / file-length (push) Has been cancelled
holds pre-commit / pre-commit (push) Has been cancelled
holds tests / test (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
palette drift / palette (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
shared gate tests / gate unit tests (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWVSoczW2NHQd887FUm
21 lines
980 B
Markdown
21 lines
980 B
Markdown
# holds
|
|
|
|
Declared time-boxed holds (contract v1): while a hold is active every gate
|
|
(focus-guard, diet-guard, screen-locker prompts) stands down so the PC stays
|
|
usable, e.g. for a proctored test. Stdlib only; gates import it from the system python.
|
|
|
|
```python
|
|
import holds
|
|
|
|
holds.active(now=None) # Hold | None (corrupt file -> None, logged: fail closed)
|
|
holds.covers("diet-guard") # bool; v1: every gate
|
|
holds.next_change(now=None) # datetime | None: active hold's end, else next start
|
|
holds.add(start, end, "reason of 10+ chars") # raises HoldsError on a ratchet breach
|
|
holds.remove(hold_id) # only before it starts
|
|
```
|
|
|
|
Ratchet (R11): each hold <= 15 h, <= 3 per ISO week (by start), start >= now + 30 min,
|
|
reason >= 10 chars, no overlaps, whole-minute times, existing holds are never edited.
|
|
Data: `$HOLDS_DATA` or `~/.local/share/holds/holds.json`, local naive times.
|
|
Install: `./install.sh` (editable, `/usr/bin/python3`). Tests: `python3 -m pytest`.
|