refactor: keep style-specific config off the base class via **kwargs

The base AlarmStyle contract carried music_file, forcing SimpleStyle to
accept a parameter it never uses. Move style-specific config to the
subclass: the base __init__ takes only set_led (**kwargs swallows the rest);
each style declares the keyword args it actually uses (BlinkStyle: music_file;
SimpleStyle: none). The runner passes config as keyword args and each style
keeps only what it needs, so the base contract never grows as styles are
added — a future 'talk' style adds talk_file to its own signature, not to the
base. README plugin contract updated.
This commit is contained in:
2026-08-02 22:09:46 +02:00
parent 3a7b6ac7a3
commit 000b204215
7 changed files with 32 additions and 19 deletions
+2 -2
View File
@@ -37,8 +37,8 @@ class SimpleStyle(AlarmStyle):
wave played through ``pygame.mixer.Sound``.
"""
def __init__(self, set_led, music_file=None):
super().__init__(set_led, music_file)
def __init__(self, set_led, **kwargs):
super().__init__(set_led, **kwargs)
self._next_beep = 0.0
self._beep = None