Ejemplo n.º 1
0
def get_loader(*args, **kwargs) -> YAML:
    yaml = YAML()
    yaml.version = (1, 2)  # type: ignore

    yaml.Parser = Parser
    yaml._constructor = CustomConstructor(yaml, *args,
                                          **kwargs)  # type: ignore

    return yaml
Ejemplo n.º 2
0
def get_loader(macros_root: str = None, context: ContextType = {}) -> YAML:
    yaml = YAML()
    yaml.version = (1, 2)  # type: ignore

    yaml.Parser = Parser
    yaml._constructor = CustomConstructor(  # type: ignore
        yaml,
        # macros_root=macros_root,
        macro_provider=MacroProvider(macros_root).get_macro,
        context=context
    )

    return yaml
Ejemplo n.º 3
0
def get_constructor():
    yaml = YAML()
    yaml._constructor = CustomConstructor(loader=yaml)
    yaml.version = (1, 2)

    return yaml.constructor