MCPcopy Index your code
hub / github.com/FSoft-AI4Code/HyperAgent / find_matching_file_path

Function find_matching_file_path

src/hyperagent/utils.py:550–561  ·  view source on GitHub ↗
(parent_folder, sub_file_path)

Source from the content-addressed store, hash-verified

548from pathlib import Path
549
550def find_matching_file_path(parent_folder, sub_file_path):
551 for root, dirs, files in os.walk(parent_folder):
552 for name in dirs + files:
553 full_path = os.path.join(root, name)
554 if full_path.endswith(sub_file_path):
555 return Path(full_path).resolve()
556
557 file_paths = find_all_file_paths(parent_folder, sub_file_path.split("/")[-1])
558 if len(file_paths) == 1:
559 return Path(file_paths[0]).resolve()
560
561 return None
562
563if __name__ == "__main__":
564 print(find_matching_file_path("/datadrive5/huypn16/HyperAgent-Master", "hyperagent/prompts/executor.py"))

Callers 3

_runMethod · 0.90
_runMethod · 0.90
utils.pyFile · 0.85

Calls 2

find_all_file_pathsFunction · 0.85
walkMethod · 0.45

Tested by

no test coverage detected