Add names to large data objects
This is so if you do a jq query like `.CHARACTERS[] | select(originally == "Mog")` you'll get their name in the data output.
This commit is contained in:
parent
82ff5f86f4
commit
1af6a89e6b
1 changed files with 4 additions and 2 deletions
6
main.py
6
main.py
|
@ -43,6 +43,7 @@ class Parser: # noqa: PLR0904
|
|||
if "(Level " in line:
|
||||
name = line.split(" (")[0]
|
||||
info["stats"]["level"] = int(line.split("(Level ")[1][:-1])
|
||||
info["name"] = name
|
||||
# Stat chart rows
|
||||
elif line.startswith("|"):
|
||||
for stat in line[1:-1].split("|"):
|
||||
|
@ -144,6 +145,7 @@ class Parser: # noqa: PLR0904
|
|||
# Name
|
||||
if line[0:2].isdigit():
|
||||
name = line[4:]
|
||||
info["name"] = name
|
||||
|
||||
# Stat chart rows: BCEX Version only
|
||||
elif line.startswith("|"):
|
||||
|
@ -422,7 +424,7 @@ class Parser: # noqa: PLR0904
|
|||
elif line.strip():
|
||||
dance = line.strip()
|
||||
if dance not in result:
|
||||
result[dance] = {}
|
||||
result[dance] = {"name": dance}
|
||||
|
||||
return result
|
||||
|
||||
|
@ -450,7 +452,7 @@ class Parser: # noqa: PLR0904
|
|||
elif next_esper:
|
||||
esper = line.strip()
|
||||
if esper not in result:
|
||||
result[esper] = {"learnset": {}}
|
||||
result[esper] = {"learnset": {}, "name": esper}
|
||||
next_esper = False
|
||||
# Any line with ":" is a k=v we should just shove into the dict
|
||||
elif ": " in line:
|
||||
|
|
Loading…
Add table
Reference in a new issue