From 35aa61c651217663406c9cd6df404f85338b2d68 Mon Sep 17 00:00:00 2001 From: TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> Date: Thu, 2 Apr 2026 14:17:43 +0900 Subject: style: fix lint and formatting issues across news collector and shared --- shared/src/shared/db.py | 10 ++++------ shared/src/shared/notifier.py | 3 +-- shared/src/shared/sentiment.py | 6 ++---- 3 files changed, 7 insertions(+), 12 deletions(-) (limited to 'shared/src') diff --git a/shared/src/shared/db.py b/shared/src/shared/db.py index 55f93b4..9cc8686 100644 --- a/shared/src/shared/db.py +++ b/shared/src/shared/db.py @@ -299,11 +299,7 @@ class Database: async def get_top_symbol_scores(self, limit: int = 20) -> list[dict]: """Retrieve top symbol scores ordered by composite descending.""" - stmt = ( - select(SymbolScoreRow) - .order_by(SymbolScoreRow.composite.desc()) - .limit(limit) - ) + stmt = select(SymbolScoreRow).order_by(SymbolScoreRow.composite.desc()).limit(limit) async with self._session_factory() as session: try: result = await session.execute(stmt) @@ -431,7 +427,9 @@ class Database: "conviction": r.conviction, "reason": r.reason, "key_news": json.loads(r.key_news) if r.key_news else [], - "sentiment_snapshot": json.loads(r.sentiment_snapshot) if r.sentiment_snapshot else {}, + "sentiment_snapshot": json.loads(r.sentiment_snapshot) + if r.sentiment_snapshot + else {}, "created_at": r.created_at, } for r in rows diff --git a/shared/src/shared/notifier.py b/shared/src/shared/notifier.py index 9630a18..3d7b6cf 100644 --- a/shared/src/shared/notifier.py +++ b/shared/src/shared/notifier.py @@ -137,8 +137,7 @@ class TelegramNotifier: for i, s in enumerate(selections, 1): emoji = side_emoji.get(s.side.value, "⚪") lines.append( - f"{i}. {s.symbol} {emoji} {s.side.value} " - f"(conviction: {s.conviction:.0%})" + f"{i}. {s.symbol} {emoji} {s.side.value} (conviction: {s.conviction:.0%})" ) lines.append(f" {s.reason}") if s.key_news: diff --git a/shared/src/shared/sentiment.py b/shared/src/shared/sentiment.py index a20227e..449eb76 100644 --- a/shared/src/shared/sentiment.py +++ b/shared/src/shared/sentiment.py @@ -2,7 +2,7 @@ import logging from dataclasses import dataclass, field -from datetime import datetime, timedelta, timezone +from datetime import datetime, timezone from shared.sentiment_models import SymbolScore @@ -82,9 +82,7 @@ class SentimentAggregator: + filing_score * self.WEIGHTS["filing"] ) - def aggregate( - self, news_items: list[dict], now: datetime - ) -> dict[str, SymbolScore]: + def aggregate(self, news_items: list[dict], now: datetime) -> dict[str, SymbolScore]: """Aggregate news items into per-symbol scores. Each dict needs: symbols, sentiment, category, published_at. -- cgit v1.2.3