Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion philter.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,14 @@ def precompile(self, filepath):
with warnings.catch_warnings(): #NOTE: this is not thread safe! but we want to print a more detailed warning message
warnings.simplefilter(action="error", category=FutureWarning) # in order to print a detailed message
try:
re_compiled = re.compile(regex)
# Use of flags not at the start of regex is deprecated.
# Adding exception and moving the case insensitive mode to the beginning
# if the regular expression
try:
re_compiled = re.compile(regex)
except:
regex_tmp = regex.replace('(?i)', '')
re_compiled = re.compile('(?i)' + regex_tmp)
except FutureWarning as warn:
print("FutureWarning: {0} in file ".format(warn) + filepath)
warnings.simplefilter(action="ignore", category=FutureWarning)
Expand Down