torchcell.datamodels.schema.HashableProvenanceGapMixin
- class HashableProvenanceGapMixin(*, provenance_gaps: list[~torchcell.verification.sourced.ProvenanceGap] = <factory>)[source]
Bases:
ProvenanceGapMixinProvenanceGapMixinfor a model that must stay hashable.A frozen pydantic model hashes the tuple of its field values, so a
listfield (provenance_gaps) makes it unhashable.Genotype.__eq__compares perturbations as aset, 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].