Reformat the data object and add the docs properties for d3.js compliance
(data, zone, groups)
| 280 | |
| 281 | |
| 282 | def reformat_data(data, zone, groups): |
| 283 | """ |
| 284 | Reformat the data object and add the docs properties for d3.js compliance |
| 285 | """ |
| 286 | for i in range(0, len(data["nodes"])): |
| 287 | data["nodes"][i]["name"] = data["nodes"][i]["id"] |
| 288 | |
| 289 | # Build relationships |
| 290 | for tmp_links in data["links"]: |
| 291 | if ( |
| 292 | data["nodes"][i]["id"] == tmp_links["target"] |
| 293 | and tmp_links["source"] not in data["nodes"][i]["depends"] |
| 294 | and tmp_links["source"] != data["nodes"][i]["id"] |
| 295 | ): |
| 296 | data["nodes"][i]["depends"].append(tmp_links["source"]) |
| 297 | |
| 298 | if ( |
| 299 | data["nodes"][i]["id"] == tmp_links["source"] |
| 300 | and tmp_links["target"] not in data["nodes"][i]["dependedOnBy"] |
| 301 | and tmp_links["target"] != data["nodes"][i]["id"] |
| 302 | ): |
| 303 | data["nodes"][i]["dependedOnBy"].append(tmp_links["target"]) |
| 304 | |
| 305 | # Create docs |
| 306 | data["nodes"][i]["docs"] = build_docs(data["nodes"][i], zone, groups) |
| 307 | data["nodes"][i]["group"] = groups[data["nodes"][i]["type"]] |
| 308 | |
| 309 | |
| 310 | def main(logger=None): |