MCPcopy Create free account
hub / github.com/FSoft-AI4Code/HyperAgent / find_matching_abs_path

Function find_matching_abs_path

src/hyperagent/utils.py:520–528  ·  view source on GitHub ↗
(parent_folder, sub_path)

Source from the content-addressed store, hash-verified

518 return patch
519
520def find_matching_abs_path(parent_folder, sub_path):
521 # Walk through the parent folder to find matching sub-path
522 for root, dirs, files in os.walk(parent_folder):
523 for name in dirs + files:
524 full_path = os.path.join(root, name)
525 # Check if the sub_path matches the end of the full path
526 if full_path.endswith(sub_path):
527 return os.path.abspath(full_path)
528 return None
529
530def find_all_file_paths(parent_folder, file_name):
531 """Finds all paths of files with the given name in a parent folder.

Callers 1

_runMethod · 0.90

Calls 1

walkMethod · 0.45

Tested by

no test coverage detected