tools/android/dependency_analysis/serialization.py
def create_class_graph_from_json_obj(
        json_obj: Dict) -> class_dependency.JavaClassDependencyGraph:
    """Creates a JavaClassDependencyGraph from a JSON representation."""
    class_graph = class_dependency.JavaClassDependencyGraph()

    for node_json_obj in json_obj[json_consts.NODES]:
        name = node_json_obj[json_consts.NAME]
        nested = node_json_obj[json_consts.META][
            class_json_consts.NESTED_CLASSES]
        build_targets = node_json_obj[json_consts.META][
            class_json_consts.BUILD_TARGETS]
        added_node = class_graph.add_node_if_new(name)
        added_node.nested_classes = set(nested)
        added_node.build_targets = set(build_targets)

    for edge_json_obj in json_obj[json_consts.EDGES]:
        begin_key = edge_json_obj[json_consts.BEGIN]
        end_key = edge_json_obj[json_consts.END]
        class_graph.add_edge_if_new(begin_key, end_key)

    return class_graph
Creates a JavaClassDependencyGraph from a JSON representation.
Creates a JavaClassDependencyGraph from a JSON representation.
Creates a JavaClassDependencyGraph from a JSON representation .
def create_class_graph_from_json_obj(
        json_obj: Dict) -> class_dependency.JavaClassDependencyGraph:
    class_graph = class_dependency.JavaClassDependencyGraph()
    for node_json_obj in json_obj[json_consts.NODES]:
        name = node_json_obj[json_consts.NAME]
        nested = node_json_obj[json_consts.META][
            class_json_consts.NESTED_CLASSES]
        build_targets = node_json_obj[json_consts.META][
            class_json_consts.BUILD_TARGETS]
        added_node = class_graph.add_node_if_new(name)
        added_node.nested_classes = set(nested)
        added_node.build_targets = set(build_targets)
    for edge_json_obj in json_obj[json_consts.EDGES]:
        begin_key = edge_json_obj[json_consts.BEGIN]
        end_key = edge_json_obj[json_consts.END]
        class_graph.add_edge_if_new(begin_key, end_key)
    return class_graph
def create_class_graph_from_json_obj ( json_obj : Dict ) -> class_dependency . JavaClassDependencyGraph : class_graph = class_dependency . JavaClassDependencyGraph ( ) for node_json_obj in json_obj [ json_consts . NODES ] : name = node_json_obj [ json_consts . NAME ] nested = node_json_obj [ json_consts . META ] [ class_json_consts . NESTED_CLASSES ] build_targets = node_json_obj [ json_consts . META ] [ class_json_consts . BUILD_TARGETS ] added_node = class_graph . add_node_if_new ( name ) added_node . nested_classes = set ( nested ) added_node . build_targets = set ( build_targets ) for edge_json_obj in json_obj [ json_consts . EDGES ] : begin_key = edge_json_obj [ json_consts . BEGIN ] end_key = edge_json_obj [ json_consts . END ] class_graph . add_edge_if_new ( begin_key , end_key ) return class_graph
Creates a JavaClassDependencyGraph from a JSON representation.
Creates a JavaClassDependencyGraph from a JSON representation .
"""Creates a JavaClassDependencyGraph from a JSON representation."""
json_obj
Dict