Skip to content

Commit

Permalink
Precompile table regex for column exclusion, fixes #1719 (#1720)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed May 13, 2021
1 parent e5b6801 commit 61c0018
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ctapipe/io/tableio.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def exclude(self, table_regexp, pattern):
"""
table_regexp = table_regexp.lstrip("/")
self._exclusions[table_regexp].append(re.compile(pattern))
self._exclusions[re.compile(table_regexp)].append(re.compile(pattern))

def _is_column_excluded(self, table_name, col_name):
for table_regexp, col_regexp_list in self._exclusions.items():
if re.fullmatch(table_regexp, table_name):
if table_regexp.fullmatch(table_name):
for col_regexp in col_regexp_list:
if col_regexp.fullmatch(col_name):
return True
Expand Down

0 comments on commit 61c0018

Please sign in to comment.