tools/android/dependency_analysis/serialization.py
def dump_class_and_package_graphs_to_file(
        class_graph: class_dependency.JavaClassDependencyGraph,
        package_graph: package_dependency.JavaPackageDependencyGraph,
        filename: str):
    """Dumps a JSON representation of the class + package graph to a file.

    We dump both graphs together because the package graph in-memory holds
    references to class nodes (for storing class edges comprising
    a package edge), and hence the class graph is needed to recreate the
    package graph. Since our use cases always want the package graph over the
    class graph, there currently no point in dumping the class graph separately.

    Structure:
    {
        'class_graph': { see JavaClassDependencyGraph.to_json },
        'package_graph': { see JavaPackageDependencyGraph.to_json },
    }
    """
    json_obj = {
        json_consts.CLASS_GRAPH: create_json_obj_from_graph(class_graph),
        json_consts.PACKAGE_GRAPH: create_json_obj_from_graph(package_graph),
        json_consts.BUILD_METADATA: create_build_metadata(),
    }
    with open(filename, 'w') as json_file:
        json.dump(json_obj, json_file, separators=(',', ':'))
Dumps a JSON representation of the class + package graph to a file.

    We dump both graphs together because the package graph in-memory holds
    references to class nodes (for storing class edges comprising
    a package edge), and hence the class graph is needed to recreate the
    package graph. Since our use cases always want the package graph over the
    class graph, there currently no point in dumping the class graph separately.

    Structure:
    {
        'class_graph': { see JavaClassDependencyGraph.to_json },
        'package_graph': { see JavaPackageDependencyGraph.to_json },
    }
    
Dumps a JSON representation of the class + package graph to a file.
We dump both graphs together because the package graph in-memory holds
references to class nodes (for storing class edges comprising
a package edge), and hence the class graph is needed to recreate the
package graph. Since our use cases always want the package graph over the
class graph, there currently no point in dumping the class graph separately.


Dumps a JSON representation of the class + package graph to a file . We dump both graphs together because the package graph in - memory holds references to class nodes ( for storing class edges comprising a package edge ) and hence the class graph is needed to recreate the package graph . Since our use cases always want the package graph over the class graph there currently no point in dumping the class graph separately .
def dump_class_and_package_graphs_to_file(
        class_graph: class_dependency.JavaClassDependencyGraph,
        package_graph: package_dependency.JavaPackageDependencyGraph,
        filename: str):
    json_obj = {
        json_consts.CLASS_GRAPH: create_json_obj_from_graph(class_graph),
        json_consts.PACKAGE_GRAPH: create_json_obj_from_graph(package_graph),
        json_consts.BUILD_METADATA: create_build_metadata(),
    }
    with open(filename, 'w') as json_file:
        json.dump(json_obj, json_file, separators=(',', ':'))
def dump_class_and_package_graphs_to_file ( class_graph : class_dependency . JavaClassDependencyGraph , package_graph : package_dependency . JavaPackageDependencyGraph , filename : str ) : json_obj = { json_consts . CLASS_GRAPH : create_json_obj_from_graph ( class_graph ) , json_consts . PACKAGE_GRAPH : create_json_obj_from_graph ( package_graph ) , json_consts . BUILD_METADATA : create_build_metadata ( ) , } with open ( filename , 'w' ) as json_file : json . dump ( json_obj , json_file , separators = ( ',' , ':' ) )
Dumps a JSON representation of the class + package graph to a file.
Dumps a JSON representation of the class + package graph to a file .
"""Dumps a JSON representation of the class + package graph to a file.

    We dump both graphs together because the package graph in-memory holds
    references to class nodes (for storing class edges comprising
    a package edge), and hence the class graph is needed to recreate the
    package graph. Since our use cases always want the package graph over the
    class graph, there currently no point in dumping the class graph separately.

    Structure:
    {
        'class_graph': { see JavaClassDependencyGraph.to_json },
        'package_graph': { see JavaPackageDependencyGraph.to_json },
    }
    """
class_graph
class_dependency.JavaClassDependencyGraph
package_graph
package_dependency.JavaPackageDependencyGraph
filename
str