def collect_resources():
    nodes = make_graph('msgraph')
    nodes_render = []
    for node_name in sorted(nodes):
        nodes_render.append(
            RESOURCE_TEMPLATE.render(resource=nodes[node_name]))
    return '\n\n'.join(nodes_render)
Exemple #2
0
def collect_resources_dict() -> dict:
    nodes = make_graph('azure-cli')
    filtered_nodes = {
        nodes[node_name]['name']: nodes[node_name]
        for node_name in sorted(nodes) if resource_filter(node_name)
    }
    return filtered_nodes
def collect_resources() -> str:
    nodes = make_graph('azure-cli')
    nodes_render = []
    for node_name in sorted(nodes):
        if not resource_filter(node_name):
            continue

        nodes_render.append(RESOURCE_TEMPLATE.render(resource=nodes[node_name]))
    return '\n\n'.join(nodes_render)
def collect_resources() -> str:
    nodes = make_graph('azure-cli')
    nodes_render = []
    for node_name in sorted(nodes):
        if not resource_filter(node_name):
            continue

        nodes_render.append(RESOURCE_TEMPLATE.render(resource=nodes[node_name]))
    return '\n\n'.join(nodes_render)
Exemple #5
0
def modify_resources(formula_content):
    start_resources_line_no = None
    end_resources_line_no = None
    for line_no, line_contents in enumerate(formula_content):
        if 'resource' in line_contents and start_resources_line_no is None:
            start_resources_line_no = line_no
        if 'def install' in line_contents and end_resources_line_no is None:
            end_resources_line_no = line_no - 1
            break
    # Delete resources block
    del formula_content[start_resources_line_no : end_resources_line_no]
    # The script will have installed homebrew-pypi-poet by this point so we can import
    from poet.poet import make_graph, RESOURCE_TEMPLATE
    nodes = make_graph('azure-cli')
    filtered_nodes = OrderedDict([(n, nodes[n]) for n in nodes if _should_include_resource(n)])
    resources_stanza = '\n\n'.join([RESOURCE_TEMPLATE.render(resource=node) for node in filtered_nodes.values()])
    formula_content[start_resources_line_no:start_resources_line_no] = resources_stanza.split('\n')