Skip to content

yaml

ToYamlModuleOld (OldTypeConversionModule)

Convert arbitrary types into YAML format.

Early days for this module, it doesn't support a whole lot of types yet.

Source code in core/yaml.py
class ToYamlModuleOld(OldTypeConversionModule):
    """Convert arbitrary types into YAML format.

    Early days for this module, it doesn't support a whole lot of types yet.
    """

    _module_type_name = "to_yaml"

    @classmethod
    def _get_supported_source_types(self) -> typing.Union[typing.Iterable[str], str]:
        return YAML_SUPPORTED_SOURCE_TYPES

    @classmethod
    def _get_target_types(self) -> typing.Union[typing.Iterable[str], str]:
        return ["yaml"]

    def convert(
        self, value: Value, config: typing.Mapping[str, typing.Any]
    ) -> typing.Any:

        input_value: typing.Any = value.get_value_data()

        input_value_str = convert_to_yaml(
            self._kiara, data=input_value, convert_config=config
        )
        return input_value_str