deserialize_from

qililab.deserialize_from(file, cls=None)

Deserialize a YAML file to an object.

Parameters:
  • file (str) – The file path of the YAML file to deserialize.

  • cls (type[T], optional) – The class type to cast the deserialized object to. Defaults to None.

Raises:

DeserializationError – If deserialization fails or the resulting object is not of the specified type.

Returns:

The deserialized object, optionally cast to the specified class type.

Return type:

Any | T