chore: ruff 代码检查与修复

130 issues auto-fixed (import ordering, UP045/UP006 type annotations),
33 issues manually fixed (E712/E501/E402/E722 + N818 rename + per-file
wechat ignore for N8xx naming conventions). All 33 tests pass.
This commit is contained in:
2026-05-09 14:28:09 +08:00
parent 02ea794015
commit 7455d7e426
33 changed files with 147 additions and 114 deletions
+5 -3
View File
@@ -1,6 +1,7 @@
import hashlib
from datetime import datetime, date
from sqlalchemy import String, Boolean, DateTime, Integer, Text, func
from datetime import datetime
from sqlalchemy import Boolean, DateTime, Integer, String, Text, func
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
@@ -25,7 +26,7 @@ class Announcement(Base):
is_sent: Mapped[bool] = mapped_column(Boolean, default=False)
keyword_matched: Mapped[bool] = mapped_column(Boolean, default=False)
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
updated_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now(), onupdate=func.now())
updated_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now(), onupdate=func.now()) # noqa: E501
@staticmethod
def generate_hash(title: str, publish_date: str, purchase_name: str,
@@ -36,5 +37,6 @@ class Announcement(Base):
@staticmethod
def source_map() -> dict:
import json
from app.config import settings
return json.loads(settings.announcement_sources)