mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-17 23:25:05 +01:00
The three Python packages pinned ruff twice at different versions: requirements.txt at 0.16.7, .pre-commit-config.yaml at v0.15.2. Only the older one ever ran, so `select = ["ALL"]` was enforced two minor versions behind. Measured before aligning: v0.15.2 reports 0 findings, every 0.16.x reports CPY001 on each file -- 70 crdt-sync, 23 freedays, 71 gatelock, and no other rule. Resolved by adding the notice rather than ignoring the rule, so the gate keeps its teeth. Two gatelock modules sat at exactly the 250-line cap, so a one-line header tipped them to 251. Both are split along a real seam rather than shaved: _widget_fills.py colour arithmetic over LockConfig, no tkinter import _surfaces_focus.py selects among existing surfaces, never mutates them The focus split keeps _surfaces.py's documented containment (it stays the only module that creates, moves or destroys windows), and the static guard in test_recovery_invariants.py globs _surfaces*.py, so the new sibling is covered with no list to extend. widgets.py re-exports the fills helpers, which keeps gatelock.widgets the single public surface its tests import. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019kMvSMtsVMB3d2uoZ56pbp
86 lines
2.3 KiB
Python
86 lines
2.3 KiB
Python
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
"""One shared pool of pre-declared days on which every gate app stands down.
|
|
|
|
The whole point of this package fits in one call. A gate app asks::
|
|
|
|
import freedays
|
|
|
|
if freedays.is_free_day():
|
|
return # no lock, no dialog, no alarm -- say nothing
|
|
|
|
That is the entire integration. It reads one local file, never the network,
|
|
and answers ``False`` for anything it cannot parse, so the failure mode is
|
|
"the normal rules apply", never "everything is switched off".
|
|
|
|
Two properties are deliberate and load-bearing:
|
|
|
|
* **Nothing here ever initiates.** No notification, no warning when the pool
|
|
runs low, no prompt when a gate fires. The pool is consulted silently and
|
|
reported only when someone runs ``freedays status``.
|
|
* **One global pool.** A free day is free for every app at once. There is no
|
|
per-app dimension to mark, and none to forget to mark.
|
|
|
|
Free days are *not* sick days. Sick days stay where they are, with their
|
|
rolling windows and their justification friction, because they exist to be
|
|
hard to take. These exist to be easy: declared in advance, no reason
|
|
required, consecutive runs allowed, capped only by an annual budget.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from freedays._api import (
|
|
Status,
|
|
actor_id,
|
|
is_free_day,
|
|
load,
|
|
lookup,
|
|
mark,
|
|
release,
|
|
save,
|
|
status,
|
|
)
|
|
from freedays._budget import free_days_in_year, is_exhausted, remaining, spent
|
|
from freedays._constants import DEFAULT_ANNUAL_BUDGET
|
|
from freedays._day import parse_iso, resolve, to_iso, today
|
|
from freedays._errors import (
|
|
AlreadyFreeError,
|
|
BudgetExhaustedError,
|
|
FreeDayError,
|
|
NotFreeError,
|
|
PastDateError,
|
|
)
|
|
from freedays._model import FreeDay
|
|
from freedays._paths import Paths
|
|
from freedays._sync import SyncUnavailableError, sync, sync_quietly
|
|
|
|
__all__ = [
|
|
"DEFAULT_ANNUAL_BUDGET",
|
|
"AlreadyFreeError",
|
|
"BudgetExhaustedError",
|
|
"FreeDay",
|
|
"FreeDayError",
|
|
"NotFreeError",
|
|
"PastDateError",
|
|
"Paths",
|
|
"Status",
|
|
"SyncUnavailableError",
|
|
"actor_id",
|
|
"free_days_in_year",
|
|
"is_exhausted",
|
|
"is_free_day",
|
|
"load",
|
|
"lookup",
|
|
"mark",
|
|
"parse_iso",
|
|
"release",
|
|
"remaining",
|
|
"resolve",
|
|
"save",
|
|
"spent",
|
|
"status",
|
|
"sync",
|
|
"sync_quietly",
|
|
"to_iso",
|
|
"today",
|
|
]
|