Skip to content

yggdrasil.pyutils.equality

equality

dicts_equal

dicts_equal(
    a: Dict[str, Any],
    b: Dict[str, Any],
    *,
    keys: Iterable[str] | None = None,
    treat_missing_as_none: bool = True,
    float_tol: float = 0.0
) -> bool

Equality check for two dicts with options: - keys: only compare these keys - treat_missing_as_none: missing key == None if other side is None - float_tol: tolerance for float comparisons

dict_diff

dict_diff(
    a: Dict[str, Any],
    b: Dict[str, Any],
    *,
    keys: Iterable[str] | None = None,
    treat_missing_as_none: bool = True,
    float_tol: float = 0.0
) -> Dict[str, Tuple[Any, Any]]

Returns {key: (a_val, b_val)} for all keys that differ.