Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update schema to match upstream API #8

Merged
merged 1 commit into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
§§
```


Expand Down
23 changes: 9 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,36 @@ 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 <[email protected]>",]
license = "MIT"
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"
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"
asyncio = "^3.4.3"
toml = "^0.10.2"

[tool.poetry.group.ci.dependencies]
pytest-md-report = "^0.6.2"
pytest-md-report = "^0.6.2"
2 changes: 1 addition & 1 deletion scripts/updateUpstreamSchema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ✅")
Expand Down
1 change: 1 addition & 0 deletions sendou/models/tournament/bracket/bracket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions sendou/models/tournament/tournament.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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]:
"""
Expand Down
4 changes: 4 additions & 0 deletions sendou/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down