mirror of
https://gitlab.com/jrmiller82/pathfinder-2-sqlite.git
synced 2026-10-12 22:29:44 -04:00
move some files to data/yaml/deprecated
This commit is contained in:
1 parent
ed7d6f0f9f
commit
e66d27303a
2 files changed
No files matched your search
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
#
|
||||
import csv
|
||||
import yaml
|
||||
|
||||
def main():
|
||||
# Load the CSV file and print out the false ones that need to be updated
|
||||
csvlist = []
|
||||
with open('../../scripts/feat_level.csv') as csvfile:
|
||||
reader = csv.DictReader(csvfile)
|
||||
for row in reader:
|
||||
if row['match'] == "False":
|
||||
csvlist.append(dict(row))
|
||||
res = yaml.safe_dump(csvlist, allow_unicode=True, width=100000)
|
||||
with open('feats-levels-false-matches.yaml', 'w') as f:
|
||||
f.write(res)
|
||||
|
||||
# Load the CSV file and make YAML file for the matched ones
|
||||
truelist = []
|
||||
with open('../../scripts/feat_level.csv') as csvfile:
|
||||
reader = csv.DictReader(csvfile)
|
||||
for row in reader:
|
||||
if row['match'] == "True":
|
||||
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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user