Skip to content

Commit 414dd07

Browse files
authored
Remove dependency on toml and types-toml (#72)
Refactor field renaming for group statistics
1 parent 53c14e1 commit 414dd07

File tree

3 files changed

+11
-17
lines changed

3 files changed

+11
-17
lines changed

noxfile.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,20 @@
2727
from pathlib import Path
2828

2929
import nox
30-
import toml
30+
import msgspec
3131

3232
SessionT = Callable[[nox.Session], None]
3333
InjectorT = Callable[[SessionT], SessionT]
3434

3535

3636
def parse_dependencies() -> t.Dict[str, str]:
37-
data = toml.load("pyproject.toml")["tool"]["poetry"]
37+
with open("pyproject.toml", "rb") as f:
38+
data = msgspec.toml.decode(f.read())
39+
40+
poetry = data["tool"]["poetry"]
3841
deps: t.Dict[str, t.Union[str, t.Dict[str, str]]] = {
39-
**data["dependencies"],
40-
**data["group"]["dev"]["dependencies"],
42+
**poetry["dependencies"],
43+
**poetry["group"]["dev"]["dependencies"],
4144
}
4245

4346
for k, v in deps.items():

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ pyright = "==1.1.344"
5050
pytest = "==7.4.4"
5151
pytest-asyncio = "==0.23.3"
5252
pytest-testdox = "==3.1.0"
53-
types-toml = "==0.10.8.7"
54-
toml = "==0.10.2"
5553

5654
[tool.black]
5755
line-length = 99

wom/models/groups/models.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import typing as t
2525
from datetime import datetime
2626

27+
import msgspec
28+
2729
from wom import enums
2830

2931
from ..base import BaseModel
@@ -318,16 +320,7 @@ class MetricLeaders(BaseModel):
318320
"""
319321

320322

321-
class GroupStatistics(
322-
BaseModel,
323-
rename={
324-
"maxed_combat_count": "maxedCombatCount",
325-
"maxed_total_count": "maxedTotalCount",
326-
"maxed_200ms_count": "maxed200msCount",
327-
"average_stats": "averageStats",
328-
"metric_leaders": "metricLeaders",
329-
},
330-
):
323+
class GroupStatistics(BaseModel):
331324
"""Represents accumulated group statistics."""
332325

333326
maxed_combat_count: int
@@ -336,7 +329,7 @@ class GroupStatistics(
336329
maxed_total_count: int
337330
"""The number of maxed total level players in the group."""
338331

339-
maxed_200ms_count: int
332+
maxed_200ms_count: int = msgspec.field(name="maxed200msCount")
340333
"""The number of maxed 200M xp players in the group."""
341334

342335
average_stats: Snapshot

0 commit comments

Comments
 (0)