How to use the nunavut.postprocessors.TrimTrailingWhitespace function in nunavut

To help you get started, we’ve selected a few nunavut examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github UAVCAN / pyuavcan / pyuavcan / dsdl / _compiler.py View on Github external
output_directory = pathlib.Path.cwd() if output_directory is None else output_directory
    language_context = nunavut.lang.LanguageContext('py', namespace_output_stem='__init__')
    root_ns = nunavut.build_namespace_tree(types=composite_types,
                                           root_namespace_dir=root_namespace_directory,
                                           output_dir=str(output_directory),
                                           language_context=language_context)
    generator = nunavut.jinja.Generator(namespace=root_ns,
                                        generate_namespace_types=nunavut.YesNoDefault.YES,
                                        templates_dir=_TEMPLATE_DIRECTORY,
                                        followlinks=True,
                                        additional_filters=filters,
                                        additional_tests=tests,
                                        post_processors=[
                                            nunavut.postprocessors.SetFileMode(_OUTPUT_FILE_PERMISSIONS),
                                            nunavut.postprocessors.LimitEmptyLines(2),
                                            nunavut.postprocessors.TrimTrailingWhitespace(),
                                        ])
    generator.generate_all()

    return GeneratedPackageInfo(path=pathlib.Path(output_directory) / pathlib.Path(root_namespace_name),
                                models=composite_types,
                                name=root_namespace_name)

nunavut

Generate code from DSDL using Jinja2 templates.

MIT
Latest version published 1 year ago

Package Health Score

53 / 100
Full package analysis