Compare commits

...

4 commits

Author SHA1 Message Date
03fb76e0fc Remove unused mode variable 2024-10-21 20:33:32 -07:00
8f74ce3a28 Add license to prepare for use by another project 2024-10-19 17:40:07 -07:00
1af6a89e6b 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.
2024-10-16 23:09:59 -07:00
82ff5f86f4 Fix formatting oddness for foes with no weakness 2024-10-16 22:58:57 -07:00
2 changed files with 38 additions and 3 deletions

29
LICENSE.md Normal file
View file

@ -0,0 +1,29 @@
"i'm so tired" software license 1.0
copyright (c) 2024 Trysdyn Black
this is anti-capitalist, anti-bigotry software, made by people who are tired of ill-intended organisations and individuals, and would rather not have those around their creations.
permission is granted, free of charge, to any user (be they a person or an organisation) obtaining a copy of this software, to use it for personal, commercial, or educational purposes, subject to the following conditions:
1. the above copyright notice and this permission notice shall be included in all copies or modified versions of this software.
2. the user is one of the following:
a. an individual person, labouring for themselves
b. a non-profit organisation
c. an educational institution
d. an organization that seeks shared profit for all of its members, and allows non-members to set the cost of their labor
3. if the user is an organization with owners, then all owners are workers and all workers are owners with equal equity and/or equal vote.
4. if the user is an organization, then the user is not law enforcement or military, or working for or under either.
5. the user does not use the software for ill-intentioned reasons, as determined by the authors of the software. said reasons include but are not limited to:
a. bigotry, including but not limited to racism, xenophobia, homophobia, transphobia, ableism, sexism, antisemitism, religious intolerance
b. pedophilia, zoophilia, and/or incest
c. support for cops and/or the military
d. any blockchain-related technology, including but not limited to cryptocurrencies
6. the user does not promote or engage with any of the activities listed in the previous item, and is not affiliated with any group that promotes or engages with any of such activities.
this software is provided as is, without any warranty or condition. in no event shall the authors be liable to anyone for any damages related to this software or this license, under any kind of legal claim.

12
main.py
View file

@ -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("|"):
@ -60,6 +61,11 @@ class Parser: # noqa: PLR0904
weak_text = "WEAK: "
info["nullifies"] = null_text.split(": ")[1].split(", ")
info["weak"] = weak_text.split(": ")[1].split(", ")
# Due to split oddness we can populate a blank string into weakness
# Delete it if we did.
if info["weak"] == [""]:
del info["weak"]
# Specials are name=>desc as k:v
# I *think* you can only have one special...
elif line.startswith("SPECIAL"):
@ -139,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("|"):
@ -417,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
@ -445,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:
@ -501,7 +508,6 @@ class Parser: # noqa: PLR0904
need.
"""
result = {}
mode = None
for line in data.split("\n"):
if "-----" in line or not line.strip():