Ejemplo n.º 1
0
def construct_hook(loader: yaml.Loader, node: yaml.Node) -> Py:
    conn_name = loader.construct_yaml_str(node)
    if not re.match(r'\w+', conn_name):
        raise ValueError(
            f'Error constructing hook. Expected connection name, found {conn_name}'
        )
    return Py(f'$HOOK.{conn_name}')
Ejemplo n.º 2
0
def construct_variable(loader: yaml.Loader, node: yaml.Node) -> Py:
    var_id = loader.construct_yaml_str(node)
    if not re.match(r'\w+', var_id):
        raise ValueError(
            f'Error constructing variable. Expected variable id, found {var_id}'
        )
    return Py(f'$VARIABLE.{var_id}')
Ejemplo n.º 3
0
def construct_template(loader: yaml.Loader, node: yaml.Node):
    template_str = loader.construct_yaml_str(node)
    return Py(f"jinja2.Template('{template_str}')")