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

Function display_pattern_details

ci/autoresearch/context.py:157–258  ·  view source on GitHub ↗

Display per-pattern error details from enriched RPC response.

(result: dict[str, Any])

Source from the content-addressed store, hash-verified

155
156
157def display_pattern_details(result: dict[str, Any]) -> None:
158 """Display per-pattern error details from enriched RPC response."""
159 patterns = result.get("patterns")
160 if not patterns:
161 return
162
163 driver = result.get("driver", "?")
164 lane_count = result.get("laneCount", 0)
165 lane_sizes = result.get("laneSizes", [])
166 total_leds = sum(lane_sizes) if lane_sizes else 0
167 frame_count = result.get("frameCount", 1)
168
169 print()
170 print("=" * 62)
171 header = f"{driver} — {lane_count} lane(s), {total_leds} LEDs"
172 if frame_count and frame_count > 1:
173 header += f", frames={frame_count}"
174 print(header)
175 print("=" * 62)
176
177 agg_total_bytes = 0
178 agg_mismatched_bytes = 0
179 agg_lsb_only = 0
180
181 for pat in patterns:
182 name = pat.get("name", "Unknown")
183 passed = pat.get("passed", False)
184 run_number = pat.get("runNumber")
185 status = (
186 f"{Fore.GREEN}PASS{Style.RESET_ALL}"
187 if passed
188 else f"{Fore.RED}FAIL{Style.RESET_ALL}"
189 )
190
191 frame_suffix = f" [frame {run_number}]" if run_number else ""
192 print(f"\n {name}{frame_suffix} {status}")
193
194 if passed:
195 num_leds = pat.get("totalLeds", 0)
196 print(f" All {num_leds} LEDs match")
197 agg_total_bytes += pat.get("totalBytes", num_leds * 3)
198 continue
199
200 num_leds = pat.get("totalLeds", 0)
201 mismatched_leds = pat.get("mismatchedLeds", 0)
202 total_bytes = pat.get("totalBytes", num_leds * 3)
203 mismatched_bytes = pat.get("mismatchedBytes", 0)
204 lsb_only = pat.get("lsbOnlyErrors", 0)
205
206 agg_total_bytes += total_bytes
207 agg_mismatched_bytes += mismatched_bytes
208 agg_lsb_only += lsb_only
209
210 byte_pct = 100.0 * mismatched_bytes / total_bytes if total_bytes > 0 else 0.0
211 lsb_pct = 100.0 * lsb_only / mismatched_bytes if mismatched_bytes > 0 else 0.0
212
213 print(f" Mismatched LEDs: {mismatched_leds}/{num_leds}")
214 print(

Callers 1

_run_rpc_testsFunction · 0.90

Calls 2

printFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected