Avoid creating temporary lists (#25317)
That gives nano performance improvements as *() is slightly faster then *[].
This commit is contained in:
parent
caa7a3a3d6
commit
979f801488
13 changed files with 42 additions and 42 deletions
|
@ -245,10 +245,10 @@ class NextBusDepartureSensor(Entity):
|
|||
))
|
||||
|
||||
# Chain all predictions together
|
||||
predictions = list(chain(*[
|
||||
predictions = list(chain(*(
|
||||
listify(direction.get('prediction', []))
|
||||
for direction in directions
|
||||
]))
|
||||
)))
|
||||
|
||||
# Short circuit if we don't have any actual bus predictions
|
||||
if not predictions:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue