I have the code :
from functools import reduce
public_ids = [1,2,3,4,5]
filepath = '/path/to/file/'
rdd = sc.textFile(
filepath
)
new_rdd = reduce(
lambda a, b: a.filter(
lambda x: b not in x
),
public_ids,
rdd
)
This code is suppose to filter lines in a rdd according to a list of ids. The rdd is created from files located in filepath using spark context sc's textFile method.
This code works fine, but pylint raises the error :
E: Undefined variable 'b' (undefined-variable)
I believe the way I coded it is not the proper way. How can I change it so pylint does not raise the error again ? Or is it just a structure that pylint does not recognize properly ?