Spaces:
Running on Zero
Running on Zero
Download app/core/labels.py from cipher-attacks/Dbu-central-bot: direct link, hf CLI and curl.
- Browser
- Download file 413 Bytes
-
https://huggingface.co/spaces/cipher-attacks/Dbu-central-bot/resolve/main/app/core/labels.py
- Command line
-
hf download hf://spaces/cipher-attacks/Dbu-central-bot/app/core/labels.py
-
curl -L -o labels.py https://huggingface.co/spaces/cipher-attacks/Dbu-central-bot/resolve/main/app/core/labels.py
413 Bytes
| """Short labels for buttons (pure, so they can be tested without Telegram).""" | |
| def clip(text: str, n: int = 48) -> str: | |
| return text if len(text) <= n else text[: n - 1] + "…" | |
| def course_label(code, name: str) -> str: | |
| """One button line: "code · name" when it fits, else just the name.""" | |
| if code and len(code) + 3 + len(name) <= 36: | |
| return f"{code} · {name}" | |
| return clip(name, 36) | |