MCPcopy
hub / github.com/reflex-dev/reflex / _pyright_errors

Function _pyright_errors

scripts/check_min_deps.py:338–365  ·  view source on GitHub ↗

Extract error diagnostics from a pyright JSON report. Args: report: The parsed ``--outputjson`` document. Returns: A mapping from a stable diagnostic key (file, line, character, message) to a formatted, human-readable display line.

(report: dict)

Source from the content-addressed store, hash-verified

336
337
338def _pyright_errors(report: dict) -> dict[tuple[str, int, int, str], str]:
339 """Extract error diagnostics from a pyright JSON report.
340
341 Args:
342 report: The parsed ``--outputjson`` document.
343
344 Returns:
345 A mapping from a stable diagnostic key (file, line, character, message) to a
346 formatted, human-readable display line.
347 """
348 errors: dict[tuple[str, int, int, str], str] = {}
349 for diagnostic in report.get("generalDiagnostics", []):
350 if diagnostic.get("severity") != "error":
351 continue
352 start = diagnostic.get("range", {}).get("start", {})
353 if "line" not in start or "character" not in start:
354 continue
355 key = (
356 diagnostic["file"],
357 start["line"],
358 start["character"],
359 diagnostic["message"],
360 )
361 errors[key] = (
362 f"{diagnostic['file']}:{start['line'] + 1}:{start['character'] + 1}"
363 f" - error: {diagnostic['message']}"
364 )
365 return errors
366
367
368def _resolve_and_check(

Callers 1

_resolve_and_checkFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected