Skip to content

octoprint.util.yaml#

dump(data, pretty = False, **kwargs) #

Safely and performantly dumps the data to a yaml string.

:param data: the data to be serialized :param pretty: formats the output yaml into a more human-friendly format :param kwargs: any other args to be passed to the internal yaml.dump() call. :return: yaml-serialized data :rtype: str

load_from_file(file: TextIO = None, path: str = None) -> Union[Dict[Hashable, Any], list, None] #

Safely and performantly loads yaml data from the given source. Either a path or a file must be passed in.

save_to_file(data, file = None, path = None, pretty = False, **kwargs) #

Safely and performantly dumps the data to yaml.

To dump to a string, use yaml.dump().

:type data: object :param data: the data to be serialized :type file: typing.TextIO | None :type path: str | None :type pretty: bool :param pretty: formats the output yaml into a more human-friendly format