MCPcopy Create free account
hub / github.com/CyberPoint/libpgm / alter_vdata

Function alter_vdata

utils/bntextutils.py:81–101  ·  view source on GitHub ↗
(path, node)

Source from the content-addressed store, hash-verified

79 json.dump(j, f, indent=2)
80
81def 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
103def refresh(path):
104 """updates ord, numoutcomes, parents, and children in vdata"""

Callers

nothing calls this directly

Calls 2

_validateFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected