mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-10 21:47:02 +01:00
Two pre-commit hooks and one pre-push extension, plus the _glyph_art split that had to land first — the cap gate cannot be wired while any file is over it, and the lyricanki note-ascender glyph had taken _glyph_art.py to 253. file-length-cap runs check_file_length.sh --all repo-wide rather than on staged files, so a file that grows past the cap in some other commit is still caught. Proven to block, not assumed: with a deliberate 261-line file staged the hook exits 1 and names it; with the file removed it passes. ci-baseline-green is the user's option (a): refuse to build on a main that is already red. It fails closed on a definitively failing baseline and warns-and- passes on anything it cannot determine — offline, no gh, unauthenticated, no settled runs — each call capped at 5s. Blocking every commit on network reachability buys nothing when (b) is the real per-change guarantee. CI_GREEN_SKIP=1 is the escape for a fix-forward commit. python-tests.yml is excluded on purpose: it is path-filtered, so a shell-only commit never triggers it and its "latest run" would produce false reds. This hook already earned its place. Run against a red main earlier in this session it refused with "Shell tests (failure)", which is how the broken SETUP_SOURCES was found instead of being pushed over. ci_mirror gains the shell-tests workflow's side-effect-free half — every lib/tests/run_all.sh plus the workflow's own test list, the user's option (b). That list is parsed out of shell-tests.yml rather than copied: a hardcoded duplicate drifts the moment someone adds a test, and a mirror that quietly checks less than CI is worse than no mirror because it reports safe. The Arch-container half stays unmirrored — it wants root and an Arch userland. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F3PzGc75gBcdxP3PkHXGcV
100 lines
3.1 KiB
Python
100 lines
3.1 KiB
Python
"""Per-app glyph artwork for the shared icon family.
|
|
|
|
A glyph is a raw SVG fragment drawn in the 1024x1024 master canvas. It does not
|
|
need to be perfectly positioned: :mod:`python_pkg.app_icons.render` measures the
|
|
rendered ink and recentres the fragment, so every icon in the family sits at the
|
|
same optical height.
|
|
|
|
Fragments inherit ``fill="none"``, ``stroke``, ``stroke-width`` and round caps
|
|
from the wrapping group. A fragment that needs a filled silhouette instead
|
|
overrides those locally and uses :data:`~python_pkg.app_icons.style.ACCENT_MARKER`
|
|
for its colour.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Final
|
|
|
|
from python_pkg.app_icons._glyph_art import (
|
|
_ANVIL,
|
|
_BARBELL,
|
|
_CHAIN_LINK,
|
|
_CHECKLIST,
|
|
_CLOCK,
|
|
_CLOUD_DOWN,
|
|
_DECISION_TREE,
|
|
_QUILL_NIB,
|
|
_RECEIPT_SPLIT,
|
|
_SHIELD_CUTLERY,
|
|
_STORAGE_BOX,
|
|
)
|
|
from python_pkg.app_icons._glyph_art_more import _NOTE_ASCENDER, _TRACK_BARS
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Glyph:
|
|
"""One app's artwork.
|
|
|
|
Parameters:
|
|
name (str): Stable identifier, used as the ``--glyph`` CLI value.
|
|
description (str): What the glyph depicts, for ``--list`` output.
|
|
body (str): SVG fragment drawn in the 1024x1024 master canvas.
|
|
"""
|
|
|
|
name: str
|
|
description: str
|
|
body: str
|
|
|
|
|
|
# A cloud silhouette outline with a download arrow underneath: a client that
|
|
# pulls files off a remote dufs server.
|
|
|
|
GLYPHS: Final[dict[str, Glyph]] = {
|
|
glyph.name: glyph
|
|
for glyph in (
|
|
Glyph("cloud-down", "Cloud with a download arrow", _CLOUD_DOWN),
|
|
Glyph("barbell", "Barbell with plates and collars", _BARBELL),
|
|
Glyph("clock", "Clock face with hands", _CLOCK),
|
|
Glyph("shield-cutlery", "Shield guarding a fork and knife", _SHIELD_CUTLERY),
|
|
Glyph("checklist", "Two ticked-off list rows", _CHECKLIST),
|
|
Glyph("chain-link", "Two interlocking chain links", _CHAIN_LINK),
|
|
Glyph("storage-box", "Isometric storage carton", _STORAGE_BOX),
|
|
Glyph("receipt-split", "Torn receipt with a perforated split", _RECEIPT_SPLIT),
|
|
Glyph("quill-nib", "Dip-pen nib with vent hole and slit", _QUILL_NIB),
|
|
Glyph("anvil", "Blacksmith's anvil with horn and flared foot", _ANVIL),
|
|
Glyph(
|
|
"note-ascender",
|
|
"Eighth note whose stem doubles as a letterform ascender on a baseline",
|
|
_NOTE_ASCENDER,
|
|
),
|
|
Glyph("track-bars", "Rising log bars with a plotted trend point", _TRACK_BARS),
|
|
Glyph(
|
|
"decision-tree",
|
|
"Node branching into two levels of child nodes",
|
|
_DECISION_TREE,
|
|
),
|
|
)
|
|
}
|
|
|
|
|
|
def get_glyph(name: str) -> Glyph:
|
|
"""Look up a glyph by name.
|
|
|
|
Parameters:
|
|
name (str): Glyph identifier, e.g. ``"barbell"``.
|
|
|
|
Returns:
|
|
Glyph: The matching glyph.
|
|
|
|
Raises:
|
|
KeyError: If no glyph with that name exists. The message lists the
|
|
available names, since this is usually a CLI typo.
|
|
"""
|
|
try:
|
|
return GLYPHS[name]
|
|
except KeyError:
|
|
available = ", ".join(sorted(GLYPHS))
|
|
msg = f"unknown glyph {name!r}; available: {available}"
|
|
raise KeyError(msg) from None
|