[Piglit] [Patch v3 04/13] core.py: Simplify Environment constructor
Dylan Baker
baker.dylan.c at gmail.com
Fri Jun 20 12:50:30 PDT 2014
This replaces assignment followed by for loops with list comprehensions.
This is less code, simpler, and faster.
Signed-off-by: Dylan Baker <baker.dylan.c at 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
More information about the Piglit
mailing list