Skip to content

Commit

Permalink
Fix issue #1071, add raw prefix before search regex, to support Pytho…
Browse files Browse the repository at this point in the history
…n 3.12
  • Loading branch information
manateelazycat committed Oct 13, 2024
1 parent 98be27b commit af1c51c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/search_file_words.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,12 @@ def search_dispatcher(self):
for search_file in search_files:
try:
if search_file in search_content_dict:
words = set(re.findall("[\w|-]+", search_content_dict[search_file]))
words = set(re.findall(r"[\w|-]+", search_content_dict[search_file]))
else:
words = set(re.findall("[\w|-]+", open(search_file).read()))
words = set(re.findall(r"[\w|-]+", open(search_file).read()))
except (FileNotFoundError, UnicodeDecodeError):
continue
filter_words = set(map(lambda word: re.sub('[^A-Za-z0-9-_]+', '', word),
filter_words = set(map(lambda word: re.sub(r'[^A-Za-z0-9-_]+', '', word),
set(filter(self.filter_word, words))))
filter_words.discard("")
self.files[search_file] = filter_words
Expand Down

0 comments on commit af1c51c

Please sign in to comment.