mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 19:47:38 +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
141 lines
3.2 KiB
Python
141 lines
3.2 KiB
Python
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
"""Shared lock-window and HMAC log-integrity backend for blocking-overlay apps.
|
|
|
|
Used by ``screen-locker``, ``diet-guard`` and ``wake-alarm``, which all need
|
|
the same thing: cover every monitor the user can actually see, take the input
|
|
grab, and stay up until their own condition is met.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from gatelock._arbiter import (
|
|
RANK_DIET_GUARD,
|
|
RANK_SCREEN_LOCKER,
|
|
RANK_WAKE_ALARM,
|
|
Arbiter,
|
|
ArbiterVerdict,
|
|
Claim,
|
|
default_runtime_dir,
|
|
grab_strength,
|
|
)
|
|
from gatelock._detect import OutputChangeDetector
|
|
from gatelock._escape import (
|
|
EscapeDraft,
|
|
EscapeHistory,
|
|
EscapePolicy,
|
|
EscapeTracker,
|
|
)
|
|
from gatelock._fitcheck import FitResult, measure_fit, report_fit
|
|
from gatelock._guards import assert_not_under_pytest, wait_for_x_server
|
|
from gatelock._keyboard import bind_activate, bind_cancel, escape_text_tab_trap
|
|
from gatelock._outputs import (
|
|
Output,
|
|
OutputEnumerator,
|
|
OutputRect,
|
|
OutputScan,
|
|
enumerate_outputs,
|
|
)
|
|
from gatelock._queue import (
|
|
QUEUE_DEADLINE_SECONDS,
|
|
QUEUE_HEARTBEAT_SECONDS,
|
|
QUEUE_POLL_SECONDS,
|
|
QueueResult,
|
|
Timebase,
|
|
stronger_claims,
|
|
wait_for_turn,
|
|
)
|
|
from gatelock._randr import RandrBackend
|
|
from gatelock._recovery import RecoveryLoop, RecoveryReport
|
|
from gatelock._root import GateRoot
|
|
from gatelock._scrollable import ScrollableSurface
|
|
from gatelock._surfaces import (
|
|
SurfaceBuilder,
|
|
SurfaceDelta,
|
|
SurfaceInfo,
|
|
SurfaceSet,
|
|
mirror_text_widgets,
|
|
needs_backdrop_root,
|
|
)
|
|
from gatelock._vt import disable_vt_switching, restore_vt_switching
|
|
from gatelock._window import (
|
|
LockConfig,
|
|
LockWindow,
|
|
LockWindowHooks,
|
|
SpaceStep,
|
|
TypeRole,
|
|
)
|
|
from gatelock._xrandr import parse_xrandr_query
|
|
from gatelock.widget_group import WidgetGroup
|
|
from gatelock.widgets import (
|
|
DEFAULT_WRAP,
|
|
ButtonStyle,
|
|
ButtonVariant,
|
|
RowStyle,
|
|
heading,
|
|
make_button,
|
|
row,
|
|
)
|
|
|
|
__all__ = [
|
|
"DEFAULT_WRAP",
|
|
"QUEUE_DEADLINE_SECONDS",
|
|
"QUEUE_HEARTBEAT_SECONDS",
|
|
"QUEUE_POLL_SECONDS",
|
|
"RANK_DIET_GUARD",
|
|
"RANK_SCREEN_LOCKER",
|
|
"RANK_WAKE_ALARM",
|
|
"Arbiter",
|
|
"ArbiterVerdict",
|
|
"ButtonStyle",
|
|
"ButtonVariant",
|
|
"Claim",
|
|
"EscapeDraft",
|
|
"EscapeHistory",
|
|
"EscapePolicy",
|
|
"EscapeTracker",
|
|
"FitResult",
|
|
"GateRoot",
|
|
"LockConfig",
|
|
"LockWindow",
|
|
"LockWindowHooks",
|
|
"Output",
|
|
"OutputChangeDetector",
|
|
"OutputEnumerator",
|
|
"OutputRect",
|
|
"OutputScan",
|
|
"QueueResult",
|
|
"RandrBackend",
|
|
"RecoveryLoop",
|
|
"RecoveryReport",
|
|
"RowStyle",
|
|
"ScrollableSurface",
|
|
"SpaceStep",
|
|
"SurfaceBuilder",
|
|
"SurfaceDelta",
|
|
"SurfaceInfo",
|
|
"SurfaceSet",
|
|
"Timebase",
|
|
"TypeRole",
|
|
"WidgetGroup",
|
|
"assert_not_under_pytest",
|
|
"bind_activate",
|
|
"bind_cancel",
|
|
"default_runtime_dir",
|
|
"disable_vt_switching",
|
|
"enumerate_outputs",
|
|
"escape_text_tab_trap",
|
|
"grab_strength",
|
|
"heading",
|
|
"make_button",
|
|
"measure_fit",
|
|
"mirror_text_widgets",
|
|
"needs_backdrop_root",
|
|
"parse_xrandr_query",
|
|
"report_fit",
|
|
"restore_vt_switching",
|
|
"row",
|
|
"stronger_claims",
|
|
"wait_for_turn",
|
|
"wait_for_x_server",
|
|
]
|