This replaces assignment followed by for loops with list comprehensions. This is less code, simpler, and faster.
Signed-off-by: Dylan Baker <baker.dyla...@gmail.com> --- framework/core.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/framework/core.py b/framework/core.py index f61548d..6f476d0 100644 --- a/framework/core.py +++ b/framework/core.py @@ -332,8 +332,8 @@ class Environment: verbose=False): self.concurrent = concurrent self.execute = execute - self.filter = [] - self.exclude_filter = [] + self.filter = [re.compile(x) for x in include_filter or []] + self.exclude_filter = [re.compile(x) for x in exclude_filter or []] self.exclude_tests = set() self.valgrind = valgrind self.dmesg = dmesg @@ -347,17 +347,6 @@ class Environment: 'MESA_DEBUG': 'silent', } - """ - The filter lists that are read in should be a list of string objects, - however, the filters need to be a list or regex object. - - This code uses re.compile to rebuild the lists and set self.filter - """ - for each in include_filter or []: - self.filter.append(re.compile(each)) - for each in exclude_filter or []: - self.exclude_filter.append(re.compile(each)) - def __iter__(self): for key, values in self.__dict__.iteritems(): # If the values are regex compiled then yield their pattern -- 2.0.0 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/piglit