INNER CODE UNIT · Python
Findings
llm-d/llm-d · scripts/guide.py:115
class Findings:
"""An ordered collection of ``Finding``s.
Truthy when empty-and-clean is *false* — prefer the explicit ``ok()``.
"""
def __init__(self, items: Iterable[Finding] | None = None) -> None:
self._items: list[Finding] = list(items or [])
# -- building ----------------------------------------------------------
def error(self, message: str, *, source: str = "yaml", line: int | None = None) -> None:
self._items.append(Finding(message, source, line, "error"))
def extend(self, other: "Findings" | Iterable[Finding]) -> "Findings":
self._items.extend(other if not isinstance(other, Findings) else other._items)
return self