[docs]classRunDescriber:""" The object that holds the description of each run in the database. This object serialises itself to a string and is found under the run_description column in the runs table. Extension of this object is planned for the future, for now it holds the parameter interdependencies. Extensions should be objects that can convert themselves to dictionary and added as attributes to the RunDescriber, such that the RunDescriber can iteratively convert its attributes when converting itself to dictionary. """def__init__(self,interdeps:InterDependencies_,shapes:Shapes|None=None)->None:ifnotisinstance(interdeps,InterDependencies_):raiseValueError("The interdeps arg must be of type: ""InterDependencies_. "f"Got {type(interdeps)}.")self._interdeps=interdepsself._shapes=shapesself._version=3@propertydefversion(self)->int:returnself._version@propertydefshapes(self)->Shapes|None:returnself._shapes@propertydefinterdeps(self)->InterDependencies_:returnself._interdepsdef_to_dict(self)->RunDescriberV3Dict:""" Convert this object into a dictionary. This method is intended to be used only by the serialization routines. """ser:RunDescriberV3Dict={"version":self._version,"interdependencies":new_to_old(self.interdeps)._to_dict(),"interdependencies_":self.interdeps._to_dict(),"shapes":self.shapes,}returnser@classmethoddef_from_dict(cls,ser:RunDescriberDicts)->RunDescriber:""" Make a RunDescriber object from a dictionary. This method is intended to be used only by the deserialization routines. """ifser["version"]==0:ser=cast(RunDescriberV0Dict,ser)rundesc=cls(old_to_new(InterDependencies._from_dict(ser["interdependencies"])))elifser["version"]==1:ser=cast(RunDescriberV1Dict,ser)rundesc=cls(InterDependencies_._from_dict(ser["interdependencies"]))elifser["version"]==2:ser=cast(RunDescriberV2Dict,ser)rundesc=cls(InterDependencies_._from_dict(ser["interdependencies_"]))elifser["version"]>=3:ser=cast(RunDescriberV3Dict,ser)rundesc=cls(InterDependencies_._from_dict(ser["interdependencies_"]),shapes=ser["shapes"],)else:raiseRuntimeError(f"Unknown version: Cannot deserialize from {ser['version']}")returnrundescdef__eq__(self,other:Any)->bool:ifnotisinstance(other,RunDescriber):returnFalseifself.interdeps!=other.interdeps:returnFalseifself.shapes!=other.shapes:returnFalsereturnTruedef__repr__(self)->str:returnf"RunDescriber({self.interdeps}, Shapes: {self._shapes})"