add in the true matches to feats.yaml closes #65

This commit is contained in:
jrmiller82 committed 2019-11-30 13:01:03 -06:00
1 parent 2b9a7a3530
commit ed7d6f0f9f
2 files changed
+1668 -871

No files matched your search

+25 -6
View File
@@ -22,18 +22,37 @@ def main():
reader = csv.DictReader(csvfile)
for row in reader:
if row['match'] == "True":
tmp = {'name': row['name'], 'level': row['level']}
r = dict(row)
tmp = {'name': r['name'], 'level': r['level']}
truelist.append(tmp)
trueres = yaml.safe_dump(truelist, allow_unicode=True, width=100000)
with open('feats-levels-true-matches.yaml', 'w') as f:
f.write(trueres)
# open up feats.yaml
with open('feats.yaml') as yamlfile:
y = yaml.safe_load(yamlfile)
z = yaml.safe_load(trueres)
# y is original yaml to be modified
# z is new true list
for i in z:
#print("Looking for a match for: {}".format(i['name']))
match = False
for j in y['feat']:
if i['name'] == j['name']:
match = True
j['level'] = int(i['level'])
#print('We got a match for: {}'.format(i['name']))
if match == False:
print("We never got a match for: {}'.format(i['name'])")
final = yaml.safe_dump(y, allow_unicode=True, width=100000)
with open('feats.yaml', 'w') as f:
f.write(final)
# read the lines with true
#
# load feats.yaml
#
# match lines with true to feats object and add a level=? to each feat with a true match
if __name__ == "__main__":
+1643 -865
View File
File diff suppressed because it is too large. Load diff