(overwrite: bool = False)
| 196 | |
| 197 | |
| 198 | def check_copies(overwrite: bool = False): |
| 199 | all_files = glob.glob(os.path.join(DIFFUSERS_PATH, "**/*.py"), recursive=True) |
| 200 | diffs = [] |
| 201 | for filename in all_files: |
| 202 | new_diffs = is_copy_consistent(filename, overwrite) |
| 203 | diffs += [f"- {filename}: copy does not match {d[0]} at line {d[1]}" for d in new_diffs] |
| 204 | if not overwrite and len(diffs) > 0: |
| 205 | diff = "\n".join(diffs) |
| 206 | raise Exception( |
| 207 | "Found the following copy inconsistencies:\n" |
| 208 | + diff |
| 209 | + "\nRun `make fix-copies` or `python utils/check_copies.py --fix_and_overwrite` to fix them." |
| 210 | ) |
| 211 | |
| 212 | |
| 213 | if __name__ == "__main__": |
no test coverage detected