Python 3 compatibility: replace filter()

Replace filter(lambda obj: test(obj), data) with [obj for obj in data if test(obj)]

Story: 2003310
Task: 24267

Change-Id: I5ccce1070fd5182ba25933f21665edbb85e4b3cc
Signed-off-by: chenyan <yan.chen@intel.com>
This commit is contained in:
chenyan 2018-08-07 14:07:42 +08:00
parent b156c7d2a2
commit 5994fbdb68
1 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ def get_fm_alarms():
with open(FM_ALARM_H) as f:
fm_alarms_file = f.readlines()
fm_alarm_group_lines = filter(lambda k: 'define ALARM_GROUP_' in k, fm_alarms_file)
fm_alarm_group_lines = [k for k in fm_alarms_file if 'define ALARM_GROUP_' in k]
for line in fm_alarm_group_lines:
group_name = line.split()[1]
@ -61,7 +61,7 @@ def get_fm_alarms():
group_value = group_value[1:-1] # remove quotes
fm_alarm_groups[group_name] = group_value
fm_alarm_lines = filter(lambda k: 'FM_ALARM_ID' in k, fm_alarms_file)
fm_alarm_lines = [k for k in fm_alarms_file if 'FM_ALARM_ID' in k]
for line in fm_alarm_lines:
alarm_name = line.split()[1]