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

Function discover_sources

ci/discover_sources.py:13–37  ·  view source on GitHub ↗

Discover source files in a directory. Args: base_dir: Directory to search in (relative to project root) pattern: Glob pattern for files to match (default: "*.cpp") recursive: If True, search recursively (rglob), else search only direct children (glob) Returns:

(
    base_dir: str, pattern: str = "*.cpp", recursive: bool = False
)

Source from the content-addressed store, hash-verified

11
12
13def discover_sources(
14 base_dir: str, pattern: str = "*.cpp", recursive: bool = False
15) -> list[str]:
16 """
17 Discover source files in a directory.
18
19 Args:
20 base_dir: Directory to search in (relative to project root)
21 pattern: Glob pattern for files to match (default: "*.cpp")
22 recursive: If True, search recursively (rglob), else search only direct children (glob)
23
24 Returns:
25 List of file paths (as strings) sorted alphabetically
26 """
27 base_path = Path(base_dir)
28
29 if not base_path.exists():
30 return []
31
32 if recursive:
33 files = sorted(base_path.rglob(pattern))
34 else:
35 files = sorted(base_path.glob(pattern))
36
37 return [str(f) for f in files]
38
39
40def main() -> None:

Callers 2

mainFunction · 0.90
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected