Files
quantumtunnel/quantumpipe/sas.py
T
2026-10-07 03:07:34 +00:00

22 lines
3.2 KiB
Python

"""SAS rendering: map digest bytes to emoji rows from the table below."""
# fmt: off
# ruff: noqa
_EMOJIS: str = '😆😍😭😴😉😇😎🤔😡🤡👻👽🤖💀💩👀👍🙏🚶🏃💃🤷🤦✨⭐🌙🌈🔥💧🌊🌀🌂🐱🐶🐭🐹🐰🦊🐻🐼🐨🦥🦨🦁🐮🐷🐸🐵🐔🐧🐤🦆🦅🦉🦇🐺🐴🦄🐝🐛🐌🐞🐜🪰🦂🦀🦞🦑🐍🦎🐢🐟🐬🐳🦈🐙🐚🐊🐉🦖🐫🦒🦘🐘🦏🐐🐏🐑🐒🐓🦃🦚🦜🦢🦩🐾🌵🌲🌳🌴🌱🌿🍀🍁🍃🌹🌷🌻💐🍄🌰🍎🍐🍊🍋🍌🍉🍇🍓🍒🍑🍍🥝🍅🍆🥑🥦🌽🥕🥔🍞🧀🥚🥞🧇🍔🍟🍕🌭🌮🌯🍚🍛🍜🍝🍣🍪🍰🍩🍬🍭🍯🍵🍶🍺🍷🍸🧃⚽🏀🏈⚾🎾🏐🏉🎱⛳🏆🏅🎯🎳🛷🪁🚗🚕🚌🚚🚜🚲🚆🚇🚊🚀🚁🛸⛵🚢⚓⌚📱💻📷📹📺📻⏰💡🔦🔋🔌📖📌📎🔒🔑🔨🔧🧲🔔🎁🎈🎤🎧🎸🥁🎺🎹🎨🎪🎲🧩💎👑🏠🏫🏦🏰🏭⛪⛲⛺🌉🌋🌍🧭⌛📅📦📁📊💰💼🏹🔭🔬🔮🪑🚽🚿🛁🧹🧺🧽🪣👕👗'
_NAMES = 'laugh love cry sleep wink halo cool think angry clown ghost alien robot skull poop eyes thumbsup pray walk run dance shrug facepalm sparkle star moon rainbow fire drop wave cyclone umbrella cat dog mouse hamster rabbit fox bear panda koala sloth skunk lion cow pig frog monkey chicken penguin chick duck eagle owl bat wolf horse unicorn bee bug snail beetle ant fly scorpion crab lobster squid snake lizard turtle fish dolphin whale shark octopus shell crocodile dragon dino camel giraffe kangaroo elephant rhino goat ram sheep ape rooster turkey peacock parrot swan flamingo paw cactus pine tree palm plant herb clover maple leaf rose tulip sunflower bouquet mushroom chestnut apple pear orange lemon banana melon grape strawberry cherry peach pineapple kiwi tomato eggplant avocado broccoli corn carrot potato bread cheese egg pancake waffle burger fries pizza hotdog taco burrito rice curry ramen spaghetti sushi cookie cake donut candy lollipop honey tea sake beer wine martini juice soccer basketball football baseball tennis volley rugby snooker golf trophy medal target bowling sled kite car taxi bus truck tractor bike train metro tram rocket helicopter ufo boat ship anchor watch phone laptop camera video tv radio clock bulb flashlight battery plug book pin clip lock key hammer wrench magnet bell gift balloon microphone headphones guitar drum trumpet piano palette circus dice puzzle diamond crown house school bank castle factory church fountain tent bridge volcano globe compass hourglass calendar box folder chart money briefcase bow telescope microscope crystal chair toilet shower bathtub broom basket sponge bucket shirt dress'.split()
# fmt: on
assert len(_EMOJIS) == len(_NAMES)
def format(data: bytes) -> str:
"""Render bytes as table emojis, two per row, names as outer labels;
an odd trailing byte leaves the bottom right vacant."""
rows = []
for i in range(0, len(data), 2):
row = f"{_NAMES[data[i]]:>10}{_EMOJIS[data[i]]}"
if i + 1 < len(data):
row += f"{_EMOJIS[data[i + 1]]}{_NAMES[data[i + 1]]:<10}"
rows.append(row)
return "\n".join(rows)