Isn't used per se by the test fetcher but might be used later as a quality check. Putting this here for now so the code is not lost. This checks all imports in a given file do exist.
()
| 810 | |
| 811 | |
| 812 | def check_imports_all_exist(): |
| 813 | """ |
| 814 | Isn't used per se by the test fetcher but might be used later as a quality check. Putting this here for now so the |
| 815 | code is not lost. This checks all imports in a given file do exist. |
| 816 | """ |
| 817 | cache = {} |
| 818 | all_modules = list(PATH_TO_DIFFUSERS.glob("**/*.py")) + list(PATH_TO_TESTS.glob("**/*.py")) |
| 819 | all_modules = [str(mod.relative_to(PATH_TO_REPO)) for mod in all_modules] |
| 820 | direct_deps = {m: get_module_dependencies(m, cache=cache) for m in all_modules} |
| 821 | |
| 822 | for module, deps in direct_deps.items(): |
| 823 | for dep in deps: |
| 824 | if not (PATH_TO_REPO / dep).is_file(): |
| 825 | print(f"{module} has dependency on {dep} which does not exist.") |
| 826 | |
| 827 | |
| 828 | def _print_list(l) -> str: |
nothing calls this directly
no test coverage detected