schrodinger.models.yaml_utils module¶
Utility functions for converting CompoundParam to/from YAML format.
In addition to simply serializing/deserializing CompoundParam objects, these utility functions support the concept of “versioning” CompoundParam objects. See the adapter decorator in schrodinger.models.json for more information on versioning.
Example usage:
>>> class Contact(CompoundParam):
... first_name: str
... last_name: str
... age: int
...
>>> contact = Contact(first_name='John', last_name='Doe', age=30)
>>> yaml_str = param_to_yaml_str(contact)
>>> imported_contact = yaml_str_to_param(yaml_str, Contact)
- schrodinger.models.yaml_utils.param_to_yaml_str(param: schrodinger.models.parameters.CompoundParam) str ¶
- schrodinger.models.yaml_utils.yaml_str_to_param(yaml_str: str, param_cls: type) schrodinger.models.parameters.CompoundParam ¶
- schrodinger.models.yaml_utils.param_to_yaml_file(param: schrodinger.models.parameters.CompoundParam, file_path: str)¶
- schrodinger.models.yaml_utils.yaml_file_to_param(file_path: str, param_cls: type) schrodinger.models.parameters.CompoundParam ¶