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

Function collect_python_files

ci/lint_python/sys_path_checker.py:77–94  ·  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

75
76
77def collect_python_files(
78 paths: list[str],
79 excludes: list[str],
80) -> list[Path]:
81 """Walk paths and return all .py files, filtering out excludes."""
82 result: list[Path] = []
83 exclude_parts = [e.replace("\\", "/").strip("/") for e in excludes]
84
85 for p_str in paths:
86 p = Path(p_str)
87 if p.is_file() and p.suffix == ".py":
88 if not _is_excluded(p, exclude_parts):
89 result.append(p)
90 elif p.is_dir():
91 for py_file in p.rglob("*.py"):
92 if not _is_excluded(py_file, exclude_parts):
93 result.append(py_file)
94 return result
95
96
97def _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