(parent_folder, sub_file_path)
| 548 | from pathlib import Path |
| 549 | |
| 550 | def 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 | |
| 563 | if __name__ == "__main__": |
| 564 | print(find_matching_file_path("/datadrive5/huypn16/HyperAgent-Master", "hyperagent/prompts/executor.py")) |
no test coverage detected