simplify loop in __init__ in smartstrip.py

This commit is contained in:
Bas Nijholt 2019-11-15 16:51:01 +01:00
parent b2ca20edf0
commit 8c25590186

View File

@ -55,12 +55,12 @@ class SmartStrip(SmartPlug):
self.plugs: List[SmartPlug] = [] self.plugs: List[SmartPlug] = []
children = self.sync.get_sys_info()["children"] children = self.sync.get_sys_info()["children"]
self.num_children = len(children) self.num_children = len(children)
for plug in range(self.num_children): for child in children:
self.plugs.append( self.plugs.append(
SmartPlug( SmartPlug(
host, host,
protocol, protocol,
context=children[plug]["id"], context=child["id"],
cache_ttl=cache_ttl, cache_ttl=cache_ttl,
ioloop=ioloop, ioloop=ioloop,
) )