diff --git a/api/backends/github.py b/api/backends/github.py index f4b07505..82a5c452 100644 --- a/api/backends/github.py +++ b/api/backends/github.py @@ -108,9 +108,9 @@ async def __assemble_contributor( ) if team_view: - filter_contributor[ - "keys" - ] = f"{base_url.replace('api.', '')}/{filter_contributor['login']}.gpg" + filter_contributor["keys"] = ( + f"{base_url.replace('api.', '')}/{filter_contributor['login']}.gpg" + ) return Contributor(**filter_contributor) @@ -136,7 +136,9 @@ async def list_releases( Returns: list[Release]: A list of Release objects. """ - list_releases_endpoint: str = f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/releases?per_page={per_page}&page={page}" + list_releases_endpoint: str = ( + f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/releases?per_page={per_page}&page={page}" + ) response: ClientResponse = await http_get( headers=self.headers, url=list_releases_endpoint ) @@ -162,7 +164,9 @@ async def get_release_by_tag_name( Returns: Release: The Release object representing the retrieved release. """ - release_by_tag_endpoint: str = f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/releases/tags/{tag_name}" + release_by_tag_endpoint: str = ( + f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/releases/tags/{tag_name}" + ) response: ClientResponse = await http_get( headers=self.headers, url=release_by_tag_endpoint ) @@ -181,7 +185,9 @@ async def get_latest_release( Returns: Release: The latest release for the given repository. """ - latest_release_endpoint: str = f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/releases/latest" + latest_release_endpoint: str = ( + f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/releases/latest" + ) response: ClientResponse = await http_get( headers=self.headers, url=latest_release_endpoint ) @@ -200,7 +206,9 @@ async def get_latest_pre_release( Returns: Release: The latest pre-release for the given repository. """ - list_releases_endpoint: str = f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/releases?per_page=10&page=1" + list_releases_endpoint: str = ( + f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/releases?per_page=10&page=1" + ) response: ClientResponse = await http_get( headers=self.headers, url=list_releases_endpoint ) @@ -223,7 +231,9 @@ async def get_contributors(self, repository: GithubRepository) -> list[Contribut list[Contributor]: A list of contributors for the given repository. """ - contributors_endpoint: str = f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/contributors" + contributors_endpoint: str = ( + f"{self.repositories_rest_endpoint}/{repository.owner}/{repository.name}/contributors" + ) response: ClientResponse = await http_get( headers=self.headers, url=contributors_endpoint ) diff --git a/api/compat.py b/api/compat.py index 993e02af..95207291 100644 --- a/api/compat.py +++ b/api/compat.py @@ -9,6 +9,7 @@ - GET /patches/: Retrieve a list of patches for a given release tag. """ + import os from sanic import Blueprint, Request from sanic.response import JSONResponse, json diff --git a/api/models/announcements.py b/api/models/announcements.py index 86047219..fd5f3df2 100644 --- a/api/models/announcements.py +++ b/api/models/announcements.py @@ -21,14 +21,17 @@ def to_response(announcement: AnnouncementDbModel): id=announcement.id, author=announcement.author, title=announcement.title, - content=ContentFields( - message=announcement.message, - attachment_urls=[ - attachment.attachment_url for attachment in announcement.attachments - ], - ) - if announcement.message or announcement.attachments - else None, + content=( + ContentFields( + message=announcement.message, + attachment_urls=[ + attachment.attachment_url + for attachment in announcement.attachments + ], + ) + if announcement.message or announcement.attachments + else None + ), channel=announcement.channel, created_at=str(announcement.created_at), level=announcement.level, diff --git a/app.py b/app.py index af8a7a7c..a699c847 100644 --- a/app.py +++ b/app.py @@ -75,9 +75,9 @@ async def add_cache_control(_, response): @app.on_response async def add_csp(_, response): - response.headers[ - "Content-Security-Policy" - ] = "default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;" + response.headers["Content-Security-Policy"] = ( + "default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;" + ) app.static( diff --git a/requirements.txt b/requirements.txt index c93aedb5..9efe91f2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,8 +2,8 @@ aiodns==3.1.1 ; (sys_platform == "linux" or sys_platform == "darwin") and python aiofiles==23.2.1 ; python_version >= "3.11" and python_version < "3.13" aiohttp[speedups]==3.9.1 ; python_version >= "3.11" and python_version < "3.13" aiosignal==1.3.1 ; python_version >= "3.11" and python_version < "3.13" -argon2-cffi-bindings==21.2.0 ; python_version >= "3.11" and python_version < "3.13" argon2-cffi==23.1.0 ; python_version >= "3.11" and python_version < "3.13" +argon2-cffi-bindings==21.2.0 ; python_version >= "3.11" and python_version < "3.13" asyncstdlib==3.12.0 ; python_version >= "3.11" and python_version < "3.13" attrs==23.2.0 ; python_version >= "3.11" and python_version < "3.13" beautifulsoup4==4.12.2 ; python_version >= "3.11" and python_version < "3.13" @@ -40,11 +40,11 @@ pyjwt==2.8.0 ; python_version >= "3.11" and python_version < "3.13" pyseto==1.7.7 ; python_version >= "3.11" and python_version < "3.13" python-dateutil==2.8.2 ; python_version >= "3.11" and python_version < "3.13" pyyaml==6.0.1 ; python_version >= "3.11" and python_version < "3.13" +sanic==23.12.1 ; python_version >= "3.11" and python_version < "3.13" sanic-beskar==2.3.2 ; python_version >= "3.11" and python_version < "3.13" sanic-ext==23.12.0 ; python_version >= "3.11" and python_version < "3.13" sanic-limiter @ git+https://github.com/Omegastick/sanic-limiter@843e13144aa21d843ce212a7c1db31b72ce8a103 ; python_version >= "3.11" and python_version < "3.13" sanic-routing==23.12.0 ; python_version >= "3.11" and python_version < "3.13" -sanic==23.12.1 ; python_version >= "3.11" and python_version < "3.13" sanic[ext]==23.12.1 ; python_version >= "3.11" and python_version < "3.13" sentry-sdk[sanic]==1.39.2 ; python_version >= "3.11" and python_version < "3.13" six==1.16.0 ; python_version >= "3.11" and python_version < "3.13"