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:
@@ -110,7 +110,7 @@ def run_alarm(
|
||||
music_file = os.environ.get("MUSIC_FILE", DEFAULT_MUSIC_FILE)
|
||||
|
||||
setup()
|
||||
style = style_cls(set_led, music_file)
|
||||
style = style_cls(set_led, music_file=music_file)
|
||||
logging.info("Alarm clock started.")
|
||||
try:
|
||||
style.start() # style kicks off its own tone + initial LED
|
||||
|
||||
Reference in New Issue
Block a user