Skip to content

Commit

Permalink
avoid compiling the exclusion regex and use re.search directly
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmicexplorer committed Oct 8, 2022
1 parent d8726ec commit fb9c699
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vermin/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def add_exclusion(self, name):
self.__exclusions.add(name)

def add_exclusion_regex(self, pattern):
self.__exclusion_regex.add(re.compile(pattern))
self.__exclusion_regex.add(pattern)

def add_exclusion_file(self, filename):
try:
Expand All @@ -318,7 +318,7 @@ def exclusions(self):
return res

def exclusion_regex(self):
res = [p.pattern for p in self.__exclusion_regex]
res = list(self.__exclusion_regex)
res.sort()
return res

Expand All @@ -335,7 +335,7 @@ def is_excluded_codecs_encoding(self, name):
return "ce={}".format(name) in self.__exclusions

def is_excluded_by_regex(self, path):
return any(regex.search(path) for regex in self.__exclusion_regex)
return any(re.search(regex, path) for regex in self.__exclusion_regex)

def make_paths_absolute(self):
return self.__make_paths_absolute
Expand Down

0 comments on commit fb9c699

Please sign in to comment.