torchcell.datamodels.schema.HashableProvenanceGapMixin

class HashableProvenanceGapMixin(*, provenance_gaps: list[~torchcell.verification.sourced.ProvenanceGap] = <factory>)[source]

Bases: ProvenanceGapMixin

ProvenanceGapMixin for a model that must stay hashable.

A frozen pydantic model hashes the tuple of its field values, so a list field (provenance_gaps) makes it unhashable. Genotype.__eq__ compares perturbations as a set, so a gene-perturbation leaf that carries typed gaps must hash; it hashes its canonical JSON instead, which agrees with pydantic’s field-wise __eq__ (equal models dump to equal JSON). List this mixin FIRST in a leaf’s bases: pydantic keeps the first __hash__ it finds in the bases, and a frozen parent leaf carries a generated one.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].