From e0810a9c0badad0249176b48d665e145cb22337b Mon Sep 17 00:00:00 2001 From: yml2213 Date: Thu, 10 Sep 2026 11:32:29 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E6=8C=89=20ruff=20=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96=E7=99=BB=E5=BD=95=E9=98=9F=E5=88=97=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=B9=B6=E8=B7=B3=E8=BF=87=E5=B7=B2=E5=88=A0=E9=99=A4=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E6=8E=A8=E9=80=81=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- .githooks/pre-push | 2 +- tests/test_huya_selected_login_queue.py | 4 +++- web/backend/routers/huya/login.py | 8 ++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.githooks/pre-push b/.githooks/pre-push index a7b068c..6b117d9 100755 --- a/.githooks/pre-push +++ b/.githooks/pre-push @@ -28,7 +28,7 @@ while read -r local_ref local_sha remote_ref remote_sha; do changed_paths="$(git diff --name-only "$remote_sha..$local_sha" -- '*.py')" fi while IFS= read -r path; do - [ -n "$path" ] && python_files+=("$path") + [ -n "$path" ] && [ -f "$path" ] && python_files+=("$path") done <<< "$changed_paths" done <<< "$push_lines" diff --git a/tests/test_huya_selected_login_queue.py b/tests/test_huya_selected_login_queue.py index 0e3da8d..edf668a 100644 --- a/tests/test_huya_selected_login_queue.py +++ b/tests/test_huya_selected_login_queue.py @@ -27,7 +27,9 @@ def _ok_result() -> HuyaLoginResult: ) -def _fail_result(message: str = "网络超时", code: str = "LOGIN_FAILED") -> HuyaLoginResult: +def _fail_result( + message: str = "网络超时", code: str = "LOGIN_FAILED" +) -> HuyaLoginResult: return HuyaLoginResult(success=False, message=message, code=code) diff --git a/web/backend/routers/huya/login.py b/web/backend/routers/huya/login.py index 6875082..ab0fc83 100644 --- a/web/backend/routers/huya/login.py +++ b/web/backend/routers/huya/login.py @@ -662,9 +662,7 @@ def password_login_selected_accounts( current: User = Depends(get_current_user), ): """对已导入的虎牙账号执行 Web 密码登录(单线程,失败可重试)。""" - return _run_selected_password_logins( - channel="web", req=req, db=db, current=current - ) + return _run_selected_password_logins(channel="web", req=req, db=db, current=current) @router.post("/accounts/app-password-login/selected") @@ -674,6 +672,4 @@ def app_password_login_selected_accounts( current: User = Depends(get_current_user), ): """对已导入的虎牙账号使用 App 协议逐个登录(推荐,单线程)。""" - return _run_selected_password_logins( - channel="app", req=req, db=db, current=current - ) + return _run_selected_password_logins(channel="app", req=req, db=db, current=current)