def _generate_inbound_stats(
        class_graph: class_dependency.JavaClassDependencyGraph,
        class_names: List[str]) -> Dict[str, int]:
    valid_class_names = \
        print_dependencies_helper.get_valid_classes_from_class_list(
            class_graph, class_names)

    result = {}
    for class_name, valid_class_name in zip(class_names, valid_class_names):
        node: class_dependency.JavaClass = class_graph.get_node_by_key(
            valid_class_name)
        result[f'inbound_{class_name}'] = len(node.inbound)
    return result
Exemple #2
0
def print_class_dependencies_for_key(
        class_graph: class_dependency.JavaClassDependencyGraph, key: str,
        print_mode: PrintMode):
    """Prints dependencies for a valid key into the class graph."""
    node: class_dependency.JavaClass = class_graph.get_node_by_key(key)

    if print_mode.inbound:
        print(f'{len(node.inbound)} inbound dependency(ies) into {node.name}:')
        print_class_nodes(graph.sorted_nodes_by_name(node.inbound), print_mode)

    if print_mode.outbound:
        print(
            f'{len(node.outbound)} outbound dependency(ies) from {node.name}:')
        print_class_nodes(graph.sorted_nodes_by_name(node.outbound),
                          print_mode)
Exemple #3
0
def print_class_dependencies_for_key(
        class_graph: class_dependency.JavaClassDependencyGraph, key: str,
        print_mode: PrintMode) -> TargetDependencies:
    """Prints dependencies for a valid key into the class graph."""
    target_dependencies = TargetDependencies()
    node: class_dependency.JavaClass = class_graph.get_node_by_key(key)

    if print_mode.inbound:
        print_class_dependencies(graph.sorted_nodes_by_name(node.inbound),
                                 print_mode, node, INBOUND)

    if print_mode.outbound:
        target_dependencies = print_class_dependencies(
            graph.sorted_nodes_by_name(node.outbound), print_mode, node,
            OUTBOUND)
    return target_dependencies