From fb9c6999d67c7357d1b9dbb7aad5f74c48902192 Mon Sep 17 00:00:00 2001 From: Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com> Date: Sat, 8 Oct 2022 01:32:45 -0400 Subject: [PATCH] avoid compiling the exclusion regex and use re.search directly --- vermin/config.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vermin/config.py b/vermin/config.py index db1531c3..2adf2abf 100644 --- a/vermin/config.py +++ b/vermin/config.py @@ -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: @@ -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 @@ -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