Skip to content

topmark.diagnostic.types

topmark / diagnostic / types

Structural typing helpers for TopMark diagnostic containers.

This module defines small protocols for code that only needs to observe contained diagnostics and aggregated counts. The protocols allow callers to accept mutable or frozen diagnostic containers without depending on concrete implementations such as MutableDiagnosticLog or FrozenDiagnosticLog.

DiagnosticsLike

Bases: Protocol

Read-only structural interface for diagnostic containers.

stats

stats()

Return aggregated per-level counts for the contained diagnostics.

Source code in src/topmark/diagnostic/types.py
def stats(self) -> DiagnosticStats:
    """Return aggregated per-level counts for the contained diagnostics."""
    ...

to_dict

to_dict()

Return a read-only JSON-friendly mapping of counts by severity.

Source code in src/topmark/diagnostic/types.py
def to_dict(self) -> Mapping[str, int]:
    """Return a read-only JSON-friendly mapping of counts by severity."""
    ...