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:
@@ -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)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
@@ -29,14 +29,14 @@ class AnnouncementListResponse(BaseModel):
|
||||
|
||||
|
||||
class CrawlTriggerRequest(BaseModel):
|
||||
keywords: Optional[list[str]] = None
|
||||
sources: Optional[list[str]] = None
|
||||
keywords: list[str] | None = None
|
||||
sources: list[str] | None = None
|
||||
manual: bool = False
|
||||
|
||||
|
||||
class CrawlStatusResponse(BaseModel):
|
||||
running: bool
|
||||
last_crawl_time: Optional[datetime] = None
|
||||
last_crawl_time: datetime | None = None
|
||||
total_sources: int
|
||||
|
||||
|
||||
@@ -53,4 +53,4 @@ class SourcesResponse(BaseModel):
|
||||
class JobResponse(BaseModel):
|
||||
id: str
|
||||
name: str
|
||||
next_run_time: Optional[str] = None
|
||||
next_run_time: str | None = None
|
||||
|
||||
Reference in New Issue
Block a user