diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index fc3176d..6b29e1a 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -51,6 +51,10 @@ jobs: if [ -f requirements.txt ]; then pip install -q -r requirements.txt; fi # 与本地门禁同一套命令。ruff 兼任 format 检查与 lint, # 对应 patbond-flutter 的 dart format + flutter analyze 两步。 + # + # 本地自查时注意:`ruff check . | tail -1; echo $?` 读到的是 **tail** 的 + # 退出码,不是 ruff 的——这样会把一次真实的 lint 失败读成通过(本仓已因此 + # 红过一次)。逐条分开跑,或用 ${PIPESTATUS[0]}。 - name: Gates run: | python --version diff --git a/app/providers/volcengine/client.py b/app/providers/volcengine/client.py index 82402f9..02c27e4 100644 --- a/app/providers/volcengine/client.py +++ b/app/providers/volcengine/client.py @@ -12,7 +12,7 @@ client,而不是各自再抄一遍鉴权与错误解包——这是把它单 from __future__ import annotations import logging -from typing import Any +from typing import Any, Self import httpx @@ -135,7 +135,7 @@ class ArkClient: if self._owns_client: self._client.close() - def __enter__(self) -> ArkClient: + def __enter__(self) -> Self: return self def __exit__(self, *exc_info: object) -> None: diff --git a/tests/providers/volcengine/test_video.py b/tests/providers/volcengine/test_video.py index ce286eb..439a756 100644 --- a/tests/providers/volcengine/test_video.py +++ b/tests/providers/volcengine/test_video.py @@ -55,12 +55,12 @@ def provider_with(handler, **kwargs) -> SeedanceVideoProvider: def video_request(**kwargs) -> GenerationRequest: - defaults = dict( - job_id="job-1", - media_kind=MediaKind.VIDEO, - model="doubao-seedance-x", - prompt="一只猫", - ) + defaults = { + "job_id": "job-1", + "media_kind": MediaKind.VIDEO, + "model": "doubao-seedance-x", + "prompt": "一只猫", + } return GenerationRequest(**{**defaults, **kwargs}) diff --git a/tests/test_layering.py b/tests/test_layering.py index 8c76e29..f86ad9e 100644 --- a/tests/test_layering.py +++ b/tests/test_layering.py @@ -82,7 +82,7 @@ class TestTransportStaysBusinessAgnostic: offenders = { name for name in imports_of(APP / "providers" / "volcengine" / "client.py") - if name.endswith((".video", ".image")) or name.endswith("models") + if name.endswith((".video", ".image", "models")) } assert not offenders, f"传输层不应依赖具体业务模块:{offenders}"