Files
computer-playbook/utils/symbol_glossary.py
evangelostsak 614d0e331c feat(glossary): read the mesh axis at a glance
A padlock and an open padlock differ by a few pixels in a job title, which
is where the axis is read most often. A tunnel and a road do not.

Every label derives from here, the plan table's own column header included,
so the two entries carry the change.
2026-10-05 12:00:06 +02:00

88 lines
2.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Single source of truth mapping short words to display emojis, and back.
Every emoji used as a STRUCTURED marker across the project (complexity-matrix
columns, lifecycle stages, deploy modes, boolean/state cells) is defined here
exactly once, so a glyph means the same thing everywhere it appears. Emojis are
unique: the module fails to import if two words share a glyph.
Look up with :func:`to_emoji` (word -> emoji) and :func:`to_word` (emoji ->
canonical word); both pass unknown input through unchanged.
"""
from __future__ import annotations
SYMBOLS: dict[str, str] = {
"enabled": "✅",
"disabled": "❌",
"skip": "⏭️",
"priority": "⭐",
"instructions": "📖",
"distros": "🐧",
"arch": "🏹",
"debian": "🌀",
"ubuntu": "🟠",
"fedora": "🎩",
"centos": "🟣",
"filesystem": "🗄️",
"zfs": "🦓",
"btrfs": "🦋",
"ext4": "🐘",
"unavailable": "➖",
"integrated": "🧩",
"role_dependency": "⚙️",
"compose": "🐳",
"swarm": "🐝",
"tor": "🧅",
"clearnet": "🌐",
"vpn": "🚇",
"direct": "🛣️",
"stack": "🥞",
"host": "💻",
"row": "🔢",
"id": "🆔",
"name": "📛",
"in_main": "🌳",
"lifecycle": "🌱",
"variant": "🎯",
"variants": "🔀",
"chunk": "📦",
"mode": "🚀",
"test_compose": "🐋",
"test_swarm": "🍯",
"test_host": "🏠",
"embeds_direct": "⏩",
"embeds": "📥",
"consumers_direct": "⏪",
"consumers": "📤",
"weight": "📊",
"random": "🎲",
"dna": "🧬",
"clone": "🐑",
"siblings": "👯",
"covered_by": "🔰",
"redundant": "✂️",
"planned": "🧭",
"pre-alpha": "🧪",
"alpha": "🐣",
"beta": "🌿",
"rc": "🚦",
"stable": "🟢",
"maintenance": "🔧",
"deprecated": "🚫",
"eol": "🪦",
}
_BY_EMOJI: dict[str, str] = {emoji: word for word, emoji in SYMBOLS.items()}
if len(_BY_EMOJI) != len(SYMBOLS):
raise ValueError("symbol_glossary: every emoji MUST be unique across words")
def to_emoji(word: str) -> str:
"""Return the emoji mapped to *word*, or *word* itself when unmapped."""
return SYMBOLS.get(word, word)
def to_word(emoji: str) -> str:
"""Return the canonical word for *emoji*, or *emoji* itself when unmapped."""
return _BY_EMOJI.get(emoji, emoji)