#!/usr/bin/env python3 import json def group_by_prefix(x, y): # sections = [] # with open("asList.json", "r") as generatedFile: # data = json.load(generatedFile) # # # list of all groups of entries that are in the same file # # by_file = {} # for entry in data: # by_file[entry["declaredAt"][0]] = entry # # for file, entry in by_file.items(): # def as_cluster(content): # return f""" # subgraph \"{file}\" {{ # {content} # }} # """ # # buffer = [] # for arc in entry["definedBy"]: # for defsite in entry["declaredAt"]: # if arc != defsite: # # buffer += [ # f"\"{arc}\" -> \"{".".join(entry["optionPath"])}\";" # ] # # if len(buffer) > 0: # sections += [ as_cluster("\n".join(buffer)) ] # # content = "\n".join(sections) # print("digraph {\n compound=true;\n" + content + "\n}")