From 090111b3982905631b3d647266f5b7cf4287d5f8 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 21:03:21 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.5.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.5.0...v4.6.0) - [github.com/psf/black: 23.12.1 → 24.3.0](https://github.com/psf/black/compare/23.12.1...24.3.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0412b790..952f0211 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -12,7 +12,7 @@ repos: - id: check-toml - id: check-merge-conflict - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.3.0 hooks: - id: black language_version: python3.11 From 0538e69018e4f7fc087a99e1ebcffb1b677b66f7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Apr 2024 21:03:28 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- api/backends/github.py | 26 ++++++++++++++++++-------- api/compat.py | 1 + api/models/announcements.py | 19 +++++++++++-------- app.py | 6 +++--- requirements.txt | 4 ++-- 5 files changed, 35 insertions(+), 21 deletions(-) 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"