Skip to content

Commit e569955

Browse files
committed
Unwrap the list comprehension to simplify
1 parent fb20881 commit e569955

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

PyPortal_UV_Index/code.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,13 @@ def extract_date(date_time):
8585
print('Retrying in 10 minutes')
8686
time.sleep(600)
8787
continue
88-
data = [{'hour': extract_hour(d['DATE_TIME']), 'value': int(d['UV_VALUE'])}
89-
for d in raw_data
90-
if d['UV_VALUE'] > 0]
88+
data = []
89+
for d in raw_data:
90+
if d['UV_VALUE'] > 0:
91+
entry = {}
92+
entry['hour'] = extract_hour(d['DATE_TIME'])
93+
entry['value'] = int(d['UV_VALUE'])
94+
data.append(entry)
9195
the_day = raw_data[0]['DATE_TIME']
9296
pyportal.set_caption('UV Index for {0}'.format(extract_date(the_day)),
9397
(80, 20),

0 commit comments

Comments
 (0)