| 79 | json.dump(j, f, indent=2) |
| 80 | |
| 81 | def alter_vdata(path, node): |
| 82 | _validate(path) |
| 83 | with open(path, "r") as f: |
| 84 | j = json.load(f) |
| 85 | assert node in j["V"], "node not present" |
| 86 | print "Current node data: " |
| 87 | print "------------------ " |
| 88 | try: |
| 89 | print json.dumps(j["Vdata"][node], indent=2) |
| 90 | except KeyError: |
| 91 | print "[uninitialized! you may create this node data]" |
| 92 | print "enter new node data: " |
| 93 | while (1): |
| 94 | try: |
| 95 | minij = json.load(sys.stdin) |
| 96 | break |
| 97 | except: |
| 98 | print("malformatted json, try again:") |
| 99 | j["Vdata"][node] = minij |
| 100 | with open(path, "w") as f: |
| 101 | json.dump(j, f, indent=2) |
| 102 | |
| 103 | def refresh(path): |
| 104 | """updates ord, numoutcomes, parents, and children in vdata""" |