comparator
Comparison engine for detecting differences between PRIMARY and GitHub model references.
ModelReferenceDiff
dataclass
Represents the complete diff between PRIMARY and GitHub model references.
Source code in src/horde_model_reference/sync/comparator.py
added_models
class-attribute
instance-attribute
Models present in PRIMARY but not in GitHub.
removed_models
class-attribute
instance-attribute
Models present in GitHub but not in PRIMARY.
modified_models
class-attribute
instance-attribute
Models present in both but with different content. Contains PRIMARY version.
__init__
__init__(
category: MODEL_REFERENCE_CATEGORY,
added_models: dict[str, dict[str, Any]] = dict(),
removed_models: dict[str, dict[str, Any]] = dict(),
modified_models: dict[str, dict[str, Any]] = dict(),
) -> None
has_changes
Return True if there are any differences between PRIMARY and GitHub.
total_changes
Return the total number of changes (added + removed + modified).
summary
Return a human-readable summary of the diff.
Source code in src/horde_model_reference/sync/comparator.py
ModelReferenceComparator
Compares PRIMARY and GitHub model references to detect differences.
Source code in src/horde_model_reference/sync/comparator.py
compare_categories
compare_categories(
*,
category: MODEL_REFERENCE_CATEGORY,
primary_data: dict[str, dict[str, Any]],
github_data: dict[str, dict[str, Any]],
) -> ModelReferenceDiff
Compare PRIMARY and GitHub data for a specific category.
Parameters:
-
category(MODEL_REFERENCE_CATEGORY) –The category being compared.
-
primary_data(dict[str, dict[str, Any]]) –The model reference data from PRIMARY (v1 API).
-
github_data(dict[str, dict[str, Any]]) –The model reference data from GitHub (legacy format).
Returns:
-
ModelReferenceDiff–A ModelReferenceDiff object containing all detected differences.