Source code for httk.atomistic.models.formula.diagnostics
"""Structured diagnostics produced while working with chemical formulas."""
from dataclasses import dataclass
from fractions import Fraction
@dataclass(frozen=True)
[docs]
class CompositionDiagnostic:
"""Record a non-fatal issue encountered while projecting composition.
:param code: The stable diagnostic code.
:param message: The human-readable diagnostic message.
:param subject: The composition subject involved, if any.
:param total: The calculated total, if applicable.
:param width: The precision width used for the diagnostic, if applicable.
"""
[docs]
subject: str | None = None
[docs]
total: Fraction | None = None
[docs]
width: Fraction | None = None