hpcflow.sdk.core.utils.read_YAML_str#

hpcflow.sdk.core.utils.read_YAML_str(yaml_str, typ='safe', variables=None, source=None)#

Load a YAML string. This will produce basic objects.

Parameters:
  • yaml_str (str) – The YAML string to parse.

  • typ – Load type passed to the YAML library.

  • variables (dict[str, str] | Literal[False] | None) – String variables to substitute in yaml_str. Substitutions will be attempted if the file looks to contain variable references (like “<<var:name>>”). If set to False, no substitutions will occur.

  • source (str | None) – Used to document the source of the YAML string if raising a parsing error. Typically, this should be a string that starts with “from …”, e.g. “from the file path ‘/path/to/bad/file’”.

Return type:

Any