fix: lint errors (import sorting, unused vars)
This commit is contained in:
@@ -11,7 +11,6 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
import logging
|
||||
import uuid
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime, timezone
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from datetime import datetime, timezone
|
||||
|
||||
import asyncpg
|
||||
|
||||
from services.shared.schemas import TrendDirection, TrendSummary
|
||||
from services.shared.schemas import TrendSummary
|
||||
|
||||
logger = logging.getLogger("projection")
|
||||
|
||||
@@ -169,10 +169,8 @@ def project_macro_decay(
|
||||
|
||||
# Decay factor: ratio of future impact to current impact
|
||||
if half_life > 0:
|
||||
current_factor = math.pow(2.0, -current_age_days / half_life)
|
||||
future_factor = math.pow(2.0, -future_age_days / half_life)
|
||||
else:
|
||||
current_factor = 0.0
|
||||
future_factor = 0.0
|
||||
|
||||
severity_w = _SEVERITY_WEIGHT.get(ev.severity, 0.25)
|
||||
|
||||
@@ -27,6 +27,12 @@ from services.aggregation.evidence import (
|
||||
rank_evidence as _rank_evidence_composite,
|
||||
)
|
||||
from services.aggregation.market_context import fetch_market_context
|
||||
from services.aggregation.pattern_matcher import find_self_patterns
|
||||
from services.aggregation.projection import (
|
||||
MacroEventInfo,
|
||||
compute_projection,
|
||||
persist_trend_projection,
|
||||
)
|
||||
from services.aggregation.scoring import (
|
||||
ScoringConfig,
|
||||
WeightedSignal,
|
||||
@@ -34,23 +40,16 @@ from services.aggregation.scoring import (
|
||||
sentiment_to_numeric,
|
||||
weighted_sentiment_average,
|
||||
)
|
||||
from services.aggregation.signal_propagation import (
|
||||
CompetitiveSignalRecord,
|
||||
build_pattern_weighted_signals,
|
||||
)
|
||||
from services.shared.metrics import (
|
||||
AGGREGATION_CONTRADICTION_SCORE,
|
||||
AGGREGATION_DURATION,
|
||||
AGGREGATION_SIGNALS_PROCESSED,
|
||||
AGGREGATION_WINDOWS_COMPUTED,
|
||||
)
|
||||
from services.aggregation.pattern_matcher import find_self_patterns
|
||||
from services.aggregation.projection import (
|
||||
MacroEventInfo,
|
||||
TrendProjection,
|
||||
compute_projection,
|
||||
persist_trend_projection,
|
||||
)
|
||||
from services.aggregation.signal_propagation import (
|
||||
CompetitiveSignalRecord,
|
||||
build_pattern_weighted_signals,
|
||||
)
|
||||
from services.shared.schemas import TrendDirection, TrendSummary, TrendWindow
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
+6
-8
@@ -16,6 +16,7 @@ import json
|
||||
import logging
|
||||
import time as _time
|
||||
from contextlib import asynccontextmanager
|
||||
from dataclasses import asdict
|
||||
from datetime import datetime, timezone
|
||||
from typing import Any, Optional
|
||||
|
||||
@@ -27,11 +28,16 @@ from pydantic import BaseModel
|
||||
from starlette.middleware.base import BaseHTTPMiddleware
|
||||
from starlette.responses import Response
|
||||
|
||||
from services.aggregation.pattern_matcher import (
|
||||
find_cross_company_patterns,
|
||||
find_self_patterns,
|
||||
)
|
||||
from services.extractor.metrics import get_model_performance_summary
|
||||
from services.shared.audit import get_entity_audit_trail, get_order_audit_trail, record_audit_event
|
||||
from services.shared.config import load_config
|
||||
from services.shared.db import get_pg_pool
|
||||
from services.shared.logging import new_trace_id, set_trace_context, setup_logging
|
||||
from services.shared.schemas import MAJOR_DECISION_CATALYSTS
|
||||
|
||||
logger = logging.getLogger("query_api")
|
||||
|
||||
@@ -2092,14 +2098,6 @@ async def toggle_competitive_layer(body: CompetitiveToggleBody):
|
||||
# (Requirements 10.1, 10.2, 10.3, 10.4, 11.4, 11.6)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
from dataclasses import asdict
|
||||
|
||||
from services.aggregation.pattern_matcher import (
|
||||
find_cross_company_patterns,
|
||||
find_self_patterns,
|
||||
)
|
||||
from services.shared.schemas import MAJOR_DECISION_CATALYSTS
|
||||
|
||||
|
||||
def _pattern_to_dict(p) -> dict[str, Any]:
|
||||
"""Convert a HistoricalPattern dataclass to a JSON-safe dict."""
|
||||
|
||||
@@ -461,10 +461,9 @@ async def classify_global_event(
|
||||
model_name = ollama_client._config.model
|
||||
|
||||
# Persist prompt to MinIO
|
||||
prompt_ref = None
|
||||
if minio_client:
|
||||
try:
|
||||
prompt_ref = _upload_classification_prompt(
|
||||
_upload_classification_prompt(
|
||||
minio_client, document_id, prompts, model_name, timestamp=ts,
|
||||
)
|
||||
except Exception:
|
||||
|
||||
@@ -128,8 +128,8 @@ TABLE_SCHEMAS: dict[str, pa.Schema] = {
|
||||
# These are added after the initial dict definition.
|
||||
def _register_worker_schemas() -> None:
|
||||
from services.lake_publisher.worker import (
|
||||
COMPETITOR_RELATIONSHIPS_SCHEMA,
|
||||
COMPETITIVE_SIGNALS_SCHEMA,
|
||||
COMPETITOR_RELATIONSHIPS_SCHEMA,
|
||||
GLOBAL_EVENTS_SCHEMA,
|
||||
MACRO_IMPACTS_SCHEMA,
|
||||
TREND_PROJECTIONS_SCHEMA,
|
||||
|
||||
@@ -35,6 +35,8 @@ from minio import Minio
|
||||
|
||||
from services.lake_publisher.partitions import partition_values
|
||||
from services.lake_publisher.worker import (
|
||||
publish_competitive_signal_fact,
|
||||
publish_competitor_relationship_fact,
|
||||
publish_document_extraction,
|
||||
publish_document_extractions_batch,
|
||||
publish_document_fact,
|
||||
@@ -48,8 +50,6 @@ from services.lake_publisher.worker import (
|
||||
publish_trade_fill,
|
||||
publish_trade_order,
|
||||
publish_trend_projection_fact,
|
||||
publish_competitor_relationship_fact,
|
||||
publish_competitive_signal_fact,
|
||||
)
|
||||
from services.shared.config import load_config
|
||||
from services.shared.db import get_minio, get_pg_pool, get_redis
|
||||
|
||||
@@ -15,6 +15,7 @@ from datetime import datetime, timezone
|
||||
import asyncpg
|
||||
from minio import Minio
|
||||
|
||||
from services.aggregation.projection import TrendProjection
|
||||
from services.lake_publisher.worker import publish_recommendation_facts
|
||||
from services.recommendation.eligibility import (
|
||||
EligibilityConfig,
|
||||
@@ -31,7 +32,6 @@ from services.recommendation.thesis_llm import (
|
||||
THESIS_PROMPT_VERSION,
|
||||
rewrite_thesis_with_llm,
|
||||
)
|
||||
from services.aggregation.projection import TrendProjection
|
||||
from services.shared.config import OllamaConfig
|
||||
from services.shared.metrics import (
|
||||
RECOMMENDATION_CONFIDENCE,
|
||||
|
||||
@@ -12,9 +12,9 @@ from pydantic import BaseModel, field_validator
|
||||
from services.shared.config import load_config
|
||||
from services.shared.db import get_pg_pool
|
||||
from services.shared.logging import setup_logging
|
||||
from services.symbol_registry.exposure import router as exposure_router
|
||||
from services.symbol_registry.competitors import router as competitors_router
|
||||
from services.symbol_registry.competitor_inference import router as inference_router
|
||||
from services.symbol_registry.competitors import router as competitors_router
|
||||
from services.symbol_registry.exposure import router as exposure_router
|
||||
|
||||
config = load_config()
|
||||
pool: Optional[asyncpg.Pool] = None
|
||||
|
||||
Reference in New Issue
Block a user