cement.ext.ext_yaml
Cement yaml extension module.
- class cement.ext.ext_yaml.YamlConfigHandler(*args: Any, **kw: Any)[source]
Bases:
ConfigParserConfigHandlerThis class implements the Config Handler interface, and provides the same functionality of ConfigParserConfigHandler but with Yaml configuration files. See pyYaml for more information on pyYaml.
Note This extension has an external dependency on pyYaml. You must include pyYaml in your application’s dependencies as Cement explicitly does not include external dependencies for optional extensions.
Due to changes in pyYaml version 5.1 to deprecate yaml.load without specifying a Loader=…, this class will attempt to parse the yaml content with the 5.1 sugar method full_load, falling back to the “unsafe” call for versions prior to 5.1. The full_load method uses the FullLoader, which is the default Loader when none is provided. See the pyYaml message on this deprecation: https://msg.pyyaml.org/load
- class cement.ext.ext_yaml.YamlOutputHandler(*args: Any, **kw: Any)[source]
Bases:
OutputHandlerThis class implements the Output Handler interface. It provides Yaml output from a data dictionary and uses pyYaml to dump it to STDOUT. Please see the developer documentation on Output Handling.
This handler forces Cement to suppress console output until
app.renderis called (keeping the output pure Yaml). If troubleshooting issues, you will need to pass the--debugoption in order to unsuppress output and see what’s happening.- _setup(app_obj: App) None[source]
Called during application initialization and must
setupthe handler object making it ready for the framework or the application to make further calls to it.- Parameters:
app (instance) – The application object.
- cement.ext.ext_yaml.suppress_output_after_render(app: App, out_text: str) None[source]
This is a
post_renderhook that suppresses console output again after rendering, only if theYamlOutputHandleris triggered via command line.- Parameters:
app – The application object.