def gen_graph()

in uberpoet/commandlineutil.py [0:0]


def gen_graph(gen_type, config):
    # app_node, node_list = None, None
    modules_per_layer = config.module_count / config.app_layer_count

    if gen_type == ModuleGenType.flat:
        app_node, node_list = ModuleNode.gen_flat_graph(config.module_count)
    elif gen_type == ModuleGenType.bs_flat:
        app_node, node_list = ModuleNode.gen_flat_big_small_graph(config.big_module_count, config.small_module_count)
    elif gen_type == ModuleGenType.layered:
        app_node, node_list = ModuleNode.gen_layered_graph(config.app_layer_count, modules_per_layer)
    elif gen_type == ModuleGenType.bs_layered:
        app_node, node_list = ModuleNode.gen_layered_big_small_graph(config.big_module_count, config.small_module_count)
    elif gen_type == ModuleGenType.dot and config.dot_file_path and config.dot_root_node_name:
        logging.info("Reading dot file: %s", config.dot_file_path)
        app_node, node_list = dotreader.DotFileReader().read_dot_file(config.dot_file_path, config.dot_root_node_name)
    else:
        logging.error("Unexpected argument set, aborting.")
        item_list = ', '.join(ModuleGenType.enum_list())
        logging.error("Choose from ({}) module count: {} dot path: {} ".format(item_list, config.module_count,
                                                                               config.dot_path))
        raise ValueError("Invalid Arguments")

    return app_node, node_list