style: 统一 Ruff 代码格式

This commit is contained in:
yml2213
2026-08-30 21:04:52 +08:00
parent c891ac982e
commit 47e19ed7b2
90 changed files with 5574 additions and 2350 deletions
+11 -3
View File
@@ -12,6 +12,7 @@
- 固定: hdid(32hex 硬锚,全账号同一) / app_version / sdk_version
- 动态签发: safedeviceid、登录帧 device_id。
"""
from __future__ import annotations
import hashlib
@@ -85,6 +86,7 @@ def record_login(account: str, ok: bool, message: str = "") -> None:
供 app_login 登录流程调用, GUI 设备绑定页读取展示。
"""
import time as _time
db = _load_db()
rec = db.get(account)
if rec is None:
@@ -112,7 +114,9 @@ def _load_db() -> dict:
def _save_db(db: dict) -> None:
try:
PRIMARY_PROFILE_DB.parent.mkdir(parents=True, exist_ok=True)
PRIMARY_PROFILE_DB.write_text(json.dumps(db, indent=2, ensure_ascii=False), encoding="utf-8")
PRIMARY_PROFILE_DB.write_text(
json.dumps(db, indent=2, ensure_ascii=False), encoding="utf-8"
)
except Exception:
pass
@@ -130,8 +134,12 @@ def _enrich_profile(profile: dict) -> tuple[dict, bool]:
out["guid32"] = hashlib.sha256(os.urandom(16) + b"guid").hexdigest()
changed = True
if len(out.get("hebe") or {}) < 5:
out["hebe"] = {f"Hebe_D{i}": hashlib.sha256(os.urandom(16) + f"hebe{i}".encode()).hexdigest()
for i in range(1, 6)}
out["hebe"] = {
f"Hebe_D{i}": hashlib.sha256(
os.urandom(16) + f"hebe{i}".encode()
).hexdigest()
for i in range(1, 6)
}
changed = True
return out, changed