MCPcopy Create free account
hub / github.com/FastLED/FastLED / collect_python_files

Function collect_python_files

ci/lint_python/keyboard_interrupt_checker.py:249–266  ·  view source on GitHub ↗

Walk *paths* and return all .py files, filtering out *excludes*.

(
    paths: list[str],
    excludes: list[str],
)

Source from the content-addressed store, hash-verified

247
248
249def collect_python_files(
250 paths: list[str],
251 excludes: list[str],
252) -> list[Path]:
253 """Walk *paths* and return all .py files, filtering out *excludes*."""
254 result: list[Path] = []
255 exclude_parts = [e.replace("\\", "/").strip("/") for e in excludes]
256
257 for p_str in paths:
258 p = Path(p_str)
259 if p.is_file() and p.suffix == ".py":
260 if not _is_excluded(p, exclude_parts):
261 result.append(p)
262 elif p.is_dir():
263 for py_file in p.rglob("*.py"):
264 if not _is_excluded(py_file, exclude_parts):
265 result.append(py_file)
266 return result
267
268
269def _is_excluded(path: Path, exclude_parts: list[str]) -> bool:

Callers 1

mainFunction · 0.70

Calls 2

_is_excludedFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected