Make model keyword-only in all Device subclass constructors#2065
Open
Acrobot wants to merge 1 commit intorytilahti:masterfrom
Open
Make model keyword-only in all Device subclass constructors#2065Acrobot wants to merge 1 commit intorytilahti:masterfrom
Acrobot wants to merge 1 commit intorytilahti:masterfrom
Conversation
The base Device.__init__ defines model as keyword-only (after *), but six subclasses had it as positional: FanP5, Fan1C, Huizuo, AirConditioningCompanion, AirConditioningCompanionMcn02, and Yeelight. This fixes them all to match the base class and adds a test_model_is_keyword_only test that inspects every Device subclass signature to prevent regressions. Addresses rytilahti#1156
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2065 +/- ##
=======================================
Coverage 82.26% 82.26%
=======================================
Files 197 197
Lines 19145 19145
Branches 1052 1052
=======================================
Hits 15750 15750
Misses 3218 3218
Partials 177 177 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Author
|
These changes were generated using Claude Code under my supervision. I reviewed and approved all code before submitting. I'm not very familiar with this codebase, so apologies in advance for any mistakes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The base
Device.__init__definesmodelas keyword-only (after*), but six subclasses had it as positional: FanP5, Fan1C, Huizuo, AirConditioningCompanion, AirConditioningCompanionMcn02, and Yeelight. This breaks Liskov substitution - code that works with the base class signature can't safely substitute these subclasses.Fixes all six to use
*, model: Optional[str] = ...matching the base class, and addstest_model_is_keyword_onlythat inspects every Device subclass signature to prevent regressions.No positional
modelusage was found anywhere in the codebase, so this is a safe change.Full test suite: 1345 passed (1286 on master + 59 new parametrized
test_model_is_keyword_onlycases). Same pre-existing failures only. Ruff clean.Addresses #1156