Read files and return those whose source matches the regex pre-filter.
(files: list[Path])
| 276 | |
| 277 | |
| 278 | def find_candidates(files: list[Path]) -> list[tuple[Path, str]]: |
| 279 | """Read files and return those whose source matches the regex pre-filter.""" |
| 280 | candidates: list[tuple[Path, str]] = [] |
| 281 | for f in files: |
| 282 | try: |
| 283 | source = f.read_text(encoding="utf-8", errors="replace") |
| 284 | except OSError: |
| 285 | continue |
| 286 | if has_broad_except(source): |
| 287 | candidates.append((f, source)) |
| 288 | return candidates |
| 289 | |
| 290 | |
| 291 | # --------------------------------------------------------------------------- |
no test coverage detected