From eb458395095e6913a3ca66db6bddfbf12b9666bc Mon Sep 17 00:00:00 2001 From: Vincent Lee Date: Mon, 25 Nov 2024 21:07:46 +0000 Subject: [PATCH] Update schema to match upstream API --- README.md | 2 +- pyproject.toml | 23 ++++++++------------- scripts/updateUpstreamSchema.py | 2 +- sendou/models/tournament/bracket/bracket.py | 1 + sendou/models/tournament/tournament.py | 2 ++ sendou/models/user.py | 4 ++++ 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index e9682af..9b67aee 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ This script uses the GitHub API to check that the SHA stored in `tool.sendou-py. for the upstream schema. ```bash -python3 python3 scripts/checkUpstreamSchema.py +§§ ``` diff --git a/pyproject.toml b/pyproject.toml index 22dcbf1..95f0c3c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "sendou-py" -version = "1.2.8" +version = "1.2.9" description = "An async Python library for Sendou.ink" authors = [ "Vincent Lee ",] license = "MIT" @@ -12,13 +12,10 @@ readme = "README.md" homepage = "https://github.com/IPLSplatoon/sendou.py/" repository = "https://github.com/IPLSplatoon/sendou.py/" documentation = "https://sendou.opensource.iplabs.work/" -keywords = ["splatoon", "sendou.ink"] -classifiers = [ - "Topic :: Software Development :: Libraries :: Python Modules", - "Development Status :: 4 - Beta", - "Framework :: AsyncIO" -] -packages = [{include="sendou"}] +keywords = [ "splatoon", "sendou.ink",] +classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", "Development Status :: 4 - Beta", "Framework :: AsyncIO",] +[[tool.poetry.packages]] +include = "sendou" [tool.poetry.dependencies] python = "^3.10" @@ -26,14 +23,12 @@ python-dateutil = "^2.8.2" aiohttp-client-cache = "^0.11.0" [tool.sendou-py.source] -schema_commit = "5ad69f941f3844d89153e4ac03184a0482e8df3b" +schema_commit = "6d654baa3094813fa125fef404311c08352676f6" schema_path = "app/features/api-public/schema.ts" [tool.pytest.ini_options] -addopts = [ - "--import-mode=importlib", -] -testpaths = ["tests"] +addopts = [ "--import-mode=importlib",] +testpaths = [ "tests",] [tool.poetry.group.dev.dependencies] pytest = "^8.3.2" @@ -41,4 +36,4 @@ asyncio = "^3.4.3" toml = "^0.10.2" [tool.poetry.group.ci.dependencies] -pytest-md-report = "^0.6.2" \ No newline at end of file +pytest-md-report = "^0.6.2" diff --git a/scripts/updateUpstreamSchema.py b/scripts/updateUpstreamSchema.py index f6cb0df..562cd27 100644 --- a/scripts/updateUpstreamSchema.py +++ b/scripts/updateUpstreamSchema.py @@ -27,7 +27,7 @@ async def main(): exit(0) toml_data["tool"]["sendou-py"]["source"]["schema_commit"] = latest_sha - with open("../pyproject.toml", "w") as f: + with open("./pyproject.toml", "w") as f: toml.dump(toml_data, f) print("Updated schema_commit in pyproject.toml ✅") diff --git a/sendou/models/tournament/bracket/bracket.py b/sendou/models/tournament/bracket/bracket.py index 2255cc1..073eec8 100644 --- a/sendou/models/tournament/bracket/bracket.py +++ b/sendou/models/tournament/bracket/bracket.py @@ -82,6 +82,7 @@ class BracketStage: created_at: Optional[datetime] # Provided as unix timestamp def __init__(self, data: dict): + self.created_at = None self.id = data.get("id", 0) self.name = data.get("name", "") self.number = data.get("number", 0) diff --git a/sendou/models/tournament/tournament.py b/sendou/models/tournament/tournament.py index fdb0b96..b52470b 100644 --- a/sendou/models/tournament/tournament.py +++ b/sendou/models/tournament/tournament.py @@ -107,6 +107,7 @@ class Tournament(BaseModel): teams: TournamentTeamInfo brackets: List[TournamentBracket] organization_id: Optional[int] + is_finalised: bool def __init__(self, id: int, data: dict, request_client: RequestsClient): """ @@ -127,6 +128,7 @@ def __init__(self, id: int, data: dict, request_client: RequestsClient): self.brackets = [TournamentBracket(bracket, index, self.id, request_client) for index, bracket in enumerate(data.get("brackets", []))] self.organization_id = data.get("organizationId", None) + self.is_finalised = data.get("isFinalized", False) async def get_teams(self) -> List[TournamentTeam]: """ diff --git a/sendou/models/user.py b/sendou/models/user.py index c4c54bd..2de84db 100644 --- a/sendou/models/user.py +++ b/sendou/models/user.py @@ -20,10 +20,14 @@ class UserSocials: """ twitch: Optional[str] twitter: Optional[str] + battlefy: Optional[str] + bsky: Optional[str] def __init__(self, data: dict): self.twitch = data.get("twitch") self.twitter = data.get("twitter") + self.battlefy = data.get("battlefy") + self.bsky = data.get("bsky") class UserWeapon: