Use PEP 526 syntax with NamedTuples (#33081)
This commit is contained in:
1 parent
e87fab6b5f
commit
ffc9bcb4d7
4 files changed
+41
-38
No files matched your search
@@ -75,30 +75,26 @@ def brightness_from_percentage(percent):
|
||||
return (percent * 255.0) / 100.0
|
||||
|
||||
|
||||
LightState = NamedTuple(
|
||||
"LightState",
|
||||
(
|
||||
("state", bool),
|
||||
("brightness", int),
|
||||
("color_temp", float),
|
||||
("hs", Tuple[int, int]),
|
||||
("emeter_params", dict),
|
||||
),
|
||||
)
|
||||
class LightState(NamedTuple):
|
||||
"""Light state."""
|
||||
|
||||
state: bool
|
||||
brightness: int
|
||||
color_temp: float
|
||||
hs: Tuple[int, int]
|
||||
emeter_params: dict
|
||||
|
||||
|
||||
LightFeatures = NamedTuple(
|
||||
"LightFeatures",
|
||||
(
|
||||
("sysinfo", Dict[str, Any]),
|
||||
("mac", str),
|
||||
("alias", str),
|
||||
("model", str),
|
||||
("supported_features", int),
|
||||
("min_mireds", float),
|
||||
("max_mireds", float),
|
||||
),
|
||||
)
|
||||
class LightFeatures(NamedTuple):
|
||||
"""Light features."""
|
||||
|
||||
sysinfo: Dict[str, Any]
|
||||
mac: str
|
||||
alias: str
|
||||
model: str
|
||||
supported_features: int
|
||||
min_mireds: float
|
||||
max_mireds: float
|
||||
|
||||
|
||||
class TPLinkSmartBulb(Light):
|
||||
|
||||
Reference in new issue
Block a user