Created
March 3, 2020 23:38
-
-
Save CapnKernel/b15f2debd8e995cadfa2e34c547de5ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -551,20 +549,14 @@ | |
for p in self.libparts: | |
s.update( p.getFieldNames() ) | |
- # omit anything matching any regex in excluded_fields | |
- ret = set() | |
- for field in s: | |
- exclude = False | |
- for rex in excluded_fields: | |
- if re.match( rex, field ): | |
- exclude = True | |
- break | |
- if not exclude: | |
- ret.add(field) | |
+ # omit anything matching regexes in excluded_fields | |
+ excluded_fields_re = tuple(re.compile(excluded_field) for excluded_field in self.excluded_fields) | |
+ | |
+ ret = {field for field in s if not any((excluded_field_re.match(field) for excluded_field_re in excluded_fields_re))} | |
return ret # this is a python 'set' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment