Account for commas
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 7s

This commit is contained in:
Nexus 2024-05-03 20:34:56 +01:00
parent 03cf6c0780
commit 50381a11c3
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -13,7 +13,7 @@ from discord.ext import commands
SPAN_REGEX = re.compile(
r"^(?P<party>[a-zA-Z]+)\s(?P<councillors>\d+)\scouncillors\s(?P<net>\d+)\scouncillors\s(?P<net_change>(gained|lost))$"
r"^(?P<party>(\D+)(?P<councillors>[0-9,]+)\scouncillors\s(?P<net>[0-9,]+)\scouncillors\s(?P<net_change>(gained|lost))$"
)
MULTI: dict[str, int] = {
"gained": 1,
@ -89,9 +89,9 @@ class ElectionCog(commands.Cog):
)
continue
results[str(groups["party"])] = [
int(groups["councillors"]),
int(groups["net"]) * MULTI[groups["net_change"]],
results[str(groups["party"]).strip()] = [
int(groups["councillors"].strip().strip(",")),
int(groups["net"].strip().strip(",")) * MULTI[groups["net_change"]],
int(find_colour(child_ul.next["class"][0])[1:], base=16)
]
return results