8000 Add docstrings to make ruff happy · python-kasa/python-kasa@eebfdf1 · GitHub
[go: up one dir, main page]

Skip to content

Commit eebfdf1

Browse files
committed
Add docstrings to make ruff happy
1 parent 4a5d2a4 commit eebfdf1

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

kasa/discover.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
from kasa.protocol import TPLinkProtocol, TPLinkSmartHomeProtocol
2525
from kasa.smartdevice import SmartDevice, SmartDeviceException
2626
from kasa.smartplug import SmartPlug
27-
from kasa.tapo.tapoplug import TapoPlug
2827
from kasa.tapo import TapoBulb
28+
from kasa.tapo.tapoplug import TapoPlug
2929

3030
from .device_factory import get_device_class_from_info
3131

kasa/tapo/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Package for supporting tapo-branded devices."""
12
from .tapobulb import TapoBulb
23
from .tapodevice import TapoDevice
34
from .tapoplug import TapoPlug

kasa/tapo/tapobulb.py

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,26 @@
1212

1313

1414
class TapoBulb(TapoDevice, SmartBulb):
15+
"""Representation of a TP-Link Tapo Bulb.
16+
17+
Documentation TBD. See :class:`~kasa.smartbulb.SmartBulb` for now.
18+
"""
19+
1520
@property
1621
def is_color(self) -> bool:
22+
"""Whether the bulb supports color changes."""
1723
# TODO: this makes an assumption that only color bulbs report this
1824
return "hue" in self._info
1925

2026
@property
2127
def is_dimmable(self) -> bool:
28+
"""Whether the bulb supports brightness changes."""
2229
# TODO: this makes an assumption that only dimmables report this
2330
return "brightness" in self._info
2431

2532
@property
2633
def is_variable_color_temp(self) -> bool:
34+
"""Whether the bulb supports color temperature changes."""
2735
# TODO: this makes an assumption, that only ct bulbs report this
2836
return bool(self._info.get("color_temp_range", False))
2937

@@ -115,6 +123,15 @@ async def set_hsv(
115123
*,
116124
transition: Optional[int] = None,
117125
) -> Dict:
126+
"""Set new HSV.
127+
128+
Note, transition is not supported and will be ignored.
129+
130+
:param int hue: hue in degrees
131+
:param int saturation: saturation in percentage [0,100]
132+
:param int value: value in percentage [0, 100]
133+
:param int transition: transition in milliseconds.
134+
"""
118135
if not self.is_color:
119136
raise SmartDeviceException("Bulb does not support color.")
120137

@@ -131,7 +148,13 @@ async def set_hsv(
131148
async def set_color_temp(
132149
self, temp: int, *, brightness=None, transition: Optional[int] = None
133150
) -> Dict:
134-
# TODO: Decide how to handle brightness and transition
151+
"""Set the color temperature of the device in kelvin.
152+
153+
Note, transition is not supported and will be ignored.
154+
155+
:param int temp: The new color temperature, in Kelvin
156+
:param int transition: transition in milliseconds.
157+
"""
135158
# TODO: Note, trying to set brightness at the same time
136159
# with color_temp causes error -1008
137160
if not self.is_variable_color_temp:
@@ -142,7 +165,13 @@ async def set_color_temp(
142165
async def set_brightness(
143166
self, brightness: int, *, transition: Optional[int] = None
144167
) -> Dict:
145-
# TODO: Decide how to handle transitions
168+
"""Set the brightness in percentage.
169+
170+
Note, transition is not supported and will be ignored.
171+
172+
:param int brightness: brightness in percent
173+
:param int transition: transition in milliseconds.
174+
"""
146175
if not self.is_dimmable: # pragma: no cover
147176
raise SmartDeviceException("Bulb is not dimmable.")
148177

@@ -186,4 +215,5 @@ async def set_effect(
186215

187216
@property
188217
def presets(self) -> List[SmartBulbPreset]:
189-
return []
218+
"""Return a list of available bulb setting presets."""
219+
raise NotImplementedError()

0 commit comments

Comments
 (0)
0