utils/earned_time/earned_time/_gaming.py
Krzysztof kuhy Rudnicki 0d9974c194
Some checks failed
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
earned_time pre-commit / pre-commit (push) Has been cancelled
earned_time tests / test (push) Has been cancelled
earned_time 0.22.0: gaming budget switch off
Dated switch GAMING_UNLIMITED_FROM (2026-11-16) and gaming_enforced(day);
Resolution.gaming_enforced; leisure_active False from it; sick shutdown
uses rung pay from it. No public name removed; shutdown unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWViGJJaqBKGr1Hbppr
2026-11-16 15:57:14 +01:00

39 lines
1.5 KiB
Python

# Copyright (c) 2026 Krzysztof Rudnicki
"""The gaming stick is gone: from ``GAMING_UNLIMITED_FROM`` nothing limits gaming.
kuhy's decision (2026-11-16): the daily gaming budget is removed completely.
Only shutdown time is the carrot -- everything done still shuts down at 23:00,
the ladder, its floor and every rung are unchanged. A removed limit is
raise-only, so the date is the day the decision was taken and it lands the
same day.
Nothing is deleted: ``gaming_minutes``, ``GAMING_*`` and the leisure API keep
resolving numbers (history, the shadow budget), so a consumer still importing
them keeps working. A consumer that *applies* a gaming budget must ask
:func:`gaming_enforced` (or read ``Resolution.gaming_enforced``) first and, on
``False``, lift the limit instead of enforcing the number.
"""
from __future__ import annotations
from datetime import date
from typing import Final
# The first day without a gaming budget. A gaming day (06:00 start): a consumer
# billing before 06:00 passes the gaming day, not the calendar day.
GAMING_UNLIMITED_FROM: Final = date(2026, 11, 16)
def gaming_enforced(day: date) -> bool:
"""Is a gaming budget enforced on ``day``? ``False`` from the switch date.
Args:
day: The gaming day.
Returns:
``day < GAMING_UNLIMITED_FROM``. Before it the budget is exactly what
0.21.0 resolved; from it ``resolve(...).gaming_minutes`` is history,
not a limit.
"""
return day < GAMING_UNLIMITED_FROM