Files
wecker/styles/__init__.py
T
gurix 88a57dab6e refactor: drop unused AlarmStyle re-export from styles package
Nothing imports AlarmStyle via the styles namespace (blink/simple both
import from styles.base directly), so the redundant-alias re-export was
dead weight that only existed to silence ruff F401.
2026-08-02 10:01:46 +02:00

23 lines
632 B
Python

from styles.blink import BlinkStyle
from styles.simple import SimpleStyle
# Registry of available alarm styles. Add a line here when you add a style.
STYLES = {
"blink": BlinkStyle,
"simple": SimpleStyle,
}
# Fallback style for legacy cron entries that predate --style, so an upgrade
# never silently changes an existing alarm's behaviour.
LEGACY_STYLE = "blink"
def get_style(name: str):
"""Return the style class for ``name`` or raise ValueError."""
try:
return STYLES[name]
except KeyError:
raise ValueError(
f"Unknown alarm style: {name!r}. Known: {sorted(STYLES)}"
)