module documentation
yamlutil.py - Utility helpers for YAML.
Provides dump, parse helper functions for general-purpose ZMS utilities and shared helper functions. It provides common patterns like type checking, data transformation, and error handling.
License: GNU General Public License v2 or later, Organization: ZMS Publishing
| Function | dump |
Serializes a Python object to a YAML-formatted string. |
| Function | parse |
Deserializes a YAML-formatted string to a Python object. |
| Constant | IMPORT |
Message returned when `ruamel.yaml` cannot be imported. |
| Function | __cleanup |
Recursively cleans up a dictionary by removing keys with falsy values. |
| Function | _load |
Helper function to load the YAML library and handle import errors. |
Serializes a Python object to a YAML-formatted string.
| Parameters | |
| data:object | The Python object to serialize. |
| Returns | |
| str | YAML-formatted string or error message if YAML library is not available. |
Deserializes a YAML-formatted string to a Python object.
| Parameters | |
| data:str | The YAML-formatted string to deserialize. |
| Returns | |
| object | The deserialized Python object or error message if YAML library is not available. |
Message returned when `ruamel.yaml` cannot be imported.
| Value |
|