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

Function resolve_example_path

ci/compiler/board_example_utils.py:100–123  ·  view source on GitHub ↗

Resolve example name to path, ensuring it exists. Args: example: Example name (e.g., "Blink" or "examples/Blink") Returns: Normalized example name without "examples/" prefix Raises: FileNotFoundError: If example directory does not exist

(example: str)

Source from the content-addressed store, hash-verified

98
99
100def resolve_example_path(example: str) -> str:
101 """Resolve example name to path, ensuring it exists.
102
103 Args:
104 example: Example name (e.g., "Blink" or "examples/Blink")
105
106 Returns:
107 Normalized example name without "examples/" prefix
108
109 Raises:
110 FileNotFoundError: If example directory does not exist
111 """
112 project_root = _get_project_root()
113 examples_dir = project_root / "examples"
114
115 # Handle both "Blink" and "examples/Blink" formats
116 if example.startswith("examples/"):
117 example = example[len("examples/") :]
118
119 example_path = examples_dir / example
120 if not example_path.exists():
121 raise FileNotFoundError(f"Example not found: {example_path}")
122
123 return example
124
125
126def get_board_artifact_extension(board: Board) -> str:

Callers 1

mainFunction · 0.90

Calls 1

_get_project_rootFunction · 0.70

Tested by

no test coverage detected