| Conditions | 7 |
| Total Lines | 15 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # SPDX-FileCopyrightText: 2020 Peter Bittner <[email protected]> |
||
| 36 | def descend_and_clean(directory, file_types, dir_names): |
||
| 37 | for child in sorted(directory.iterdir()): |
||
| 38 | if child.is_file(): |
||
| 39 | if child.suffix in file_types: |
||
| 40 | Runner.unlink(child) |
||
| 41 | elif child.is_dir(): |
||
| 42 | if should_ignore(child, Runner.ignore): |
||
| 43 | log.debug('Skipping %s', child) |
||
| 44 | else: |
||
| 45 | descend_and_clean(child, file_types, dir_names) |
||
| 46 | |||
| 47 | if child.name in dir_names: |
||
| 48 | Runner.rmdir(child) |
||
| 49 | else: |
||
| 50 | log.debug('Ignoring %s (neither a file nor a folder)', child) |
||
| 51 |