mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-21 11:32:28 +01:00
Put my logo everywhere
Todo: 7808ee0a
This commit is contained in:
parent
0d86c41ee7
commit
73b3698421
@ -8,6 +8,8 @@ import datetime as dt
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from app_errors import ingest, store
|
||||
from app_errors.rtdb import DEFAULT_SESSION, RtdbError, open_rtdb
|
||||
|
||||
@ -16,7 +18,11 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
def _parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(prog="app-errors", description=__doc__)
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="app-errors",
|
||||
description=__doc__,
|
||||
epilog=credit_line(),
|
||||
)
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
run = sub.add_parser("ingest", help="read RTDB and the spool, write the board reports")
|
||||
run.add_argument("--keep", action="store_true", help="leave RTDB entries in place")
|
||||
|
||||
@ -187,3 +187,13 @@ def test_default_paths_follow_xdg(monkeypatch: pytest.MonkeyPatch, tmp_path: Pat
|
||||
assert paths.reports == tmp_path / "app-errors"
|
||||
assert paths.spool == tmp_path / "app-errors-spool"
|
||||
assert paths.state == tmp_path / "app-errors-ingest" / "state.json"
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
cli.main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -5,6 +5,7 @@ description = "Shared app error and slow-wait ingest: RTDB and local spool repor
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
|
||||
@ -9,6 +9,8 @@ import logging
|
||||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from feedback_inbox._inbox import Importer, Outcome, Waiter, run_settled
|
||||
from feedback_inbox._paths import resolve_paths
|
||||
from feedback_inbox._todo import McpTodoClient
|
||||
@ -25,7 +27,10 @@ DEFAULT_WAIT = 15.0
|
||||
|
||||
|
||||
def _parser() -> argparse.ArgumentParser:
|
||||
parser = argparse.ArgumentParser(prog="feedback-inbox")
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="feedback-inbox",
|
||||
epilog=credit_line(),
|
||||
)
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
run = sub.add_parser("run", help="import new bundles as todo tasks")
|
||||
run.add_argument("--wait", type=float, default=DEFAULT_WAIT)
|
||||
|
||||
@ -101,3 +101,13 @@ def test_real_paths_are_under_home(
|
||||
def test_module_entry_point(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr("sys.argv", ["feedback-inbox", "run", "--wait", "0"])
|
||||
assert entry.run() == 0
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -7,7 +7,9 @@ name = "feedback-inbox"
|
||||
version = "0.1.0"
|
||||
description = "Turns every game dev-feedback bundle into one todo-app task"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = []
|
||||
dependencies = [
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
feedback-inbox = "feedback_inbox._cli:main"
|
||||
|
||||
@ -18,6 +18,8 @@ import argparse
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from freedays._api import is_free_day as _is_free_day
|
||||
from freedays._api import mark, release, status
|
||||
from freedays._cli_output import emit, emit_error
|
||||
@ -41,6 +43,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
||||
"One shared pool of days on which every gate app stands down. "
|
||||
f"{DEFAULT_ANNUAL_BUDGET} per calendar year, resetting Jan 1."
|
||||
),
|
||||
epilog=credit_line(),
|
||||
)
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
|
||||
|
||||
@ -153,3 +153,13 @@ def test_sync_quiet_exits_zero_when_there_is_no_remote(
|
||||
monkeypatch.setattr("freedays._sync.get_client", _refuse)
|
||||
assert main(["sync-quiet"]) == 0
|
||||
assert "no remote available" in capsys.readouterr().out
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -13,6 +13,7 @@ requires-python = ">=3.14"
|
||||
# ~15 lines of HMAC that were wanted live in freedays/_hmac.py instead.
|
||||
dependencies = [
|
||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
|
||||
@ -16,6 +16,8 @@ import urllib.request
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from pathlib import Path
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from omniroute_offload import _privacy as privacy
|
||||
|
||||
ENDPOINT = "http://127.0.0.1:20128/v1/chat/completions"
|
||||
@ -38,7 +40,9 @@ class GatewayError(RuntimeError):
|
||||
def parse(argv: list[str]) -> argparse.Namespace:
|
||||
"""Command-line options."""
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="free-llm", description=__doc__.splitlines()[0]
|
||||
prog="free-llm",
|
||||
description=__doc__.splitlines()[0],
|
||||
epilog=credit_line(),
|
||||
)
|
||||
parser.add_argument("prompt", help="question or instruction")
|
||||
parser.add_argument(
|
||||
|
||||
@ -192,3 +192,13 @@ def test_tty_stdin_is_not_read(
|
||||
monkeypatch.setattr(sys, "stdin", Tty("must not be sent"))
|
||||
assert cli.main(["hi"]) == 0
|
||||
assert "must not be sent" not in sent[0]["messages"][-1]["content"]
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
cli.main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -7,7 +7,9 @@ name = "omniroute_offload"
|
||||
version = "0.1.0"
|
||||
description = "Offload easy LLM work to free models behind the local OmniRoute gateway"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = []
|
||||
dependencies = [
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
free-llm = "omniroute_offload._cli:main"
|
||||
|
||||
@ -14,6 +14,7 @@ requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
||||
"freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.3#subdirectory=freedays",
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit",
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
|
||||
@ -25,6 +25,8 @@ import importlib
|
||||
import sys
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
from sickdays._api import add_sick_day, is_sick_day, load, remove_sick_day
|
||||
from sickdays._cli_output import emit, emit_error
|
||||
from sickdays._constants import LOCKERS
|
||||
@ -56,6 +58,7 @@ def _build_parser() -> argparse.ArgumentParser:
|
||||
"One shared pool of sick days every gate respects. No cap, no "
|
||||
"reason; today or later only."
|
||||
),
|
||||
epilog=credit_line(),
|
||||
)
|
||||
sub = parser.add_subparsers(dest="command", required=True)
|
||||
add = sub.add_parser("add", help="mark a day sick (today or later)")
|
||||
|
||||
@ -17,6 +17,8 @@ from __future__ import annotations
|
||||
import tkinter as tk
|
||||
from typing import TYPE_CHECKING, Final
|
||||
|
||||
from kuhy_credit.tk import KuhyCredit
|
||||
|
||||
from sickdays._api import is_sick_day, load
|
||||
from sickdays._day import to_iso, today
|
||||
from sickdays._keep_api import kept_lockers
|
||||
@ -84,6 +86,10 @@ class SickDaysApp:
|
||||
self._list = tk.Frame(left, name="upcoming", bg=tok.INK)
|
||||
self._list.pack(anchor="w", fill="x")
|
||||
self._draw_upcoming()
|
||||
# Credit in the bottom-right corner of the window
|
||||
KuhyCredit(root, theme="dark").place(
|
||||
relx=1, rely=1, x=-tok.LG, y=-tok.LG, anchor="se"
|
||||
)
|
||||
|
||||
def close(self, _event: object = None) -> None:
|
||||
"""Close the window (bound to ``Escape``)."""
|
||||
|
||||
@ -196,3 +196,13 @@ def test_importing_the_library_and_cli_never_imports_tkinter() -> None:
|
||||
)
|
||||
done = subprocess.run([sys.executable, "-c", probe], check=False)
|
||||
assert done.returncode == 0
|
||||
|
||||
|
||||
def test_help_ends_with_credit_line(capsys: pytest.CaptureFixture[str]) -> None:
|
||||
"""--help output ends with the kuhy credit line."""
|
||||
from kuhy_credit import credit_line
|
||||
|
||||
with pytest.raises(SystemExit):
|
||||
main(["--help"])
|
||||
out = capsys.readouterr().out
|
||||
assert out.strip().endswith(credit_line())
|
||||
|
||||
@ -27,9 +27,22 @@ LETTER = re.compile(r"[^\W\d_]")
|
||||
|
||||
|
||||
def _shown(widget: tk.Misc) -> list[str]:
|
||||
"""Every string ``widget`` and its descendants paint."""
|
||||
"""Every string ``widget`` and its descendants paint, except the credit."""
|
||||
found: list[str] = []
|
||||
# Find the credit panel frame in the toplevel so we can skip it
|
||||
credit_panel = None
|
||||
for child in widget.winfo_children():
|
||||
if child.__class__.__name__ == "KuhyCredit" and hasattr(child, "panel"):
|
||||
credit_panel = child.panel
|
||||
break
|
||||
|
||||
for child in widget.winfo_children():
|
||||
# Skip the KuhyCredit widget (Canvas)
|
||||
if child.__class__.__name__ == "KuhyCredit":
|
||||
continue
|
||||
# Skip the credit panel Frame (in toplevel) and its children
|
||||
if credit_panel is not None and child == credit_panel:
|
||||
continue
|
||||
if isinstance(child, tk.Canvas):
|
||||
# Raw Tcl: typeshed types Canvas.type()/itemcget() too loosely.
|
||||
path = str(child)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user