8000 Add script to check supported devices, update README (#242) · python-kasa/python-kasa@8a4068c · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a4068c

Browse files
authored
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
1 parent d75e1ad commit 8a4068c

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,13 @@ or the `parse_pcap.py` script contained inside the `devtools` directory.
119119
* HS105
120120
* HS107
121121
* HS110
122+
* KP105
122123
* KP115
124+
* KP401
123125

124126
### Power Strips
125127

128+
* EP40
126129
* HS300
127130
* KP303
128131
* KP400
@@ -135,11 +138,13 @@ or the `parse_pcap.py` script contained inside the `devtools` directory.
135138

136139
### Bulbs
137140

141+
* EP40
138142
* LB100
139143
* LB110
140144
* LB120
141145
* LB130
142146
* LB230
147+
* KL50
143148
* KL60
144149
* KL110
145150
* KL120

devtools/check_readme_vs_fixtures.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Script that checks if README.md is missing devices that have fixtures."""
2+
from kasa.tests.conftest import ALL_DEVICES, BULBS, DIMMERS, LIGHT_STRIPS, PLUGS, STRIPS
3+
4+
readme = open("README.md").read()
5+
6+
typemap = {
7+
"light strips": LIGHT_STRIPS,
8+
"bulbs": BULBS,
9+
"plugs": PLUGS,
10+
"strips": STRIPS,
11+
"dimmers": DIMMERS,
12+
}
13+
14+
15+
def _get_device_type(dev, typemap):
16+
for typename, devs in typemap.items():
17+
if dev in devs:
18+
return typename
19+
else:
20+
return "Unknown type"
21+
22+
23+
for dev in ALL_DEVICES:
24+
if dev not in readme:
25+
print(f"{dev} not listed in {_get_device_type(dev, typemap)}")

0 commit comments

Comments
 (0)
0