MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _iter_files

Function _iter_files

scripts/strip-inbody-comments.py:194–209  ·  view source on GitHub ↗

Yield C++ source files under each target (recursive for directories), skipping build / vendored trees. Vendored files are skipped even when passed explicitly -- an explicit `app/src/ThirdParty/x.h` must not be stripped just because the directory walk was bypassed.

(targets: list[Path])

Source from the content-addressed store, hash-verified

192
193
194def _iter_files(targets: list[Path]) -> Iterable[Path]:
195 """Yield C++ source files under each target (recursive for directories),
196 skipping build / vendored trees. Vendored files are skipped even when
197 passed explicitly -- an explicit `app/src/ThirdParty/x.h` must not be
198 stripped just because the directory walk was bypassed."""
199 for target in targets:
200 if target.is_file():
201 if target.suffix in _CPP_SUFFIXES and not _is_vendored(target):
202 yield target
203 continue
204 for root, dirs, files in os.walk(target):
205 dirs[:] = [d for d in dirs if d not in _SKIP_DIRS]
206 for name in files:
207 cand = Path(root) / name
208 if name.endswith(_CPP_SUFFIXES) and not _is_vendored(cand):
209 yield cand
210
211
212def _write_lf(path: Path, text: str) -> None:

Callers 1

mainFunction · 0.85

Calls 1

_is_vendoredFunction · 0.85

Tested by

no test coverage detected