screen-locker/screen_locker/_gate_off.py
Krzysztof kuhy Rudnicki 06c50a9231
Some checks failed
dependency freshness / dependencies on newest stable (push) Has been cancelled
md-naming / markdown naming convention (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (flutter, flutter-analyze, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Has been cancelled
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,flutter-analyze) (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / lock-popup-safety (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (0) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (1) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (2) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (3) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (4) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (5) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (6) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (7) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (8) (push) Has been cancelled
Tests / flutter test (shard ${{ matrix.shard }}) (9) (push) Has been cancelled
Tests / web-coverage (push) Has been cancelled
repo-contract / repo contract (push) Has been cancelled
Tests / flutter-coverage (push) Has been cancelled
LeetCode bonus needs the day paid in full (earned_time 0.18.0); gate_off asked live
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-24 13:23:19 +02:00

29 lines
932 B
Python

"""Whether an earner's gate stands down today, asked live (earned_time 0.18.0).
Only LeetCode has a price: while its gate is on, earned_time pays only the
signed charge that covers the whole day, never one solve of five (kuhy,
2026-10-24). A free day or a sick day not keeping ``leetcode`` has no price,
so one verified solve earns. Never stored: clearing the sick day takes the
exception back on the next read.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import earned_time
import freedays
import sickdays
from screen_locker._sick import stands_down
if TYPE_CHECKING:
from datetime import date
def gate_off(earner: earned_time.Earner, day: date) -> bool:
"""Whether ``earner``'s gate is off on ``day`` (always False but LeetCode)."""
if earner.name != earned_time.LEETCODE.name:
return False
return freedays.is_free_day(day) or stands_down(sickdays.LOCKER_LEETCODE, day)