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

Function create_sketch_path_formatter

ci/util/output_formatter.py:191–215  ·  view source on GitHub ↗

Create a formatter that maps lib/FastLED paths to src/ and src/sketch paths to examples/{example}/ and timestamps lines. Args: example: Example name or path (e.g., "Pintest" or "examples/SmartMatrix"). Returns: OutputFormatter: Configured formatter instance.

(example: str)

Source from the content-addressed store, hash-verified

189
190
191def create_sketch_path_formatter(example: str) -> OutputFormatter:
192 """Create a formatter that maps lib/FastLED paths to src/ and src/sketch paths to examples/{example}/ and timestamps lines.
193
194 Args:
195 example: Example name or path (e.g., "Pintest" or "examples/SmartMatrix").
196
197 Returns:
198 OutputFormatter: Configured formatter instance.
199 """
200 # Normalize example path
201 display_example_str: str
202 if "/" in example or "\\" in example:
203 display_example_str = example.replace("\\", "/")
204 else:
205 display_example_str = f"examples/{example}"
206
207 # Define multiple path substitutions
208 substitutions = [
209 # Replace lib/FastLED/ paths with src/ for better UX
210 ("lib/FastLED", r"lib[/\\]+FastLED[/\\]+", "src/"),
211 # Replace src/sketch/ paths with examples/{example}/
212 ("sketch", r"src[/\\]+sketch[/\\]+", f"{display_example_str}/"),
213 ]
214
215 return _MultiPathSubstitutionFormatter(substitutions)

Callers 3

_init_platformio_buildFunction · 0.90
_build_internalMethod · 0.90
deployMethod · 0.90

Tested by

no test coverage detected