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

Function get_all_examples

ci/compiler/board_example_utils.py:71–97  ·  view source on GitHub ↗

Get all available example names from the examples directory. Returns: Sorted list of example names relative to examples directory

()

Source from the content-addressed store, hash-verified

69
70
71def get_all_examples() -> list[str]:
72 """Get all available example names from the examples directory.
73
74 Returns:
75 Sorted list of example names relative to examples directory
76 """
77 project_root = _get_project_root()
78 examples_dir = project_root / "examples"
79
80 if not examples_dir.exists():
81 return []
82
83 # Find all .ino files recursively
84 ino_files = list(examples_dir.rglob("*.ino"))
85
86 examples: list[str] = []
87 for ino_file in ino_files:
88 # Get the parent directory relative to examples/
89 # For examples/Blink/Blink.ino -> "Blink"
90 # For examples/Fx/FxWave2d/FxWave2d.ino -> "Fx/FxWave2d"
91 example_dir = ino_file.parent.relative_to(examples_dir)
92 example_name = str(example_dir).replace("\\", "/") # Normalize path separators
93 examples.append(example_name)
94
95 # Sort for consistent ordering
96 examples.sort()
97 return examples
98
99
100def resolve_example_path(example: str) -> str:

Callers

nothing calls this directly

Calls 4

listClass · 0.85
sortMethod · 0.80
_get_project_rootFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected