yggdrasil.data.data_utils¶
data_utils ¶
safe_constraint_name ¶
safe_constraint_name(
obj: str | list[str], limit: int = 256, prefix: str = "", suffix: str = ""
) -> str
Generate a deterministic, length-bounded, identifier-safe constraint name.
Sanitizes all parts to [A-Za-z0-9_], joins with __, wraps with
prefix and suffix, and returns it verbatim if it fits within
limit. Otherwise, replaces the middle with a BLAKE2b hex digest
sized to fit, keeping the prefix and suffix intact.