Scan for generated files under root.
(root: Path, relative: bool)
| 67 | |
| 68 | |
| 69 | def scan_generated_files(root: Path, relative: bool) -> List[Path]: |
| 70 | """Scan for generated files under root.""" |
| 71 | matches: List[Path] = [] |
| 72 | for dirpath, dirnames, filenames in os.walk(root): |
| 73 | dirnames[:] = [d for d in dirnames if not should_skip_dir(d)] |
| 74 | for filename in filenames: |
| 75 | file_path = Path(dirpath) / filename |
| 76 | if not file_path.is_file(): |
| 77 | continue |
| 78 | if is_generated_file(file_path): |
| 79 | matches.append(file_path) |
| 80 | display_path = file_path |
| 81 | if relative: |
| 82 | try: |
| 83 | display_path = file_path.relative_to(root) |
| 84 | except ValueError: |
| 85 | pass |
| 86 | print(f" Generated: {display_path}") |
| 87 | return matches |
| 88 | |
| 89 | |
| 90 | def resolve_imports( |
no test coverage detected