MCPcopy Index your code
hub / github.com/ChinaGodMan/UserScripts / perform_search

Function perform_search

utils/searcher.py:13–17  ·  view source on GitHub ↗
(content, search_str)

Source from the content-addressed store, hash-verified

11 results = SearchResults()
12
13 def perform_search(content, search_str):
14 name_pattern = re.compile(r'// @name:\s*' + re.escape(search_str) + r'\s*(.+)')
15 description_pattern = re.compile(r'// @description:\s*' + re.escape(search_str) + r'\s*(.+)')
16 results.name_matches.extend([match.strip() for match in name_pattern.findall(content)])
17 results.description_matches.extend([match.strip() for match in description_pattern.findall(content)])
18
19 try:
20 with open(file_path, 'r', encoding='utf-8') as file:

Callers 1

search_in_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected