Fix: "map" issue for Python 2/3 compatible code

Replace map(func, data) with [func(item) for item in data]

Story: 2002909
Task: 24563

Change-Id: I83004eeba036908da483b247093818a6ac3f19c1
Signed-off-by: Sun Austin <austin.sun@intel.com>
This commit is contained in:
Sun Austin 2018-12-18 13:10:58 +08:00
parent 707a12317b
commit fc9b6f94a8
2 changed files with 2 additions and 2 deletions

View File

@ -57,7 +57,7 @@ class BuddyInfo(object):
for line in map(self.parse_line, buddyinfo): for line in map(self.parse_line, buddyinfo):
numa_node = int(line["numa_node"]) numa_node = int(line["numa_node"])
zone = line["zone"] zone = line["zone"]
free_fragments = map(int, line["nr_free"].split()) free_fragments = [int(nr) for nr in line["nr_free"].split()]
max_order = len(free_fragments) max_order = len(free_fragments)
fragment_sizes = self.get_order_sizes(max_order) fragment_sizes = self.get_order_sizes(max_order)
usage_in_bytes = [block[0] * block[1] for block in zip(free_fragments, fragment_sizes)] usage_in_bytes = [block[0] * block[1] for block in zip(free_fragments, fragment_sizes)]

View File

@ -492,7 +492,7 @@ def range_to_list(csv_range=None):
""" """
if not csv_range: if not csv_range:
return [] return []
ranges = [(lambda L: range(L[0], L[-1] + 1))(map(int, r.split('-'))) ranges = [(lambda L: range(L[0], L[-1] + 1))([int(x) for x in r.split('-')])
for r in csv_range.split(',')] for r in csv_range.split(',')]
return [y for x in ranges for y in x] return [y for x in ranges for y in x]