Using builtins like 'filter()' is discouraged nowadays, and pylint generates
this warning:
W: 46,22:_check_ranges: Used builtin function 'filter'
Use a generator expression instead of the 'filter' built-in.
Change-Id: I0b07685967927a84804d443f22369d68da106af3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
# starting from block 'first_block'. Create an iterator which filters
# those block ranges from the 'ranges' list, that are out of the
# 'first_block'/'blocks_cnt' file region.
- filter_func = lambda x: x[1] >= first_block and x[0] <= last_block
- ranges_iterator = filter(filter_func, ranges)
-
+ ranges_iterator = ( x for x in ranges if x[1] >= first_block and \
+ x[0] <= last_block )
iterator = itertools.izip_longest(ranges_iterator, fiemap_iterator)
# Iterate over both - the (filtered) 'ranges' list which contains correct