(root: Path, max_bytes: int, languages: Optional[set[str]])
| 90 | |
| 91 | |
| 92 | def iter_code_files(root: Path, max_bytes: int, languages: Optional[set[str]]) -> Iterator[Tuple[Path, str]]: |
| 93 | for dirpath, dirnames, filenames in os.walk(root): |
| 94 | dirnames[:] = [d for d in dirnames if d not in SKIP_DIRS and not d.startswith(".")] |
| 95 | for filename in filenames: |
| 96 | path = Path(dirpath) / filename |
| 97 | lang = LANG_BY_EXT.get(path.suffix.lower()) |
| 98 | if not lang or (languages and lang not in languages): |
| 99 | continue |
| 100 | try: |
| 101 | if path.stat().st_size > max_bytes: |
| 102 | continue |
| 103 | except OSError: |
| 104 | continue |
| 105 | yield path, lang |
| 106 | |
| 107 | |
| 108 | def symbol_name(match: re.Match[str]) -> str: |
no test coverage detected