-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to check supported devices, update README (#242)
* check_readme_vs_fixtures.py checks if a device with a fixture is listed in the README * Add missing entries to README.md
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Script that checks if README.md is missing devices that have fixtures.""" | ||
from kasa.tests.conftest import ALL_DEVICES, BULBS, DIMMERS, LIGHT_STRIPS, PLUGS, STRIPS | ||
|
||
readme = open("README.md").read() | ||
|
||
typemap = { | ||
"light strips": LIGHT_STRIPS, | ||
"bulbs": BULBS, | ||
"plugs": PLUGS, | ||
"strips": STRIPS, | ||
"dimmers": DIMMERS, | ||
} | ||
|
||
|
||
def _get_device_type(dev, typemap): | ||
for typename, devs in typemap.items(): | ||
if dev in devs: | ||
return typename | ||
else: | ||
return "Unknown type" | ||
|
||
|
||
for dev in ALL_DEVICES: | ||
if dev not in readme: | ||
print(f"{dev} not listed in {_get_device_type(dev, typemap)}") |