Exemplo n.º 1
0
 def run(self, output_filename):
     graph = MutableAttributeGraph(edges=(
         AttributedEdge(from_node="BTC.CAB.X.ClassA",
                        to_node="BTC.CAB.Y.B"),
         AttributedEdge(from_node="BTC.CAB.X.ClassC",
                        to_node="BTC.CAB.Y.B"),
         AttributedEdge(from_node="BTC.CAB.Z.ClassD",
                        to_node="BTC.CAB.Y.B"),
     ))
     graph.lookup_edge("BTC.CAB.X.ClassA", "BTC.CAB.Y.B").set_attrs(
         {EdgeAttributes.COLOR: Colors.RED})
     outfile = open(output_filename, "w")
     outputter = self.__graph_outputter_class(
         graph=graph,
         outfile=outfile,
         decorator_config=DecoratorSet(
             node_label_decorators=(MyNodeColorDecorator(), ), ),
         output_groups=True,
         node_grouper=CABStyleFinestLevelModuleGrouperInternal(
             modules=graph.node_names(),
             internal_modules=graph.node_names(),
             min_parts=3),
         description=GraphDescriptionImpl(description="test",
                                          basename=output_filename))
     outputter.output_all()
Exemplo n.º 2
0
 def test_edges_equals(self):
     self.assertEqual(
         AttributedEdge(from_node='a', to_node='c', attrs={}),
         AttributedEdge(from_node='a',
                        to_node='c',
                        attrs={EdgeAttributes.STYLE: EdgeStyles.SOLID}),
     )
Exemplo n.º 3
0
 def test_sorting_edges_case_sensitive(self):
     edges = (
         AttributedEdge(from_node='a', to_node='c'),
         AttributedEdge(from_node='A', to_node='b'),
         AttributedEdge(from_node='a', to_node='b'),
     )
     sorted_edges = tuple(sorted(edges))
     self.assertEqual(sorted_edges, (edges[1], edges[2], edges[0]))
Exemplo n.º 4
0
 def test_sorting_edges_complex(self):
     edges = (
         AttributedEdge(from_node='btc', to_node='timeSeries'),
         AttributedEdge(from_node='BTC', to_node='timeSeries'),
         AttributedEdge(from_node='btc', to_node='timeSeries.test'),
         AttributedEdge(from_node='BTC', to_node='timeSeries.API'),
     )
     sorted_edges = tuple(sorted(edges))
     self.assertEqual(sorted_edges,
                      (edges[1], edges[3], edges[0], edges[2]))
Exemplo n.º 5
0
 def get_module_link_deps_graph(self):
     if self.__module_link_deps_graph == None:
         self.__module_link_deps_graph = AttributeGraph(edges=[
             AttributedEdge(from_node=f, to_node=t)
             for (f, t) in self.__get_module_link_deps()
         ])
     return self.__module_link_deps_graph.immutable()
def main():
    logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
    Configurator().default()

    module_name = 'BtcCommonsCore'
    restrict_to_headers = False

    file_to_module_map = config_file_to_module_map_supply.generate_file_to_module_map(
        False)
    all_file_links = config_file_include_deps_supply.get_file_include_deps()
    module_file_links = (AttributedEdge(from_node=from_file, to_node=to_file)
                         for (from_file, to_file) in all_file_links
                         if from_file in file_to_module_map and \
                         VirtualModuleTypes.remove_suffixes(file_to_module_map[from_file]) == module_name and \
                         (not restrict_to_headers or from_file.endswith('.h')))
    #pprint(list(module_file_links))
    # TODO is this correct? does the output graph contain anything if the module list is empty?
    dependency_filter = DefaultDependencyFilter(
        config=MyDependencyFilterConfiguration(), module_list=())
    #module_list=set(edge.get_from_node() for edge in module_file_links))
    graph = DependencyFilterHelper.filter_graph(
        dependency_filter=dependency_filter,
        graph=AttributeGraph(edges=module_file_links))

    decorator_config = DecoratorSet(
        edge_label_decorators=[SCCEdgeDecorator()],
        node_label_decorators=[
            NodeSizeLabelDecorator(size_func=FileSizer.get_file_size),
            NodeSizeScalingDecorator(size_func=FileSizer.get_file_size,
                                     min_render_size=3,
                                     max_render_size=14,
                                     scale_type=ScalingTypes.RADICAL),
            ModuleColorNodeDecorator(EPMNodeColorer()),
        ])
    graph_description = GraphDescriptionImpl(
        description="internal include dependencies of %s" % module_name,
        basename=os.path.join(config_basic.get_results_directory(),
                              module_name),
        section='module-internal')
    DependencyFilterOutputterTools.output_detail_and_overview_graph(
        graph=graph,
        #decorator_config=decorator_config,
        description=graph_description,
        outputter=DependencyFilterOutputter(decorator_config=decorator_config),
        module_group_conf=MyNodeGroupingConfiguration(MyNodeGrouper()))
Exemplo n.º 7
0
 def test_edges_directed(self):
     self.assertNotEqual(
         AttributedEdge(from_node='a', to_node='c', attrs={}),
         AttributedEdge(from_node='c', to_node='a', attrs={}))