-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_strings.py
More file actions
44 lines (35 loc) · 1.17 KB
/
Copy pathpatch_strings.py
File metadata and controls
44 lines (35 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import urllib.parse
import json
def fix_keys(k):
v=urllib.parse.unquote(k)
if "Vegapunk" in v:
v=v.replace("/"," ")
if (s:="Arabasta") in v:
v=v.replace(s,"Alabasta")
if "Buggy Pirates#" in v:
v=v.replace("Buggy Pirates#","")
return v
def fix_dictionary(d:dict):
d["Pacifista"]=list(set(d["Pacifista#Pacifista Units"] + d["Pacifistas"] + d["Pacifista"]))
del d["Pacifista#Pacifista Units"]
del d["Pacifistas"]
d["Monkey D. Luffy (Romance Dawn)"]=[]
d["Monkey D. Garp (Romance Dawn)"]=[]
to_deli=[]
for k,v in d.items():
if "Luffy/" in k:
d["Monkey D. Luffy (Romance Dawn)"]+=d[k]
to_deli.append(k)
if "Garp#" in k:
d["Monkey D. Garp (Romance Dawn)"]+=d[k]
to_deli.append(k)
if "Usopp/" in k:
d["Sogeking"]+=d[k]
to_deli.append(k)
d[k]=list(set(v))
for k in to_deli: del d[k]
return d
with open("./raw_data.json","r") as f: c=json.load(f)
c={fix_keys(k):v for k,v in c.items()}
c=fix_dictionary(c)
with open("./mycharacters.json","w") as f: json.dump(c,f)